Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1232

Summary: Histogram series with a single values makes wrong axis range.
Product: .NET TeeChart Reporter: narcís calvet <narcis>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED NOTABUG    
Severity: major CC: chris, nagai
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/directline/viewtopic.php?f=6&t=1007
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description narcís calvet 2015-06-10 05:26:15 EDT
In the code snippet below, adding one single value to the second Histogram series completely breaks bottom axis scale.

      Steema.TeeChart.Styles.Histogram histogram1 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);
      Steema.TeeChart.Styles.Histogram histogram2 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);

      for (int i = 0; i < 24; i++)
      {
        histogram1.Add(i);
      }

      double tmp = histogram1.MaxYValue() + 1;

      histogram1.Add(tmp);      
      histogram2.Add(tmp);
Comment 1 narcís calvet 2015-06-10 05:46:16 EDT
Something similar occurs when adding a 2nd point to the 2nd series:

      Steema.TeeChart.Styles.Histogram histogram1 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);
      Steema.TeeChart.Styles.Histogram histogram2 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);

      for (int i = 0; i < 24; i++)
      {
        histogram1.Add(i);
      }

      double tmp = histogram1.MaxYValue() + 1;

      histogram1.Add(tmp);      
      histogram2.Add(tmp);
      histogram2.Add(tmp);
Comment 2 narcís calvet 2015-06-10 05:52:01 EDT
A workaround to the problem is adding a negative MinimumOffset value to the bottom axis:

tChart1.Axes.Bottom.MinimumOffset = -1;
Comment 3 christopher ireland 2015-06-10 06:14:46 EDT
Similar problem in VCL:
http://bugs.teechart.net/show_bug.cgi?id=1233
Comment 4 christopher ireland 2015-07-29 09:32:59 EDT
This issue can be fixed by the addition of null points, e.g.

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      Steema.TeeChart.Styles.Histogram histogram1 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);
      Steema.TeeChart.Styles.Histogram histogram2 = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);

      for (int i = 0; i < 24; i++)
      {
        histogram1.Add(i);
        histogram2.Add();
      }

      double tmp = histogram1.MaxYValue() + 1;

      histogram1.Add(tmp);
      histogram2.Add(tmp);
    }