Upload files to "/"
This commit is contained in:
83
graficimeteo.pas
Normal file
83
graficimeteo.pas
Normal file
@@ -0,0 +1,83 @@
|
||||
unit graficimeteo;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, TAGraph,
|
||||
TASeries, fpjson, jsonparser;
|
||||
|
||||
type
|
||||
|
||||
{ TForm3 }
|
||||
|
||||
TForm3 = class(TForm)
|
||||
Chart1: TChart;
|
||||
Chart2: TChart;
|
||||
CoperturaSeries: TLineSeries;
|
||||
Chart3: TChart;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Vento10m: TLineSeries;
|
||||
Vento180m: TLineSeries;
|
||||
VisibilitaSeries: TLineSeries;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
|
||||
|
||||
var
|
||||
meteotext:string;
|
||||
meteoposgiorno:integer;
|
||||
end;
|
||||
|
||||
var
|
||||
Form3: TForm3;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm3 }
|
||||
|
||||
procedure TForm3.FormShow(Sender: TObject);
|
||||
var
|
||||
MeteoJSON: TJSONData;
|
||||
OggettoJSON: TJSONObject;
|
||||
i: integer;
|
||||
oracercata:string;
|
||||
begin
|
||||
MeteoJSON:=fpJSON.GetJSON(meteotext);
|
||||
|
||||
OggettoJSON := MeteoJSON as TJSONObject; //questo è stato fatto per rendere i dati meglio estraibili
|
||||
|
||||
VisibilitaSeries.Clear;
|
||||
CoperturaSeries.Clear;
|
||||
Vento10m.Clear;
|
||||
Vento180m.Clear;
|
||||
|
||||
|
||||
for i:=0 to 23 do
|
||||
begin
|
||||
if meteoposgiorno>=6 then oracercata:=inttostr (i+meteoposgiorno*24)
|
||||
else oracercata:=inttostr (i+1+meteoposgiorno*24);
|
||||
VisibilitaSeries.AddXY(i, round(OggettoJSON.FindPath('hourly.visibility['+oracercata+']').AsFloat/1000));
|
||||
CoperturaSeries.AddXY(i, round(OggettoJSON.FindPath('hourly.cloud_cover['+oracercata+']').AsFloat));
|
||||
Vento10m.AddXY(i, round(OggettoJSON.FindPath('hourly.wind_speed_10m['+oracercata+']').AsFloat));
|
||||
Vento180m.AddXY(i, round(OggettoJSON.FindPath('hourly.wind_speed_180m['+oracercata+']').AsFloat));
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm3.FormCreate(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user