procedure TMainForm.FormCreate(Sender: TObject);
var s : TStringList;
begin
// NOTE:
// Most of the following code its not necessary at all.
// Same features can also be done at design-time using the
// TeeChart editor dialog or Object Inspector.
// Do not show Legend, Axes and Walls:
Chart1.Legend.Hide;
Chart1.Axes.Hide;
Chart1.Walls.Hide;
// Cosmetics:
Chart1.Color:=clWhite;
Chart1.View3D:=False;
Chart1.Title.Caption:='USA';
// Match USA map aspect when zooming:
Chart1.Zoom.KeepAspectRatio:=True;
// Create USA map:
USA:=TWorldSeries.Create(Self);
USA.Map:=wmUSA;
USA.Color:=clWhite;
USA.ParentChart:=Chart1;
USA.FillSampleValues;
// Add tools:
Chart1.Tools.Add(TMarksTipTool);
// Import Route 66 KML
Route66:=TLineSeries.Create(Self);
TTeeKMLSource.Load(Route66,'Data\Route66.kml');
Chart1.AddSeries(Route66);
// Cosmetics:
Route66.Pointer.Visible:=True;
Route66.Pointer.Size:=3;
Route66.Pointer.Style:=psCircle;
Route66.Pointer.Pen.Color:=TTeeCanvas.ColorFrom(TAlphaColors.Red,128);
Route66.Pointer.Color:=TAlphaColors.MoneyGreen;
// Nuclear Plants
NuclearPlants:=TPointSeries.Create(Self);
NuclearPlants.Pointer.Size:=2;
TTeeKMLSource.Load(NuclearPlants,'Data\WorldPowerPlants.kml');
Chart1.AddSeries(NuclearPlants);
HidePointsOutsideUSA(NuclearPlants);
// USA Cities
Cities:=TPointSeries.Create(Self);
// Load txt file and add to Cities series:
s:=TStringList.Create;
try
s.LoadFromFile('Data\USACities.txt');
USA.AddPlacemarks(s,Cities);
finally
s.Free;
end;
Cities.Pointer.Size:=2;
Cities.Pointer.Pen.Hide;
Cities.ParentChart:=Chart1; // <-- same as: Chart1.AddSeries(Cities)
// Hide cities in Alaska, etc:
HidePointsOutsideUSA(Cities);
// Populated areas ESRI ShapeFile:
Populated:=TMapSeries.Create(Self);
Populated.ParentChart:=Chart1;
LoadMap(Populated,'Data\ne_50m_urban_areas.shp');
// Change automatic colors of Population area polygons:
Populated.PaletteStyle:=psRainbow;
Populated.UseColorRange:=False;
Populated.UsePalette:=True;
HidePointsOutsideUSA(Populated);
end;
Head over and check out the full blog post about loading GIS map data in TeeChart and then download the Firemonkey demo.