Page 1 of 1
TImagePointSeries - can't set the background color or frame
Posted: Mon Apr 30, 2012 3:28 pm
by 10048970
Want to use TImagePointSeries to represent status of networked devices (Ok, problems, down) (see attachment)
- Illustration of what I would like to achieve
- LaptopStopLight.png (26.42 KiB) Viewed 2867 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
Re: TImagePointSeries - can't set the background color or frame
Posted: Wed May 02, 2012 1:36 pm
by yeray
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 (17.03 KiB) Viewed 2845 times
And the images I used to get the above:
- green.png (1.19 KiB) Viewed 2815 times
- yellow.png (1.19 KiB) Viewed 2817 times
- red.png (1.16 KiB) Viewed 2817 times