Introduction:
In many meteorological applications there is a need to display wind direction time series that sometimes looks rather strange (see e.g.
http://webpages.charter.net/hoodriverwe ... inddir.gif
and 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
(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
(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:
(full view).
Question:
I have TeeChart Standard v8 without source code. Which TLineSeries method can I override to introduce desired behavior of line drawing?
Wind Direction time series
A solution
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:
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).
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).