-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to label axes #20
Comments
The messy, hacky proof of concept you see on the screenshot was produced by this: You can find the live demo link in the head of Basically, I align the first header cell and rotate the second one via selectors like |
Ok, let me try to help you here... HTML Structure: <div id="my-chart">
<table class="charts-css area"> ... </table>
<div class="y-axis"> Y Axis Label </div>
<div class="x-axis"> X Axis Label </div>
</div> CSS: body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
#my-chart {
display: grid;
grid-template-columns: 40px 600px;
grid-template-rows: 250px 40px;
grid-template-areas:
"y-axis chart"
"x-axis x-axis";
}
#my-chart > table {
grid-area: chart;
}
#my-chart > .y-axis {
grid-area: y-axis;
text-align: center;
writing-mode: tb-rl;
}
#my-chart > .x-axis {
grid-area: x-axis;
text-align: center;
} Result: |
I think we I'll add this example to the docs... |
Thank you for the example, although I've also understood what you meant in your original comment. This workaround is not acceptable. My solution keeps the semantic value of the table (showing the column headings in the table header row) and displays correctly under console based browsers and could be consumed by machines as well, while the same can't be said about random div's. |
Although, I see what you did there with |
Docs updated: https://chartscss.org/components/axes/#axis-title |
So is this a "WONTFIX" or is it still on the roadmap? |
Basically I like your solution, you are using But when developing a framework, we need to address all the edge cases. You do have a great workaround using the table raw data (located in
For now I prefer to use an externa |
Yes, I was wondering how this could be solved in a more universal way. I agree that this will probably be a special case only supported by single dataset tables and should be switched on with a special option. Some of the maths will get a little bit more messy due to conditionally having to create space for the axis titles, but I think it could be worth it. I see tables and charts with single datasets pretty often, so this could be something that people should see often. And of course I love it how it still displays correctly in Links2. ❤️ 🤓 After having seen how easily CSS charting could be done, it kills me to see all these review and comparison sites use |
Definitely agree with the mentality of "when developing a framework, we need to address all the edge cases ... including the multiple datasets". In this particular case, though, how could it be possible to implement this inside
So, I think the extra |
I have a way to add axis titles using CSS Grid. I need to develop this. But the solution will not require extra |
Interesting. I hope that "existing markup" is not the |
Simple 2D tables with a single dataset are very common in the real world. I wouldn't mind if we had two separate solutions, so that at least the simple ones could look awesome under |
Could we please have an option to label our axes? It's pretty easy based on
<thead>
, I did a mockup myself.The text was updated successfully, but these errors were encountered: