HighChartsAPI Add-on
Highcharts API
This is a simple-to-use API for generating Charts with the HighCharts API.
I'm trying to improve my AddOn as fast as possible, please let me know if it should contain any new feature soon and rate for my AddOn if you like it.
Implemented Features are
- Area Chart
- Bar Chart
- Column Chart
- Line Chart
- Pie Chart
- ChartConfiguration
- PlotOptions (per-chart-type)
- DataSeries
Since v2.2.0
- AreaRange Chart
- AreaSpline Chart
- AreaSplineRange Chart
- Boxplot Chart
- Bubble Chart
- ColumnRange Chart
- ErrorBar Chart
- Funnel Chart
Since v2.2.1-QF
- Fixed #13
- Fixed #14
- Fixed #22
Sample code
// *** PIE *** ChartConfiguration pieConfiguration = new ChartConfiguration(); pieConfiguration.setTitle("TestPie"); pieConfiguration.setChartType(ChartType.PIE); pieConfiguration.setBackgroundColor(Colors.WHITE); PieChartSeries pieFruits = new PieChartSeries("Fruits"); PieChartData bananas = new PieChartData("Bananas", 33.2); PieChartData melons = new PieChartData("Melons", 6.21); PieChartData apples = new PieChartData("Apples", 3.44); pieFruits.getData().add(bananas); pieFruits.getData().add(melons); pieFruits.getData().add(apples); pieConfiguration.getSeriesList().add(pieFruits); try { HighChart pieChart = HighChartFactory.renderChart(pieConfiguration); pieChart.setHeight(80, Unit.PERCENTAGE); pieChart.setWidth(80, Unit.PERCENTAGE); System.out.println("PieChart Script : " + pieConfiguration.getHighChartValue()); layout.addComponent(pieChart); layout.setComponentAlignment(pieChart, Alignment.MIDDLE_CENTER); } catch (NoChartTypeException e) { e.printStackTrace(); } // *** LINE *** ChartConfiguration lineConfiguration = new ChartConfiguration(); lineConfiguration.setTitle("TestLine"); lineConfiguration.setChartType(ChartType.LINE); lineConfiguration.setBackgroundColor(Colors.WHITE); List<Object> bananaValues = new ArrayList<Object>(); bananaValues.add(11.3); bananaValues.add(25.1); bananaValues.add(32.7); LineChartSeries bananaLine = new LineChartSeries("Bananas", bananaValues); List<Object> sweetValues = new ArrayList<Object>(); sweetValues.add(33.65); sweetValues.add(63.24); sweetValues.add(21.52); LineChartSeries choclateLine = new LineChartSeries("Choclate", sweetValues); lineConfiguration.getSeriesList().add(bananaLine); lineConfiguration.getSeriesList().add(choclateLine); try { HighChart lineChart = HighChartFactory.renderChart(lineConfiguration); lineChart.setHeight(80, Unit.PERCENTAGE); lineChart.setWidth(80, Unit.PERCENTAGE); System.out.println("LineChart Script : " + lineConfiguration.getHighChartValue()); layout.addComponent(lineChart); layout.setComponentAlignment(lineChart, Alignment.MIDDLE_CENTER); } catch (NoChartTypeException e) { e.printStackTrace(); } setContent(layout);
ChartConfiguration config = new ChartConfiguration(); config.setChartType(ChartType.LINE); Axis xAxis = new Axis(Axis.AxisType.xAxis); xAxis.getCategories().add("My First Category"); xAxis.getCategories().add("My Second Category"); xAxis.setLineColor(Color.BLUE); xAxis.setTickLength(20); config.setxAxis(xAxis); HighChart chart = HighChartFactory.renderChart(config);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Fixed #13
- Fixed #14
- Fixed #22
I promised these fixes very long ago and I am very sorry this little code took so long to be released...
I have not much time to improve this addon and things are slowing down.
Still, I am working on it and there will be furhter releases.
For now, here's a Quick-Fix Version for theses poor mistakes.
- Released
- 2016-06-21
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.0+
- Browser
- Browser Independent