Created
July 10, 2017 15:29
-
-
Save hatemalimam/bd5e251800c9656ae4720ad514e24d05 to your computer and use it in GitHub Desktop.
ChartistJSF Plugins Bean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ManagedBean | |
@ViewScoped | |
public class ChartDataBean implements Serializable { | |
private LineChartModel pluginsModel; | |
public ChartDataBean() { | |
createCharts(); | |
} | |
public void createCharts() { | |
createLinePluginsModel(); | |
} | |
public void createLinePluginsModel() { | |
Random random = new Random(); | |
pluginsModel = new LineChartModel(); | |
pluginsModel.setAspectRatio(AspectRatio.GOLDEN_SECTION); | |
pluginsModel.addLabel("1"); | |
pluginsModel.addLabel("2"); | |
pluginsModel.addLabel("3"); | |
pluginsModel.addLabel("4"); | |
pluginsModel.addLabel("5"); | |
pluginsModel.addLabel("6"); | |
pluginsModel.addLabel("7"); | |
pluginsModel.addLabel("8"); | |
LineChartSeries series1 = new LineChartSeries(); | |
series1.setName("Series 1"); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
series1.set(random.nextInt(10)); | |
pluginsModel.addSeries(series1); | |
pluginsModel.setAnimateAdvanced(false); | |
pluginsModel.setShowTooltip(true); | |
pluginsModel.setAnimatePath(false); | |
pluginsModel.setShowArea(true); | |
} | |
public LineChartModel getPluginsModel() { | |
return pluginsModel; | |
} | |
public void setPluginsModel(LineChartModel pluginsModel) { | |
this.pluginsModel = pluginsModel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment