## Wind vector plot with TArrowSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Newbie
Posts: 5
Joined: Fri Oct 25, 2019 12:00 am

### Wind vector plot with TArrowSeries

Hi,
is it possible to create a wind vector plot similiar to the attached picture?
Each arrow in the picture represents the wind speed and wind direction at a given time and height.
I tried a little bit using the TArrowSeries, but I did not get a satisfactory solution.

Has anyone good ideas for that problem?

Reagrds
Attachments
windvector.png (94.64 KiB) Viewed 182 times

Marc
Posts: 933
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

### Re: Wind vector plot with TArrowSeries

This code simplifies a how-to. Add 3 ArrowSeries to a Chart and run the code in a button. My example calculations aren't up to much, just to give an idea.

Y location ArrowStart gives height above sea-level, X ArrowStart location is the timestamp and the end of each arrow would be calculated as your take on wind-strength and direction.

Code: Select all

``````procedure TForm1.Button1Click(Sender: TObject);
Var i, a : Integer;
aaX, aaY, f1,f2,f3, aDate : Double;
point : TPoint;

procedure getDirection(var aX, aY : double; aDate, force, direction : double);
var opp, adj : double;
Begin
//trig val calculate using force and direction
//direction here just as angle.
//this is where the work is to calculate, Arrow Series fits to start and end x,y locations

opp := force * Sin(DegToRad(direction));

aY := opp;
end;

begin
For i:=0 to Chart1.SeriesCount-1 do
Chart1.SeriesList[i].Clear;

Chart1.LeftAxis.SetMinMax(0,5);

aDate := 44173;      //simplifying a timestamp as double

For a := 0 to 50 do
Begin

f1 := Random(10) / 7 ;

f2 := Random(10) / 7;

f3 := Random(10) / 7;
end;
end;``````
WindChart.png (43.44 KiB) Viewed 180 times
I hope that helps.
Regards,
Marc Meumann
Steema Support

Newbie
Posts: 5
Joined: Fri Oct 25, 2019 12:00 am

### Re: Wind vector plot with TArrowSeries

Hello Mark,

this seems to be an interesting approach, I will continue to work with it.
To calculate the correct length of the arrows I think I have to convert it to pixel size (depending on the screen resolution).

Thanks for the tip.

Best regards