hatemalimam / ChartistJSF

Highly Customizable Responsive Charts for JavaServer Faces.
https://chartistjsf-showcase.herokuapp.com
Apache License 2.0
39 stars 12 forks source link

Added ability to set plugins from bean #19

Closed simoneobo closed 7 years ago

simoneobo commented 7 years ago

Hi, i modified your last version to add ability to set plugin also from bean with setPlugins(String plugins) method on every ChartModel class.

Example: if i import inside a project this plugin and link it inside the chart page with then from java you can create a new PieChartModel and call pieChartModelNoTarget.setPlugins("[Chartist.plugins.legend()]");

If you dont' call setPlugins on a chartModel, the plugin works as you had already implemented.

Also, i extend the function for BarChart and PieChart models.

Let me know if you like it and if you want to integrate inside your project.

Thanks

hatemalimam commented 7 years ago

Hi, thank you for the merge request.

Would you elaborate more on the main purpose of this feature ? Any reason you might be restricted to set the plugins from the java code part ?

the way I see it, it's better to have a JS var, with all the plugins defined with no syntax errors rather than a string being set on the model part.

I'm open for any discussion 👍 thank you again.

simoneobo commented 7 years ago

In a project i'm working i start modify version 2.1 to add plugin support from bean. At the same time you release v3.0 so now i prefer to not break compatibility and mantain the ability to set plugin also for BarChart and PieChart model. (it's not a big deal to modify my code, however).

Anyway, i'm not restricting the plugin feature, but extending it giving also the ability to call setPlugins from java code. If you don't call that method in java code then is evaluated the Githubissues.

  • Githubissues is a development platform for aggregating issues.