Page 1 of 1

Polar with Clockwise labels displaying data with 180deg offs

Posted: Thu Jan 18, 2018 4:46 pm
by 16482855
I have a FDQuery dataset with wind speeds and directions so I find Polar the most suitable type to use.

Since in the Polar chart by default 0° is to the right (east) and degrees increase anti-clockwise, to simulate a compass I set Rotation=90° and check Clockwise.

The data appear correctly in the chart while still in Tee chart editor but after exiting, saving, running etc the data (namely the anglevalues) appear incorrectly with an offset of 180°.

Re: Polar with Clockwise labels displaying data with 180deg offs

Posted: Tue Jan 23, 2018 9:21 am
by yeray
Hello,
malequardos wrote:The data appear correctly in the chart while still in Tee chart editor but after exiting, saving, running etc the data (namely the anglevalues) appear incorrectly with an offset of 180°.
Setting ClockWiseLabels property indeed internally modifies the AngleValues array as folows:

Code: Select all

    for t:=0 to AngleValues.Count-1 do
        AngleValues[t]:=360-AngleValues[t];
Note the AngleValues array is used to internally calculate the pixel positions to draw the points in the canvas.

I'm not sure to understand what do you see wrong here. Could you please arrange a simple example project we can run as-is to reproduce the problem here?

Re: Polar with Clockwise labels displaying data with 180deg offs

Posted: Wed Jan 24, 2018 9:40 am
by 16482855
I am talking about TDBChart. Attached a project zipped with 7z. Follow the steps below:

1. Unzip PolarClockwise.7z in a folder. The files include an SQLite database file (PolarClockwise.db) with a single table containing four rows of data used in this project
2. Open Project in IDE. You may notice the data in the data grid
3. Add a TDBChart, add series, Polar, datasource would be the FDTable1 dataset.
4. Ange=> "speed", Radius=>"speed", Anglevalues=> "dir". Press Apply.
5. Set Circled->Rotation to 90 degrees
6. Set Format - Labels, check Clockwise
Steps 5, 6 are meant to simulate a compass (North=0, East=90)
7. Close TeeChart editor. Everything looks OK.
8. Run the program. Notice that data are displayed incorrectly around 270deg instead of around 90deg!!!

Hope for a quick response on that matter.

Re: Polar with Clockwise labels displaying data with 180deg offs

Posted: Thu Jan 25, 2018 11:47 am
by yeray
Hello,

I could reproduce the problem thanks to your project.
The data is modified when you change the ClockWise property. Then, it seems the data is loaded "clockwised" but then the Clockwise property is deserialized and it modifies the data when it shouldn't.
http://bugs.teechart.net/show_bug.cgi?id=1977

Here a workaround:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.ClockWiseLabels:=False;
  Series1.CheckDataSource;
  Series1.ClockWiseLabels:=True;
end;