mhkeller / layercake

graphics framework for sveltejs
https://layercake.graphics
MIT License
1.41k stars 31 forks source link

Add a prop to HTML Axis components to use pixels and not percentages #199

Closed mhkeller closed 4 months ago

mhkeller commented 5 months ago

Currently, the Axis components use percentages so they can be used in server-side charts. But you may want to use them also in normal charts that don't use percentRange if, for example, you want an easy to way to make a multi-line label in HTML.

All you have to do is change % to px and we could expose this a prop to make it easy for people.

mhkeller commented 5 months ago

This could also be done dynamically looking at the percentRange prop at first:

export let units = $percentRange === true ? '%' : 'px';
mhkeller commented 4 months ago

Done via https://github.com/mhkeller/layercake/pull/203