mariusmuntean / ChartJs.Blazor

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

Support Gradient Fill Colors #158

Open stefangordon opened 3 years ago

stefangordon commented 3 years ago

Describe your question

Is a gradient fill currently possible?

Any pointers on how you might try to achieve it?

For example: https://jsfiddle.net/9gLakq26/

Which charts is this question related to?

All

JavaScript equivalent

https://jsfiddle.net/9gLakq26/

Additional context

FWIW I am using master, not the 1.x release.

Joelius300 commented 3 years ago

Good question!

Using gradients as colors isn't supported yet. We can use this issue for tracking this feature.

Since you need to create the gradients with the 2d-context of the canvas, you can't just extend the serialized classes and thus the workaround isn't as straight-forward. I have just added a sample showcasing the workaround in 609a6e5.

Please try it and tell us if it worked :)

In order to implement this feature we'll need the following:

If you have anything to add, please do!

stefangordon commented 3 years ago

Huge help @Joelius300 thank you.

brentminder commented 1 year ago

Any updates on support for canvas 2d gradients in Blazor wasm?