You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example chart on https://chartscss.org/docs/usage/ shows a drawback of how --size variables work. They are designed to scale between 0 and 1. The example markup does a very simple transformation from table data to --size:
<tdstyle="--size: 0.46"> 46 </td>
The drawback is that the chart bars only use half the chart area, since the largest value is 0.46.
My suggestion is to add the following rule to the standard styles:
This still allows the original --size markup to be used unchanged for backward compatibility, but now supports the following changes:
<tbodystyle="--valuemax: 50">
and
<tdstyle="--value: 46"> 46 </td>
Which allows for a direct copy of table data to CSS --value variable, but better formats the chart to use more of the chart area since it scales values between 0 and 50 (--valuemin and --valuemax) to between 0 and 1.
With a bit more experience, I've realised that start and end values need autoscaling too, not just size. I also changed valuemin to value-min and valuemax to value-max because it looks better.
Activity
IDisposable commentedon Jan 11, 2026
Love this idea, want a PR?
andrewgoz commentedon Apr 9, 2026
With a bit more experience, I've realised that start and end values need autoscaling too, not just size. I also changed
valuemintovalue-minandvaluemaxtovalue-maxbecause it looks better.I'll leave a pull request until I've been using ChartsCSS a bit more, just in case there's anything else I need to add.