TImagePointSeries - can't set the background color or frame

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dmo9999
Newbie
Newbie
Posts: 8
Joined: Mon May 05, 2008 12:00 am

TImagePointSeries - can't set the background color or frame

Post by dmo9999 » Mon Apr 30, 2012 3:28 pm

Want to use TImagePointSeries to represent status of networked devices (Ok, problems, down) (see attachment)
LaptopStopLight.png
Illustration of what I would like to achieve
LaptopStopLight.png (26.42 KiB) Viewed 2835 times
HELP on the subject implies I can set the background color.
Background color would be that space in the X by Y pixel space not covered by the image.
Having the ability to display a frame around that X by Y pixel space (control the width, color, blah, blah) would also be great.
I can't achieve it.

Can someone point me in the right direction?

thxs,
dmo

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

Re: TImagePointSeries - can't set the background color or frame

Post by Yeray » Wed May 02, 2012 1:36 pm

Hi dmo,

If I understand you correctly, you would like to have a unique image, with just the computer without any back color, to always load the same image in the hole series and then, you would like to draw a green/yellow/red background to the image. If this is what you meant, it could probably be possible but you would probably have to draw manually the background color at OnBeforeDrawSeries event for example.
However, I think it would be easier to have three images, one for each background color. Here you have an example:

Code: Select all

uses TeePNGImage;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TImagePointSeries) as TImagePointSeries do
  begin
    FillSampleValues(9);

    Pointer.HorizSize:=23;
    Pointer.vertSize:=23;
    OnGetImage:=Series1GetImage;
  end;
end;

procedure TForm1.Series1GetImage(Sender: TCustomImagePointSeries;
  ValueIndex: Integer; Picture: TPicture);
begin
  if ValueIndex > -1 then
  case (Round(Sender.XValue[ValueIndex]) mod 3) of
    0: Picture.LoadFromFile('C:\tmp\green.png');
    1: Picture.LoadFromFile('C:\tmp\yellow.png');
    2: Picture.LoadFromFile('C:\tmp\red.png');
  end;
end;
chart1.png
chart1.png (17.03 KiB) Viewed 2813 times
And the images I used to get the above:
green.png
green.png (1.19 KiB) Viewed 2783 times
yellow.png
yellow.png (1.19 KiB) Viewed 2785 times
red.png
red.png (1.16 KiB) Viewed 2785 times
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