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
jradke
Wind vector plot with TArrowSeries
Wind vector plot with TArrowSeries
- Attachments
-
- windvector.png (94.64 KiB) Viewed 10914 times
Kind regards
JRadke
JRadke
Re: Wind vector plot with TArrowSeries
Hello jradke,
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.
I hope that helps.
Regards,
Marc Meumann
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));
adj := force * Cos(DegToRad(direction));
aX := aDate + adj;
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
aDate := aDate + 1;
f1 := Random(10) / 7 ;
getDirection(aaX,aaY,aDate,f1,120 - random(90));
Series1.AddArrow(aDate,1,aaX,1+aaY);
f2 := Random(10) / 7;
getDirection(aaX,aaY,aDate,f2,90 - random(90));
Series2.AddArrow(aDate,2,aaX,2+aaY);
f3 := Random(10) / 7;
getDirection(aaX,aaY,aDate,f3,70 - random(90));
Series3.AddArrow(aDate,3,aaX,3+aaY);
end;
end;
Regards,
Marc Meumann
Steema Support
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
jradke
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
jradke
Kind regards
JRadke
JRadke