Polar series's ClockWiseLabels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Christo Zietsman
Newbie
Newbie
Posts: 34
Joined: Thu Sep 04, 2008 12:00 am

Polar series's ClockWiseLabels

Post by Christo Zietsman » Thu Mar 05, 2009 7:24 am

Hi

Why does the order of setting ClockWiseLabels and adding the series data affect the output?

Shouldn't case 4 & 5 give the same plot?

(case 4)
BEFORE adding data:
series.ClockWiseLabels = true;

(case 5)
AFTER adding data:
series.ClockWiseLabels = true;


<Window x:Class="WPFDemo.Window5"
xmlns="http://schemas.microsoft.com/winfx/2006 ... esentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WPF="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF"
Title="Window5" Height="600" Width="800">
<TabControl>
<TabItem Header="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" x:Name="m_Label4"/>
<WPF:TChart Grid.Row="1" x:Name="m_Chart4"/>
</Grid>
</TabItem>
<TabItem Header="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" x:Name="m_Label5"/>
<WPF:TChart Grid.Row="1" x:Name="m_Chart5"/>
</Grid>
</TabItem>
</Window>

public partial class Window5
{
public Window5()
{
InitializeComponent();
initChart4(m_Chart4, m_Label4);
initChart5(m_Chart5, m_Label5);
}

public void setupChart(TChart chart)
{
chart.SnapsToDevicePixels = true;
chart.Aspect.View3D = false;
chart.Axes.Left.Automatic = false;
chart.Axes.Left.AutomaticMinimum = false;
chart.Axes.Left.AutomaticMaximum = false;
chart.Axes.Left.Minimum = 0;
chart.Axes.Left.Maximum = 1;
}

public void setupPolar(Polar series)
{
series.CircleLabels = true;
series.Circled = true;
series.AngleIncrement = 30; // 30 degrees increments
}

public void initChart4(TChart chart, Label label)
{
setupChart(chart);
label.Content = "BEFORE adding data:\nseries.ClockWiseLabels = true;";

Polar series = new Polar();
setupPolar(series);

series.RotationAngle = 90;
series.ClockWiseLabels = true;

series.Add(0, 1.0 / Math.Sqrt(2));
series.Add(45, 1);

chart.Series.Add(series);
}

public void initChart5(TChart chart, Label label)
{
setupChart(chart);
label.Content = "AFTER adding data:\nseries.ClockWiseLabels = true;";

Polar series = new Polar();
setupPolar(series);
series.RotationAngle = 90;

series.Add(0, 1.0 / Math.Sqrt(2));
series.Add(45, 1);

series.ClockWiseLabels = true;

chart.Series.Add(series);
}
}

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

Post by Narcís » Thu Mar 05, 2009 11:32 am

Hi Christo,

No, the correct one is setting ClockWiseLabels after adding data because setting ClockWiseLabels to true modifies data accordingly:

Code: Select all

    public bool ClockWiseLabels
    {
      get { return clockWiseLabels; }
      set 
      {
        SetBooleanProperty(ref clockWiseLabels, value);
        ModifyData();
      }
    }

    private void ModifyData()
    {
      for (int i = 0; i < XValues.Count; i++)
      {
        XValues[i] = 360 - XValues[i];
      }
    }
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

Christo Zietsman
Newbie
Newbie
Posts: 34
Joined: Thu Sep 04, 2008 12:00 am

Post by Christo Zietsman » Thu Mar 05, 2009 1:48 pm

If I've got code which does:

polar.ClockWiseLabels = true;
polar.ClockWiseLabels = true;
polar.ClockWiseLabels = true;
polar.ClockWiseLabels = true;
...

The data get transformed everytime! We are therefore never guaranteed that the state of the ClockWiseLabels is in anyway consistent with the data. The order sensitivity of calls will be a major issue for us in the future if we want to optimise for performance.

Could you add to your wish list that this could gets reworked/cleaned up/fixed?

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

Post by Narcís » Thu Mar 05, 2009 2:03 pm

Hi Christo,

Yes, I agree this may need to be redesigned. I've added your request to the wish-list.
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