Page 1 of 1

MapSeries issues

Posted: Fri Sep 06, 2013 12:06 pm
by 16566655
Hello,

I am trying to draw polygons in a TChart and encountered some issues with the MapSeries.

First, I do not quite understand how to draw polygons at all. The functions seem to have changed recently, because browsing the forums did not yield any results for me. The included HTML help file was not useful to me either.
I would appreciate it if you could show me a sample source code where you create a map series and draw some simple shape, a triangle perhaps.

The second issue i found is, that when creating a map series with the editor, trying to access the Shapes Tab in the parent tab "Format" causes access violations - as many as there are polygons, I think.

I am using TeeChart Pro v2013.08.130521 32bit VCL in Delphi XE4.
I hope you can help me on that matter.

If no quick solution for the issue can be found, it would be nice if you could show me an alternative to polygon drawing.

Best regards

Re: MapSeries issues

Posted: Fri Sep 06, 2013 2:14 pm
by yeray
Hi,
BHinnoForce wrote:First, I do not quite understand how to draw polygons at all. The functions seem to have changed recently, because browsing the forums did not yield any results for me. The included HTML help file was not useful to me either.
I would appreciate it if you could show me a sample source code where you create a map series and draw some simple shape, a triangle perhaps.
Here it is a simple example of how to create the TChart, the TMapSeries, and how to add a triangle (shape) to it:

Code: Select all

uses Chart, TeeMapSeries;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;

  Chart1.View3D:=false;

  with Chart1.AddSeries(TMapSeries) as TMapSeries do
  begin
    with Shapes.Add do
    begin
      AddXY(0,0);
      AddXY(3,3);
      AddXY(2,5);
    end;
  end;
end;
BHinnoForce wrote:The second issue i found is, that when creating a map series with the editor, trying to access the Shapes Tab in the parent tab "Format" causes access violations - as many as there are polygons, I think.
I get a similar error with the same code above and the last TeeChart v2013.08, but not with the actual sources that would be used for the next maintenance release.
I've just added an TChartEditor to the example above:

Code: Select all

  private
    { Private declarations }
    procedure Chart1DblClick(Sender: TObject);
//...
uses {...}, TeeEdit, TeeMapSeriesEdit;
//...
procedure TForm1.FormCreate(Sender: TObject);
begin
{...}
  Chart1.OnDblClick:=Chart1DblClick;
end;

procedure TForm1.Chart1DblClick(Sender: TObject);
begin
  with TChartEditor.Create(Self) do
  begin
    Chart:=Chart1;
    Execute;
  end;
end;

Re: MapSeries issues

Posted: Thu Sep 12, 2013 12:23 pm
by 16566655
Thank you very much for the quick reply.

Instead of adding more points to one polygon, I created several polygons consisting of only one point - at least I think that is what happens.

Code: Select all

for I := 0 to Length(CoordContainer.X) - 1 do
      with Shapes.Add do
      begin
          AddXY(CoordContainer.X[I], CoordContainer.Y[I]);
      end;
instead of

Code: Select all

with Shapes.Add do
      begin
      for I := 0 to Length(CoordContainer.X) - 1 do
          AddXY(CoordContainer.X[I], CoordContainer.Y[I]);
      end;
Best regards

Re: MapSeries issues

Posted: Thu Sep 12, 2013 3:25 pm
by yeray
Hi,

Right, it seems to be the difference between those code snippets.
Don't hesitate to let us know if you still find problems with it.