PolarChart: Inconsistent data display on ClockWiseLabels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
arnadan
Newbie
Newbie
Posts: 5
Joined: Mon Sep 29, 2014 12:00 am

PolarChart: Inconsistent data display on ClockWiseLabels

Post by arnadan » Tue Dec 02, 2014 8:55 am

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.
Attachments
PolarChartTest.zip
(42.71 KiB) Downloaded 553 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by Narcís » Thu Dec 04, 2014 11:43 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by Narcís » Wed Dec 10, 2014 8:54 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

arnadan
Newbie
Newbie
Posts: 5
Joined: Mon Sep 29, 2014 12:00 am

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by arnadan » Wed Dec 10, 2014 9:18 am

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by Narcís » Wed Dec 10, 2014 11:28 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by Narcís » Wed Dec 10, 2014 2:13 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: PolarChart: Inconsistent data display on ClockWiseLabels

Post by Narcís » Thu Dec 11, 2014 8:08 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply