VerticalPanel v = new VerticalPanel();
v.setSpacing(20);
RootPanel.get().add(v);
ChartPanel chartPanel = Chronoscope.createTimeseriesChartWithDatasetVarName(
"interestRates01", "interestRates02");
chartPanel.getElement().getStyle().setCursor(Cursor.POINTER);
chartPanel.setViewReadyCallback(new ViewReadyCallback() {
public void onViewReady(final View view) {
Dataset<?> dataset = view.getChart().getPlot().getDatasets().get(0);
final Marker m = new Marker(dataset.getDomainExtrema().midpoint(),
"A", 0);
m.addOverlayClickListener(new OverlayClickListener() {
public void onOverlayClick(Overlay overlay, int x, int y) {
m.openInfoWindow("Hello");
}
});
XYPlot<?> plot = view.getChart().getPlot();
plot.setOverviewVisible(true);
plot.setDatasetRenderer(1, new LineXYRenderer());
plot.addOverlay(m);
((DefaultXYPlot<?>)plot).redraw(true);
}
});
v.add(chartPanel);
final ChartPanel chartPanel2 = Chronoscope.createTimeseriesChartWithDatasetVarName(
"interestRates01", "interestRates02");
int chartWidth = 600;
int chartHeight = (int) (chartWidth / GOLDEN__RATIO);
chartPanel2.setDimensions(chartWidth, chartHeight);
chartPanel2.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
chartPanel2.getElement().getStyle().setPadding(5, Unit.PX);
v.add(chartPanel2);
} catch (Exception e) {
e.printStackTrace();
}