Draw icons insted of points in a Series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Draw icons insted of points in a Series

Post by Lenfors » Tue Oct 30, 2007 7:11 pm

I need a TSeries where I can define a bitmap or icon for each point, custom drawing would be acceptable. Wich series would be the best to use and how do I insert my bitmaps?

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Tue Oct 30, 2007 10:26 pm

E.g. TImagePointSeries
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Post by Lenfors » Wed Oct 31, 2007 10:25 am

Thanks, was it that easy... Just two small issues left. I have my pictures in a TImageList and in the GetImage event I want to pick a picture from it.

Procedure TMainForm.SeriesGetImage(Sender: TCustomImagePointSeries; ValueIndex: Integer; Picture: TPicture);
Begin
Picture := ImageList.GetPicture(0) ???
End;

The other question is how I controll the with and height of the picture in the different points?

Please help.

Regards, Mikael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 31, 2007 12:31 pm

Hi Mikael,
Thanks, was it that easy... Just two small issues left. I have my pictures in a TImageList and in the GetImage event I want to pick a picture from it.
You can do something like this:

Code: Select all

procedure TForm1.Series1GetImage(Sender: TCustomImagePointSeries;
  ValueIndex: Integer; Picture: TPicture);
var tmpBmp : TBitmap;
begin
  tmpBmp:=TBitmap.Create;
  ImageList1.GetBitmap(ValueIndex, tmpBmp);
  Picture.Bitmap:=tmpBmp;

  Series1.Pointer.VertSize:=(ValueIndex+1)*10;
  Series1.Pointer.HorizSize:=(ValueIndex+1)*10;
end;
The other question is how I controll the with and height of the picture in the different points?
You can use Pointer's VertSize and HorizSize as shown in the code above.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Post by Lenfors » Wed Oct 31, 2007 2:54 pm

Perfect! Works like a dream.

But I just got another issue. I use both the TDragMarksTool and the TDragPointTool. It seems like I can never reach the mark, it always finds the point to be dragged, even as the pojnt and the mark are located at some distance.
I tried the SeriesMouseEnter event to se when the "point" was hit and it seems like it "hits" when the mouse is "far" away from the bitmap image! More than 50 pixels away!
How can I limit this "active" area to just the bitmap?

regards, Mikael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 31, 2007 2:58 pm

Hi Mikael,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Post by Lenfors » Wed Oct 31, 2007 5:37 pm

Hello! Uploaded via the uploade page under name Mikael Lenfors.

Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Post by Lenfors » Wed Oct 31, 2007 6:22 pm

Hello, I sent an updated version where you can se the problem better. After program start there is no way to drag the marks away from the point. If you click the button the marks are moved a bit away. After this the marks can be dragged. If you than drag the mark and position it over the point it will be unaccessable again. You can also enable the popup in MapSeriesMouseEnter and the you can se that the event is triggered without the mouse beeing on the image area.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Nov 07, 2007 12:33 pm

Hi Mikael,

I think that the best way to accomplish it would be by adding the following code to your app (checking when the marks are clicked) :

Code: Select all

procedure TForm1.MapChartMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    MapChartDragPointTool.Active := not (MapSeries.Marks.Clicked(x,y)<>-1);
end;

procedure TForm1.MapChartDragPointToolDragPoint(Sender: TDragPointTool;
  Index: Integer);
begin
  MapSeries.Marks.ResetPositions;
end;

Lenfors
Newbie
Newbie
Posts: 49
Joined: Thu Sep 20, 2007 12:00 am

Post by Lenfors » Fri Dec 28, 2007 8:03 pm

Ok, this was a while ago but now I'm back!
The solution you suggested will work for drag but I also have events for MouseEnter and MouseLeave! I show values in a status window when I move the mouse above the icons! Currently these events trigger already when the mouse is located some distance from the icon (like 50 pixels away)!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 02, 2008 9:15 am

Hi Lenfors,

I'm not able to reproduce the problem here. Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply