SmartGWT 4.0Pro Build 03/18/2014
The zoom chart does not display the line for a Line chart when the values are all the same (flat line). See attached image.
If I uncomment the last datapoint value (10.1f), then the zoom chart will show the line. It seems like it may have issue with auto ranging the Y-value when the values are all the same.
The zoom chart does not display the line for a Line chart when the values are all the same (flat line). See attached image.
If I uncomment the last datapoint value (10.1f), then the zoom chart will show the line. It seems like it may have issue with auto ranging the Y-value when the values are all the same.
Code:
public class SmartGwtTester implements EntryPoint { public void onModuleLoad() { final FacetChart chart = new FacetChart(); chart.setData(ChartData.getData()); chart.setID("chart"); chart.setWidth(750); chart.setHeight(550); chart.setFacets(new Facet("Time")); chart.setValueProperty("value"); chart.setChartType(ChartType.LINE); DrawLine dataLineProperties = new DrawLine(); dataLineProperties.setLineWidth(1); chart.setDataLineProperties(dataLineProperties); chart.setShowDataPoints(true); chart.setTitle("Line Chart with SmartGwt v" + Version.getVersion() + " build: " + Version.getBuildDate()); chart.setCanZoom(true); chart.setLabelCollapseMode(LabelCollapseMode.NUMERIC); chart.setShowLegend(false); VLayout layout = new VLayout(15); layout.setMembers(chart); layout.draw(); } public static class ChartData extends Record { public ChartData(float time, float value) { setAttribute("Time", time); setAttribute("value", value); } public static ChartData[] getData() { return new ChartData[] { new ChartData(10001f, 10.0f), new ChartData(10002f, 10.0f), new ChartData(10003f, 10.0f), new ChartData(10004f, 10.0f), new ChartData(10005f, 10.0f), new ChartData(10006f, 10.0f), new ChartData(10007f, 10.0f), new ChartData(10008f, 10.0f), new ChartData(10009f, 10.0f), new ChartData(10010f, 10.0f), new ChartData(10011f, 10.0f), new ChartData(10012f, 10.0f), new ChartData(10013f, 10.0f), new ChartData(10014f, 10.0f), new ChartData(10015f, 10.0f), new ChartData(10016f, 10.0f), new ChartData(10017f, 10.0f), new ChartData(10018f, 10.0f), new ChartData(10019f, 10.0f), new ChartData(10020f, 10.0f), // new ChartData(10021f, 10.1f), // uncomment so it's no longer a flat line, zoom chart will then show line }; } } }
Comment