Palette no longer applied by default to new series
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
Palette no longer applied by default to new series
Hi,
I'm using ApplyPalette() to apply a custom color palette to my charts. The way it used to work is that every new Point or Bar plot added to the chart had a different color from the palette. Now I've upgraded TeeChart to a more recent version (3.5.3188.18561), and the palette doesn't seem to work anymore: if I add more than one series, they all have the same color - the first color from the palette.
How can I make the series color to be automatic again?
Best,
Michal
I'm using ApplyPalette() to apply a custom color palette to my charts. The way it used to work is that every new Point or Bar plot added to the chart had a different color from the palette. Now I've upgraded TeeChart to a more recent version (3.5.3188.18561), and the palette doesn't seem to work anymore: if I add more than one series, they all have the same color - the first color from the palette.
How can I make the series color to be automatic again?
Best,
Michal
Best,
Michal Blazejczyk
Lead Programmer
Genome Quebec
Michal Blazejczyk
Lead Programmer
Genome Quebec
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
The example at All Features\Welcome !\Themes\Custom Palettes in the features demo, available at TeeChart's program group, works fine for me here. Does it work fine at your end?
Thanks in advance.
The example at All Features\Welcome !\Themes\Custom Palettes in the features demo, available at TeeChart's program group, works fine for me here. Does it work fine at your end?
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 |
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
Hi Narcis,
Yes, it works in the demo. But it's broken in my code. Here's what I'm doing:
- Creating a chart.
- Applying a template to it using chart.Import.Template.Load().
- Apply the palette: ColorPalettes.ApplyPalette().
- Find a template series in the chart.
- Clone the template series: templateSeries.Clone().
- Configure the cloned series.
- Add the cloned series to the chart: chart.Series.Add().
- Remove the template series: chart.Series.Remove( templateSeries ).
This sequence of calls results in the colors not being applied properly. I'm thinking that maybe some setting gets cloned that causes this?
Best,
Michal
Yes, it works in the demo. But it's broken in my code. Here's what I'm doing:
- Creating a chart.
- Applying a template to it using chart.Import.Template.Load().
- Apply the palette: ColorPalettes.ApplyPalette().
- Find a template series in the chart.
- Clone the template series: templateSeries.Clone().
- Configure the cloned series.
- Add the cloned series to the chart: chart.Series.Add().
- Remove the template series: chart.Series.Remove( templateSeries ).
This sequence of calls results in the colors not being applied properly. I'm thinking that maybe some setting gets cloned that causes this?
Best,
Michal
Best,
Michal Blazejczyk
Lead Programmer
Genome Quebec
Michal Blazejczyk
Lead Programmer
Genome Quebec
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
Thanks for the information. 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.
Thanks for the information. 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.
No, this constant only exists in TeeChart VCL. I think you shouldn't change series.Color.One more thought: should I set series.Color to clTeeColor? If so, in which namespace can I find its declaration?
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 |
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
Thanks for the example project.
I think a couple things were missing, setting ColorEach=true for the series and refreshing the chart. Actually, refreshing the chart is not strictly necessary in that case. So, changing your code as shown in the code snippet below works fine for me here.
Hope this helps!
Thanks for the example project.
I think a couple things were missing, setting ColorEach=true for the series and refreshing the chart. Actually, refreshing the chart is not strictly necessary in that case. So, changing your code as shown in the code snippet below works fine for me here.
Code: Select all
chart.Import.Template.Load( dlg.FileName );
Steema.TeeChart.Themes.ColorPalettes.ApplyPalette( chart.Chart, PlotPalette );
//Code added by Steema Software
foreach (Steema.TeeChart.Styles.Series s in chart.Series)
{
s.ColorEach = true;
}
//chart.Refresh();
//End code added by Steema Software
chart.Legend.Shadow.Visible = false;
chart.Zoom.Allow = false;
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 |
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
In that case you need to assign the color from the palette to each series, for example:
In that case you need to assign the color from the palette to each series, for example:
Code: Select all
chart.Import.Template.Load( dlg.FileName );
//Steema.TeeChart.Themes.ColorPalettes.ApplyPalette( chart.Chart, PlotPalette );
//Code added by Steema Software
for (int i = 0; i < chart.Series.Count; i++)
{
if (i < PlotPalette.Length)
{
chart[i].Color = PlotPalette[i];
}
}
//End code added by Steema Software
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 |
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
Do you know in which exact version it was working before so that I can check it here?
Thanks in advance.
Do you know in which exact version it was working before so that I can check it 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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 64
- Joined: Fri Jun 16, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Michal,
Thanks for the information. I've been able to get it working with the version you mentioned so I've added the issue (TF02013474) to the bug list to be fixed for next releases.
Thanks for the information. I've been able to get it working with the version you mentioned so I've added the issue (TF02013474) to the bug list to be fixed for next releases.
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 Michal,
After investigating the issue here we found this is because Clone method was enhanced and now clones series correctly. This means that you need to call ApplyPalette method after series have been added to the chart, for example:
After investigating the issue here we found this is because Clone method was enhanced and now clones series correctly. This means that you need to call ApplyPalette method after series have been added to the chart, for example:
Code: Select all
for( int seriesIndex = 0; seriesIndex < 3; ++seriesIndex )
{
Steema.TeeChart.Styles.Points3D series = templateSeries.Clone() as Steema.TeeChart.Styles.Points3D;
// This code is supposed to fix the Clone() that doesn't clone everything.
series.Clear();
series.LinePen.Visible = false;
series.Pointer.Style = templateSeries.Pointer.Style;
series.Pointer.HorizSize = templateSeries.Pointer.HorizSize;
series.Pointer.VertSize = templateSeries.Pointer.VertSize;
series.Pointer.Pen.Visible = templateSeries.Pointer.Pen.Visible;
series.ShowInLegend = true;
series.Marks.Transparent = templateSeries.Marks.Transparent;
series.Marks.Shadow.Visible = templateSeries.Marks.Shadow.Visible;
series.Marks.Arrow.Visible = templateSeries.Marks.Arrow.Visible;
series.Marks.Arrow.Color = templateSeries.Marks.Arrow.Color;
series.Marks.ArrowLength = templateSeries.Marks.ArrowLength;
chart.Series.Add( series );
Steema.TeeChart.Themes.ColorPalettes.ApplyPalette(chart.Chart, PlotPalette);
series.Add( dataX[ seriesIndex ], dataY[ seriesIndex ], dataZ[ seriesIndex ] );
}
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 |