Page 1 of 1

PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Tue Dec 02, 2014 8:55 am
by 15670310
The label direction on Polar series can be set by the ClockWiseLabels property. I found the following behaviour in TeeChart 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°.

Code: Select all

        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.

Code: Select all

        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);
        }
Is this behaviour expected or is that a bug in TeeChart?

I have attached a sample which demonstrates the behaviour.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Thu Dec 04, 2014 11:43 am
by narcis
Hello arnadan,

Thanks for reporting. This looks like a bug to me. I have added it (ID1031) to bugzilla to be improved for future releases. Please feel free to sign up at Steema Software's Bugzilla to be able to add yourself to the CC List or add your own issues and therefore receive automatic status updates.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Wed Dec 10, 2014 8:54 am
by narcis
Hello arnadan,

After looking into the issue in more depth we found this is by design. For this to work data needs to be added to the series so it can be modified by the ClockWiseLabels property. Otherwise it does nothing. So the way to use it is always adding data before setting ClockWiseLabels to true.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Wed Dec 10, 2014 9:18 am
by 15670310
What most developers of charting components seem to be unaware of: some applications, such as ours, do add data dynamically. We have a measurement application the does measurements on rotating devices. I want to display a polar chart with clockwise labels. Whenever a new value has been measured I want to add that value to the polar chart. How can I do that with your design?

Of course I could switch off clockwise labels, add the one new received data value and then witch on clockwise labels again. But that seems to be a lot of overhead and not very intuitive for application developers.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Wed Dec 10, 2014 11:28 am
by narcis
Hello,

I understand your point. In that case, the easiest solution I can think of for now is creating your own Add method which does the ClockWiseLabels switch for you, for example:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private Steema.TeeChart.Styles.Polar newSeries;

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

      newSeries = new Steema.TeeChart.Styles.Polar();
      newSeries.CircleLabels = true;
      newSeries.Color = Color.DarkGreen;
      newSeries.ClockWiseLabels = true;
      AddPolar(newSeries, 0, 10);
      AddPolar(newSeries, 90, 2);
      AddPolar(newSeries, 180, 4);
      AddPolar(newSeries, 270, 8);
      tChart1.Series.Add(newSeries);
    }

    private void button1_Click(object sender, EventArgs e)
    {
      AddPolar(newSeries, 45, 10);
      AddPolar(newSeries, 135, 2);
      AddPolar(newSeries, 225, 4);
      AddPolar(newSeries, 315, 8);
    }

    private int AddPolar(Steema.TeeChart.Styles.Polar series, double angle, double value)
    {
      int index;
      bool clockWiseLables = series.ClockWiseLabels;

      newSeries.ClockWiseLabels = false;
      index = series.Add(angle, value);
      newSeries.ClockWiseLabels = clockWiseLables;

      return index;
    }
We will investigate if this can be built into the series.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Wed Dec 10, 2014 2:13 pm
by narcis
Hello,

And alternative work around is this:

Code: Select all

    private void InitializeChart()
    {
      Polar newSeries = new Polar();
      newSeries.CircleLabels = true;
      newSeries.Color = Color.Red;
      newSeries.ClockWiseLabels = true;
      newSeries.Add(newSeries.ClockWiseLabels ? 360 - 0 : 0, 10);
      newSeries.Add(newSeries.ClockWiseLabels ? 360 - 90 : 90, 2);
      newSeries.Add(newSeries.ClockWiseLabels ? 360 - 180 : 180, 4);
      newSeries.Add(newSeries.ClockWiseLabels ? 360 - 270 : 270, 8);
      tChart1.Series.Add(newSeries);
    }
Here adding data to the chart merely involves checking the ClockWiseLabels value first.

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Posted: Thu Dec 11, 2014 8:08 am
by narcis
Hello,

Just wanted to let you know that we fixed this issue for the next maintenance release due out before the end of the year.