addChart(chart);
}
private void showScatter() {
InvientChartsConfig chartConfig = new InvientChartsConfig();
chartConfig.getGeneralChartConfig().setType(SeriesType.SCATTER);
chartConfig.getGeneralChartConfig().setZoomType(ZoomType.XY);
chartConfig.getTitle().setText(
"Height Versus Weight of Individuals by Gender");
chartConfig.getSubtitle().setText("Source: Heinz 2003");
chartConfig.getTooltip().setFormatterJsFunc(
"function() {"
+ " return '' + this.x + ' cm, ' + this.y + ' kg'; "
+ "}");
NumberXAxis xAxis = new NumberXAxis();
xAxis.setTitle(new AxisTitle("Height (cm)"));
xAxis.setStartOnTick(true);
xAxis.setEndOnTick(true);
xAxis.setShowLastLabel(true);
LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
xAxesSet.add(xAxis);
chartConfig.setXAxes(xAxesSet);
NumberYAxis yAxis = new NumberYAxis();
yAxis.setTitle(new AxisTitle("Weight (kg)"));
LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
yAxesSet.add(yAxis);
chartConfig.setYAxes(yAxesSet);
Legend legend = new Legend();
legend.setLayout(Layout.VERTICAL);
Position legendPos = new Position();
legendPos.setAlign(HorzAlign.LEFT);
legendPos.setVertAlign(VertAlign.TOP);
legendPos.setX(100);
legendPos.setY(70);
legend.setPosition(legendPos);
legend.setFloating(true);
legend.setBorderWidth(1);
legend.setBackgroundColor(new RGB(255, 255, 255));
chartConfig.setLegend(legend);
ScatterConfig scatterCfg = new ScatterConfig();
SymbolMarker marker = new SymbolMarker(5);
scatterCfg.setMarker(marker);
marker.setHoverState(new MarkerState());
marker.getHoverState().setEnabled(true);
marker.getHoverState().setLineColor(new RGB(100, 100, 100));
chartConfig.addSeriesConfig(scatterCfg);
InvientCharts chart = new InvientCharts(chartConfig);
ScatterConfig femaleScatterCfg = new ScatterConfig();
femaleScatterCfg.setColor(new RGBA(223, 83, 83, 0.5f));