MapSeries issues

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
innoForce
Newbie
Newbie
Posts: 5
Joined: Wed Jul 31, 2013 12:00 am

MapSeries issues

Post by innoForce » Fri Sep 06, 2013 12:06 pm

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
Attachments
06-09-2013 14-02-29.png
screenshot with AV
06-09-2013 14-02-29.png (69.99 KiB) Viewed 6468 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: MapSeries issues

Post by Yeray » Fri Sep 06, 2013 2:14 pm

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

innoForce
Newbie
Newbie
Posts: 5
Joined: Wed Jul 31, 2013 12:00 am

Re: MapSeries issues

Post by innoForce » Thu Sep 12, 2013 12:23 pm

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: MapSeries issues

Post by Yeray » Thu Sep 12, 2013 3:25 pm

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply