Wind Direction time series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Wind Direction time series

Post by xxxxxx » Sun Jul 22, 2007 11:37 am

Introduction:
In many meteorological applications there is a need to display wind direction time series that sometimes looks rather strange (see e.g. Image
http://webpages.charter.net/hoodriverwe ... inddir.gif
and Image http://www.cimms.ou.edu/ARM/wdir.gif).
The problem obviously appears around 0°.
As any angular quantity wind direction has no discontinuity when goes through 0°. However, it’s not the case when wind direction is displayed in XY-coordinates.
To illustrate the problem I plotted in Excel a function y=atan2(1,sin(t)) in LineSeries way
Image
(full view).
A solution could be “wrapping” line around 0°. If I calculate frequent intermediate points and draw them as PointSeries it looks more adequate
Image
(full view).
That is when difference between two adjacent points exceeds 180° it’s actually necessary to draw two lines between them: one line from previous point to 0° (or 360° if the first point is less than 180°) and the next line from 360° (or 0° if the second point is less than 180°) to the second point.
I manually simulated supposed outlook of hypothetic WindDirectionLineSeries:
Image (full view).
Question:
I have TeeChart Standard v8 without source code. Which TLineSeries method can I override to introduce desired behavior of line drawing?

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

A solution

Post by xxxxxx » Sat Aug 25, 2007 9:20 pm

It seems that not so many people are concerned about this issue. Nonetheless, I'm proud to inform that I found a solution with TeeChart:
Image
The idea is that three additional points are added into series each time it crosses 0 or 360 °. The whole trick is that a middle point is Null invisible point and two outermost points have no pointer.
To achieve this I had to introduce overriden method AddXY and a helper class with OnGetPointerStyle event handler (not necessary for TFastLineSeries).

Post Reply