Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Bug in Zoom Chart, does not handle flat line

    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.

    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
    			};  
    		}  
    	}
    }
    Attached Files

    #2
    Thanks for the notification. We've made a change to address this issue. Please pick up the next nightly build (Dated April 15 or above) to get the fix

    Regards
    Isomorphic Software

    Comment


      #3
      Hi,

      I picked up the 4/20 build. The zoom chart does not show the flat line when setLogScale(false). Unfortunately we have setLogScale(false) for our zoom charts, and this fix is not working for us. Updated test driver below with setLogScale(false)

      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);
      		chart.setDataColors("#0000FF");
      		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);
      		
      		
      		FacetChart zoomChart = new FacetChart();
      		zoomChart.setLogScale(false);	// this line breaks the fix
      		
              chart.setZoomChartProperties(zoomChart);
              chart.setZoomSelectionChartProperties(zoomChart);
      		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


        #4
        Thanks for the clear testcase. This issue is now fixed for tomorrow's builds for all affected branches.

        Comment

        Working...
        X