Hi folks,
I have a bar chart in which the user can change bar colours programmatically. The colour of the bar changes OK but the corresponding colour in the chart legend remains as it was before the change. In V5 the legend colour changed with the bar colour (I think) but not in V7.
How do I persuade the legend colour to change?
Thanks in advance.
John
Changing serie colour
Hi.
Perhaps the problem is the ColorEachPoint property is set to True and you're only changing individual series points ? In this case internal legend drawing routine uses series Color and not the specific point color.
If this is the case the setting barSeries.SeriesColor (or barSeries.Color) property to specific color will do the trick.
Perhaps the problem is the ColorEachPoint property is set to True and you're only changing individual series points ? In this case internal legend drawing routine uses series Color and not the specific point color.
If this is the case the setting barSeries.SeriesColor (or barSeries.Color) property to specific color will do the trick.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Hi Marjan,
The code I'm using is below.
As you can see, I'm using SeriesColor but the legend colour doesn't change. Do you have any other idea what might be wrong, please?
The code I'm using is below.
Code: Select all
procedure TDataForm.On1Click(Sender: TObject);
begin
with ColorDialog1 do
begin
Options := [];
if Execute then OnColour := Color;
with Chart1.Series[ 0 ] do
begin
SeriesColor := Color ;
end;
Grafit(Treatnumb,Numb);
end;
end;
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Vectar,
It works fine here using SeriesColor and assigning a ColorDialog.Color to it. You may use Chart1.Legend.Repaint or Chart1.Legend.Draw to force the legend being redrawn.
If this doesn't work could you please send us a small example project we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
It works fine here using SeriesColor and assigning a ColorDialog.Color to it. You may use Chart1.Legend.Repaint or Chart1.Legend.Draw to force the legend being redrawn.
If this doesn't work could you please send us a small example project we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi John,
I can't see your example in the newsgroups. Would you be so kind to check it an post it again if necessary?
Thanks in advance.
I can't see your example in the newsgroups. Would you be so kind to check it an post it again if necessary?
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 |
Instructions - How to post in this forum |
Hi John,
using the following code works fine (just add ColorDialog1 before Color) :
using the following code works fine (just add ColorDialog1 before Color) :
Code: Select all
procedure TDataForm.On1Click(Sender: TObject);
begin
with ColorDialog1 do
begin
Options := [];
if Execute then OnColour := Color;
with Chart1.Series[ 0 ] do
begin
SeriesColor := ColorDialog1.Color ;
end;
Grafit(Treatnumb,Numb);
Chart1.Legend.Draw;
end;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com