Komponenty Delphi pomoc
Start › Komponenty Delphi › TWeatherChart

TWeatherChart

Wykresy pogodowe (temperatura, wilgotność, wiatr…). Serie z legendą w oknie prognozy.

VCLFMXniewidoczny
▶ Zobacz na żywo – demo HTML

Opis

Upuść wiele TWeatherChart na formę. Serie (Title, Parameter, Color, punkty filled/hollow). Wymaga TWeather — sam Chart nie otwiera okna. Po kliku obszaru (Charts.ShowOnAreaClick) wykresy wypełniają panele okna prognozy (przesuwane w poziomie).

Moduł: MapCommon.Weather.Views · Klasa bazowa: TWeatherLinkedView · Platformy: VCL + FMX

TWeatherChart – podgląd poglądowy
Wykres godzinowy w oknie prognozy — TWeather + TWeatherChart; klik obszaru. Podgląd poglądowy (nie zrzut z Delphi) – prawdziwa strona mapy komponentu w ramce imitującej formę.

Demo na żywo

Interaktywne demo HTML.

TWeather + Chart (+ HourStrip/DayItems) wypełniają okno prognozy.

▶ Klik obszaru → modal z wykresami

Nakładka + ten sam modal.

▶ TWeather + Charts.ShowOnAreaClick

Funkcje

Nie mylić z TWeather.Charts (opcjonalny sub-obiekt, domyślnie wyłączony).
Wiele TWeatherChart na formie — każdy RegisterLinkedView.

Właściwości

WłaściwośćOpis
SeriesKolekcja serii (Title, Parameter, styl linii/punktów).
Parameter, ChartKind, Color, Fill*Skrót do Series[0].
ShowPoints, PointRadius, PointColor, PointOpacity, PointStyleMarkery: filled/hollow.
ShowLegend, ShowXTicks, ShowYTicksLegenda i ticki osi.
XAxisCaption, YAxisCaption, XValueFormat, YValueFormatOpisy i format liczb.
DayIndex, ShowGrid, Style, WeatherZakres dnia; siatka; chrome; AutoLink.

Zdarzenia

ZdarzenieOpis
OnViewChanged(ViewJSON)series[] + axis options dla hosta Chart.js / własnego UI.

Metody

MetodaOpis
ApplyJSON / ViewJSON / RefreshHost

Przykłady

Wiele serii + legenda + punkty

// Klik obszaru → okno z Scene + dane + HourStrip / Chart
procedure TForm1.Areas1AreaClick(Sender: TObject; const Lat, Lon: Double;
  const AreaName, Admin: string);
begin
  Weather1.Area.Kind := wakPoints;
  Weather1.Area.Points.Text := Format('%.4f,%.4f', [Lat, Lon], WeatherInvariantFS);
  Weather1.ForecastKind := wfkHourly;
  FPopupAreaName := AreaName;
  Weather1.Request; // middleware — UI family dostaje OnDataReady przez RegisterLinkedView
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Weather1.ApiKey := GetEnvironmentVariable('WEATHER_API_KEY');
  WeatherScene1.Weather := Weather1;     // AutoLink też OK
  WeatherScene1.Labels.Caption := 'Warszawa 25°C';
  WeatherScene1.Host := PanelSky;

  HourStrip1.Weather := Weather1;
  HourStrip1.Style.Caption := 'Godziny';
  HourStrip1.Style.FontSize := 12;
  HourStrip1.UseCustomIcons := False;    // True + CustomIcons = własne PNG

  DayItems1.Weather := Weather1;
  DayItems1.MaxDays := 7;

  // Wiele serii na jednej osi + legenda / ticki / format
  Chart1.Weather := Weather1;
  Chart1.ShowLegend := True;
  Chart1.ShowXTicks := True;
  Chart1.ShowYTicks := True;
  Chart1.XAxisCaption := 'Czas';
  Chart1.YAxisCaption := '°C / %';
  Chart1.YValueFormat := '0.0';
  Chart1.Series.Clear;
  with Chart1.Series.Add do begin
    Title := 'Temperatura'; Parameter := wpTemperature2m;
    Color := '#ff9800'; ChartKind := wckLine;
    ShowPoints := True; PointStyle := wpsFilled; PointOpacity := 0.9;
  end;
  with Chart1.Series.Add do begin
    Title := 'Wilgotność'; Parameter := wpRelativeHumidity2m;
    Color := '#4fc3f7'; ChartKind := wckLine;
    ShowPoints := True; PointStyle := wpsHollow; PointColor := '#0288d1';
  end;
end;

Pełna lista API

Generowana z deklaracji w kodzie (Source/*.pas): wszystkie opublikowane właściwości i zdarzenia TWeatherChart (także dziedziczone), właściwości publiczne i metody publiczne.

Właściwości opublikowane (28)

WłaściwośćTypDomyślnieOpis
WeatherTWeather
HostTComponent
AutoLinkComponentsBooleanTrueAutomatycznie łącz pierwszy dostawcę wyszukiwania / TMapAreas / TEditMap z formy
ActiveBooleanTrue
UseCustomIconsBooleanFalse
CustomIconsTStrings
StyleTWeatherViewStyleStyl mapy (enum): kafle OSM / satelita / teren / własne (TTileMap*) lub styl wektorowy (T3DMap*)
SeriesTWeatherChartSeriesCollection
ParameterTWeatherParamwpTemperature2m
ChartKindTWeatherChartKindwckLine
ColorstringStandardowa właściwość kontrolki VCL
FillUnderLineBooleanTrue
FillColorstring
LineWidthDouble
ShowPointsBooleanFalse
PointRadiusDouble
PointColorstring
PointOpacityDouble
PointStyleTWeatherPointStylewpsFilled
DayIndexInteger-1
ShowGridBooleanTrue
ShowLegendBooleanTrue
ShowXTicksBooleanTrue
ShowYTicksBooleanTrue
XAxisCaptionstring
YAxisCaptionstring
XValueFormatstring
YValueFormatstring

Zdarzenia (1)

ZdarzenieTypOpis
OnViewChangedTWeatherViewEvent

Właściwości publiczne – tylko w kodzie (1)

WłaściwośćTypOpis
LastViewJSONstring

Metody publiczne (7)

MetodaOpis
procedure ApplyJSON(const JSON: string)
procedure ApplyFromWeather
procedure ClearUsuwa własne pliki
procedure RefreshHost
function ViewJSON: string
procedure DetectLinkedComponentsWyszukuje na formie i łączy dostawcę / TMapAreas / TEditMap
procedure SeriesNotify

Pełny opis wszystkich właściwości: dokumentacja komponentów map.

Zobacz też