Polar with Clockwise labels displaying data with 180deg offs

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
malequardos
Newbie
Newbie
Posts: 2
Joined: Thu Jan 18, 2018 12:00 am

Polar with Clockwise labels displaying data with 180deg offs

Post by malequardos » Thu Jan 18, 2018 4:46 pm

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°.

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Tue Jan 23, 2018 9:21 am

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?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

malequardos
Newbie
Newbie
Posts: 2
Joined: Thu Jan 18, 2018 12:00 am

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

Post by malequardos » Wed Jan 24, 2018 9:40 am

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.
Attachments
PolarClockwise.7z
(5.85 KiB) Downloaded 644 times

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Thu Jan 25, 2018 11:47 am

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply