Announcement

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

    Y Axis value range of FacetChart containing only negative numbers.

    SmartClient Version: SNAPSHOT_v9.1d_2014-01-26/Pro Deployment (built 2014-01-26)

    When a facetchart has only negative numbers, the y-axis range does not include zero, but instead shows a range between the highest and lowest of the negative numbers.

    Is there a way to force the chart to include zero so the data is visually comparable. This seems to be default behavior for positive values, but not for negative ones. Is this intended?

    I have attached 2 screenshots that show the problem, one from the showcase and one from my own project.

    As you can see in the screenshot from my own project, the chart does not give a good visual representation of the 2 columns' values compared to each other.
    Attached Files

    #2
    4.1 introduced optional automatic adjusting of the axis range to better fit the data, controlled by minDataSpreadPercent and related properties.

    You shouldn't see different behavior regarding the zero gradation for all-negative vs all-positive datasets. You would be expected to see different behavior if you happened to have positive numbers that were less tightly grouped or closer to zero. Let us know if can isolate a behavior that clearly doesn't match the docs.

    Comment


      #3
      I tried to set minDataSpreadPercent to zero but it didn't change anything.

      I made a test case showing an example mentioned in the docs for setMinDataSpreadPercent:

      If all data values would be spread across less than minDataSpreadPercent of the axis, the start values of axes will be automatically adjusted to make better use of space.

      For example, if a column chart has all data values between 500,000 and 500,100, if the axis starts at 0, differences in column heights will be visually indistinguishable. In this case, since all data values appear in well under 30% of the axis length, the default minDataSpreadPercent setting would cause the axis to start at a value that would make the column heights obviously different (for example, starting the axis as 500,000).

      Setting an explicit axisStartValue disables this behavior, as does setting minDataSpreadPercent to 0.


      The Docs say that setting minDataSpreadPercent to zero should disable the automatic adjustment of the axis start value, but the testcase below creates a chart with a y-axis range of 499,970 - 500,100.

      Code:
      VLayout mainLayout = new VLayout();
      
      Record[] chartData = new Record[2];
      
      Record record1 = new Record();
      record1.setAttribute("data", 500000);
      
      Record record2 = new Record();
      record2.setAttribute("data", 500100);
      
      chartData[0] = record1;
      chartData[1] = record2;
      
      FacetChart myFacetChart = new FacetChart();
      myFacetChart.setFacets(new Facet("data", "Data")); 
      myFacetChart.setValueProperty("data");  
      myFacetChart.setChartType(ChartType.COLUMN);
      myFacetChart.setMinXDataSpreadPercent(0);
      myFacetChart.setData(chartData);
      
      mainLayout.setMembers(myFacetChart);
      mainLayout.draw();

      Comment


        #4
        You've set minXDataSpreadPercent. Omit the X, the setting you are using applies to a Scatter chart only.

        Comment


          #5
          Right, my bad. Changing it made the above example work for the positive values but not for the negative values.

          Code:
          final VLayout mainLayout = new VLayout();
          
          Record[] chartData = new Record[2];
          
          Record record1 = new Record();
          record1.setAttribute("data", -500000);
          
          Record record2 = new Record();
          record2.setAttribute("data", -500100);
          
          chartData[0] = record1;
          chartData[1] = record2;
          
          FacetChart myFacetChart = new FacetChart();
          myFacetChart.setFacets(new Facet("data", "Data")); 
          myFacetChart.setValueProperty("data");  
          myFacetChart.setChartType(ChartType.COLUMN);
          myFacetChart.setMinDataSpreadPercent(0);
          myFacetChart.setData(chartData);
          
          mainLayout.setMembers(myFacetChart);
          mainLayout.draw();

          Comment


            #6
            Thanks for providing a complete test case. This issue is fixed for tomorrow's builds - you can now turn off minDataSpreadPercent to force points to be grouped too closely together, even if all values are negative.

            Comment


              #7
              Thank you for the quick fix.

              Comment


                #8
                SmartClient Version: v11.0p_2016-11-22/Pro Deployment (built 2016-11-22)
                I don't think this is working anymore.
                My FacetChart looks like this with the above test case:
                Click image for larger version

Name:	FacetChartMinDataSpreadPercentZero.PNG
Views:	76
Size:	10.5 KB
ID:	241631
                As you can see the Y-Axis does not start at zero even though minDataSpreadPercent is set to 0.

                Comment


                  #9
                  This issue affected SGWT 5.0p/SC 10.0p and newer releases - for which a fix has now been applied. It will be in the nightly builds dated 2016-12-03 and beyond.

                  Comment

                  Working...
                  X