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
Looking at the samples <td style="--size: calc( 60 / 100 );"> $ 60K </td> might be more semantically valuable if we did something like
<td data-value="60" data-total="100" style="--size: calc( attr("data-value") / attr("data-total");"> $ 60K </td> or something similar... and we could have the default style for size be implicitly that calc and do similar for --start. Also would be cool to be able to reach up for the data-total value using the cascading of CSS ;)
The text was updated successfully, but these errors were encountered:
When I started developing Charts.CSS I tested all the available methods. There where several use cases where data-* attributes had less flexibility. That is why I decided to use CSS variables.
In your example, the --size calculation is attr("data-value") / attr("data-total"), this is not always the default size.
When you prefer to display stacked chart, you need to change the "total" value. Read the stacked docs, and see the examples on the Simple vs. Percentage section.
In addition, when using CSS variables, you can use math functions everywhere. With data attributes you have to use static value. You can't use calculations like data-total="calc( 2 + 3 + 4 )"
Looking at the samples
<td style="--size: calc( 60 / 100 );"> $ 60K </td>
might be more semantically valuable if we did something like<td data-value="60" data-total="100" style="--size: calc( attr("data-value") / attr("data-total");"> $ 60K </td>
or something similar... and we could have the default style for size be implicitly thatcalc
and do similar for--start
. Also would be cool to be able to reach up for thedata-total
value using the cascading of CSS ;)The text was updated successfully, but these errors were encountered: