scatterCfg.setLineWidth(1);
chartConfig.addSeriesConfig(scatterCfg);
// chart data
InvientCharts chart = new InvientCharts(chartConfig);
XYSeries seriesData = new XYSeries("User Supplied Data");
seriesData.addPoint(new DecimalPoint(seriesData, 20, 20));
seriesData.addPoint(new DecimalPoint(seriesData, 80, 80));
chart.addSeries(seriesData);
chart.addListener(new ChartClickListener() {
@Override
public void chartClick(ChartClickEvent chartClickEvent) {
logEventInfo("chartClick",
((DecimalPoint) chartClickEvent.getPoint()).getX(),
((DecimalPoint) chartClickEvent.getPoint()).getY(),
chartClickEvent.getMousePosition().getMouseX(),
chartClickEvent.getMousePosition().getMouseY());
XYSeries xySeries = (XYSeries) chartClickEvent.getChart()
.getSeries("User Supplied Data");
xySeries.addPoint(new DecimalPoint(xySeries,
((DecimalPoint) chartClickEvent.getPoint()).getX(),
((DecimalPoint) chartClickEvent.getPoint()).getY()));
}
});
chart.addListener(new PointClickListener() {
@Override
public void pointClick(PointClickEvent pointClickEvent) {
logEventInfo("pointClick", pointClickEvent.getPoint()
.getSeries().getName(), pointClickEvent.getCategory(),
(Double) pointClickEvent.getPoint().getX(),
(Double) pointClickEvent.getPoint().getY(),
pointClickEvent.getMousePosition().getMouseX(),
pointClickEvent.getMousePosition().getMouseY());
XYSeries xySeries = (XYSeries) pointClickEvent.getChart()
.getSeries("User Supplied Data");
if (xySeries.getPoints().size() > 1) {
// remove the clicked point
xySeries.removePoint((DecimalPoint) pointClickEvent
.getPoint());
}
}
});