When the DateTime label is changed on an axis it isn't updated on the chart.
public void onModuleLoad() { RootPanel.get().add(createChart()); } public Canvas createChart() { final Chart chart = new Chart().setType(Series.Type.LINE).setChartTitleText("Facility productivity").setBackgroundColor("#FFFFFF").setShadow(true).setZoomType(ZoomType.X).setCredits(new Credits().setEnabled(false)); chart.getXAxis(); chart.getYAxis(); chart.getXAxis().setType(Type.DATE_TIME); chart.setSizeToMatchContainer(); chart.setReflow(true); final Canvas cw = new Canvas(); cw.addChild(chart); cw.setSize("500px", "500px"); chart.setSize("500px", "500px"); IButton button = new IButton("click"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { DateTimeLabelFormats dateTimeLabelFormat = new DateTimeLabelFormats(); setFormat(dateTimeLabelFormat, "%l%p %b %d"); chart.getXAxis().setDateTimeLabelFormats(dateTimeLabelFormat); LinePlotOptions options = new LinePlotOptions(); options.setPointInterval(3600 * 1000); chart.removeAllSeries(); chart.addSeries(chart.createSeries().setName("Hestavollane").setPoints(new Number[] { 4.3, 5.1, 4.3, 5.2, 5.4, 4.7, 3.5, 4.1, 5.6, 7.4, 6.9, 7.1, 7.9, 7.9, 7.5, 6.7, 7.7, 7.7, 7.4, 7.0, 7.1, 5.8, 5.9, 7.4 }).setPlotOptions(options)); } }); RootPanel.get().add(button); return cw; } /** *Forces format onto the axis. */ private void setFormat(DateTimeLabelFormats labelFormat, String format) { labelFormat.setHour(format); labelFormat.setMinute(format); labelFormat.setDay(format); labelFormat.setWeek(format); labelFormat.setMonth(format); labelFormat.setYear(format); }
When you click the button , the date time label is supposed to change to 3AM , 4AM etc. But it doesn't.Any suggestions ?
Log in to post a comment.
When the DateTime label is changed on an axis it isn't updated on the chart.
When you click the button , the date time label is supposed to change to 3AM , 4AM etc. But it doesn't.Any suggestions ?