mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
676 stars 151 forks source link

SparkLines #166

Closed ClumsyPenguin closed 3 years ago

ClumsyPenguin commented 3 years ago

Describe the feature request

Little bar graphs/ pie's or linegraph that are able to be easily read in the lineheight of a table.

Which charts does this feature request apply to?

JavaScript equivalent

https://github.com/Volorf/SparklinerJS

Describe alternatives you've considered

I have used this repository before (https://github.com/joadan/Blazor-ApexCharts) but implementation is difficult.

Additional context

Example: image image

Joelius300 commented 3 years ago

Hey @ClumsyPenguin, thanks for the issue.

Chart.js doesn't have a built-in sparklines type AFAIK but since it's very customizable you can achieve the result you want with pure Chart.js configuration.

Here are some issues you should check out: https://github.com/chartjs/Chart.js/issues/14, https://github.com/chartjs/Chart.js/issues/668, https://github.com/chartjs/Chart.js/issues/7720

They contain links to codepens which show the config you need. As always, you can translate the JavaScript code to C# by just transforming the names to CamelCase and adding some new statements (works surprisingly well). However, you might stumble upon an option that's not supported yet. If that's the case, please open a new issue with all the information about that specific option so we can take a look at it and figure out a workaround for as long as it's not fixed.

Play around with the options and refer to the links I posted above. Once you got something, let us know - I'm sure you'll get it working!

ClumsyPenguin commented 3 years ago

Got ya! Thanks for the info. This can be closed, i am sure i will figure it out somehow. Thanks again!

Joelius300 commented 3 years ago

Best of luck 😄

Feel free to post a sample here once you've figured it out. I'm sure some people would appreciate it ❤️