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 1031

Summary: PolarChart: Inconsistent data display on ClockWiseLabels
Product: .NET TeeChart Reporter: narcís calvet <narcis>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: minor CC: chris, daniel.ruetimann
Priority: Normal    
Version: TeeChart.NET 2014 4.1.2014.02060   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/support/viewtopic.php?f=4&t=15312
Chart Series: Polar Delphi / C++ Builder RAD IDE Version:
Attachments: Example showing the two cases described above.

Description narcís calvet 2014-12-04 06:42:08 EST
Created attachment 359 [details]
Example showing the two cases described above.

The label direction on Polar series can be set by the ClockWiseLabels property. I found the following behaviour in TeeChart 4.1.2014.8123:

When I set the direction and then add data, the data is drawn at the wrong polar angles.
When I add data and then set the direction, the data is drawn as expected.

Example:
The following code draws data at the wrong positions. E.g. the value "2" is drawn at 270° instead of 90°.

        private void btnDirectionBeforeData_Click(object sender, EventArgs e)
        {
            Polar newSeries = new Polar();
            newSeries.CircleLabels = true;
            newSeries.Color = Color.Red;
            newSeries.ClockWiseLabels = true;
            newSeries.Add(0, 10);
            newSeries.Add(90, 2);
            newSeries.Add(180, 4);
            newSeries.Add(270, 8);
            tChart1.Series.Add(newSeries);
        }

The following code draws data at the correct positions.

        private void btnDataBeforeDirection_Click(object sender, EventArgs e)
        {
            Polar newSeries = new Polar();
            newSeries.CircleLabels = true;
            newSeries.Color = Color.DarkGreen;
            newSeries.Add(0, 10);
            newSeries.Add(90, 2);
            newSeries.Add(180, 4);
            newSeries.Add(270, 8);
            newSeries.ClockWiseLabels = true;
            tChart1.Series.Add(newSeries);
        }

I have attached a sample which demonstrates the behaviour.
Comment 1 narcís calvet 2014-12-10 03:58:43 EST
Looking at ClockWiseLabels implementation this can be readily understood:

    public bool ClockWiseLabels
    {
      get { return clockWiseLabels; }
      set
      {
        if (clockWiseLabels != value)
        {
          clockWiseLabels = value;
          ModifyData();
          Invalidate();
        }
      }
    }

    private void ModifyData()
    {
      for (int i = 0; i < XValues.Count; i++)
      {
        XValues[i] = 360 - XValues[i];
      }
    }

Which is to say that if there is no data in the series, there are no XValues and so no data will be modified. Data has to be first added to the series before it can be modified to make the labels "clockwise".