mariusmuntean / ChartJs.Blazor

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

Ability to add plugins to chart options #63

Closed danjrauch closed 4 years ago

danjrauch commented 4 years ago

Describe the feature request

This isn't necessarily a problem, but I'd like to add styling to my charts using the plugin chartjs-plugin-colorschemes, but currently I don't think this is possible.

Which charts does this feature request apply to?

All charts.

Describe the solution you'd like

I think something like a 'Plugins' property in the Common property set could do the job, but I'm not sure.

Describe alternatives you've considered

I don't think there is another way, because this has to be a property in the chart options. I'm going to look into just copying a style using the 'Tooltips' property.

Additional context

Don't have anything else to add. If this is easier than I'm thinking please let me know. Apologies for any incorrect terminology above. I'm new to C# and Blazor.

Joelius300 commented 4 years ago

Thank you for contacting us!

Just including a Plugins property would indeed do the job but we won't provide any C# implementations of the plugins ((yet)) so you'll have to create those yourself and add them there. As far as I understand from the docs and the type-map there's two plugin properties. One translates to a Dictionary<string, object>-property named Plugins in the root of BaseConfigOptions. The other translates to a List<object>-property (also named Plugins) in the root of ConfigBase.

I'm using object here because the support for callbacks (which we would need here) is not done yet (I'm working on it thought) and the plugins have to be made by you anyway.

Since you're new to C#, I want to ask you if you'd like to add these two properties to those classes and create a pull request. It's only two lines of code excluding the summary of the properties so it's definitely something a beginner could do. If not, that's fine but I'd love to review your pull request for this :)

danjrauch commented 4 years ago

Thanks! I will put in a pull request so I can work on this soon.

Joelius300 commented 4 years ago

Awesome :)

Just fork the repo, create a branch, do your stuff and submit the PR. I will review it then.
In the PR comment you can then write "fixes #63" which will automatically close this issue here once it's merged. Until then, this issue should stay open (it's not resolved yet). That's why I'm reopening :)