Primefaces uses jqplot to draw charts, but all configuration options of charts are not provided by primefaces. For example, you have a LineChartSeries object and you will draw it on a LineChartModel. There are only two configuration parameters(style and show) for marker (this option presents in LineChartSeries class) although there are more in jqplot API. What will you do if you want to set size of a marker? What about the color?
Well, there is a way to do it and it is INJECTION! When you look at it the source code you will see a json-formatted string to pass markerOptions in encode function of LineChartSeries class:
Happy injection!
Well, there is a way to do it and it is INJECTION! When you look at it the source code you will see a json-formatted string to pass markerOptions in encode function of LineChartSeries class:
writer.write(",markerOptions:{show:" + this.isShowMarker()+ ", style:'" + this.getMarkerStyle() + "'}");
You can properly set markerStyle property whose type is String so that you can set size option when markerOptions is passed. Pay attention to single quotes. This is my injection :
myLineChartSeriesObj.setMarkerStyle("dash', size:'3.0");
Now you have just set size property of the marker. You can also set other marker options provided in jqPlot API by using this way.Happy injection!
Comments
Post a Comment