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 - PolarChart: Inconsistent data display on ClockWiseLabels
Summary: PolarChart: Inconsistent data display on ClockWiseLabels
Status: RESOLVED FIXED
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: TeeChart.NET 2014 4.1.2014.02060
Hardware: PC Windows
: Normal minor
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-04 06:42 EST by narcís calvet
Modified: 2014-12-10 11:08 EST (History)
2 users (show)

See Also:
Chart Series: Polar
Delphi / C++ Builder RAD IDE Version:


Attachments
Example showing the two cases described above. (42.71 KB, application/x-zip-compressed)
2014-12-04 06:42 EST, narcís calvet
Details

Note You need to log in before you can comment on or make changes to this bug.
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".