legend.getPosition().setAlign(HorzAlign.LEFT);
legend.getPosition().setVertAlign(VertAlign.TOP);
legend.getPosition().setX(120);
legend.getPosition().setY(80);
legend.setFloating(true);
legend.setBackgroundColor(new RGB(255, 255, 255));
chartConfig.setLegend(legend);
CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(Arrays.asList("Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"));
LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
xAxesSet.add(xAxis);
chartConfig.setXAxes(xAxesSet);
// Multiple axes
NumberYAxis temperatureAxis = new NumberYAxis();
temperatureAxis.setAllowDecimals(false);
temperatureAxis.setLabel(new YAxisDataLabel());
temperatureAxis.getLabel().setFormatterJsFunc(
"function() {" + " return this.value +'°C'; " + "}");
temperatureAxis.getLabel().setStyle("{ color: '#89A54E' }");
temperatureAxis.setTitle(new AxisTitle("Temperature"));
temperatureAxis.getTitle().setStyle(" { color: '#89A54E' }");
temperatureAxis.setOpposite(true);
LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
yAxesSet.add(temperatureAxis);
// secondary y-axis
NumberYAxis rainfallAxis = new NumberYAxis();
rainfallAxis.setGrid(new Grid());
rainfallAxis.getGrid().setLineWidth(0);
rainfallAxis.setTitle(new AxisTitle("Rainfall"));
rainfallAxis.getTitle().setStyle(" { color: '#4572A7' }");
rainfallAxis.setLabel(new YAxisDataLabel());
rainfallAxis.getLabel().setStyle("{ color: '#4572A7' }");
rainfallAxis.getLabel().setFormatterJsFunc(
"function() {" + " return this.value +' mm'; " + "}");
yAxesSet.add(rainfallAxis);
// tertiary y-axis
NumberYAxis sealevelPressureAxis = new NumberYAxis();
sealevelPressureAxis.setGrid(new Grid());
sealevelPressureAxis.getGrid().setLineWidth(0);
sealevelPressureAxis.setTitle(new AxisTitle("Sea-Level Pressure"));
sealevelPressureAxis.getTitle().setStyle(" { color: '#AA4643' }");
sealevelPressureAxis.setLabel(new YAxisDataLabel());
sealevelPressureAxis.getLabel().setStyle("{ color: '#AA4643' }");
sealevelPressureAxis.getLabel().setFormatterJsFunc(
"function() {" + " return this.value +' mb'; " + "}");
sealevelPressureAxis.setOpposite(true);
yAxesSet.add(sealevelPressureAxis);
chartConfig.setYAxes(yAxesSet);
InvientCharts chart = new InvientCharts(chartConfig);
// Configuration of Rainfall series
ColumnConfig colCfg = new ColumnConfig();
colCfg.setColor(new RGB(69, 114, 167));
// Rainfall series
XYSeries rainfallSeriesData = new XYSeries("Rainfall",
SeriesType.COLUMN, colCfg);
rainfallSeriesData.setSeriesPoints(getPoints(rainfallSeriesData, 49.9,
71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1,
95.6, 54.4));
rainfallSeriesData.setYAxis(rainfallAxis);
chart.addSeries(rainfallSeriesData);
// Configuration of Sealevel series
SplineConfig seaLevelSplineCfg = new SplineConfig();
seaLevelSplineCfg.setColor(new RGB(170, 70, 67));
seaLevelSplineCfg.setMarker(new SymbolMarker(false));
seaLevelSplineCfg.setDashStyle(DashStyle.SHORT_DOT);
// Sealevel series
XYSeries seaLevelSeriesData = new XYSeries("Sea-Level Pressure",
SeriesType.SPLINE, seaLevelSplineCfg);
seaLevelSeriesData.setSeriesPoints(getPoints(seaLevelSeriesData, 1016,
1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1,
1016.9, 1018.2, 1016.7));
seaLevelSeriesData.setYAxis(sealevelPressureAxis);
chart.addSeries(seaLevelSeriesData);
// Configuration of Temperature series
SplineConfig tempSplineCfg = new SplineConfig();
tempSplineCfg.setColor(new RGB(137, 165, 78));
// Temperature series
XYSeries tempSeriesData = new XYSeries("Temperature",
SeriesType.SPLINE, tempSplineCfg);
tempSeriesData.setSeriesPoints(getPoints(tempSeriesData, 7.0, 6.9, 9.5,
14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6));