Using color palettes

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Using color palettes

Post by UserLS » Fri Feb 05, 2010 11:29 pm

Ok, you have introduces this cool feature "Color Palette". But using it is a pain!
First, it is a global setting (meaning I cannot have 2 graphs on my screen and select different color palettes for them!) So, when I switch between the graphs I have to manually reselect the palette for the graph. That would be fine, but what to do with a graph which was saved into a template and now I am restoring it from the template? The template file has no idea, what color palette was used!
Another problem. Ok, I have selected the color palette I like. But as soon as in my program I hit a line "new TChart()" or try to read a template file or create a new series for my graph for some odd reason you guys decided you know better what color palette I must use! It is more than just strange. Personally, I hate the one you set up as default so I constantly have to reselect my palette after each time I had touched the graph.

Ideally, I'd like to see it not as a global variable (we all know it is a bad practice to have them to begin with), but rather as a property on my TChart object and yes, I'd like it to be serialized. If I have 2 graphs (or more) than color palette from one of them has no effect on the others. And in no circumstances no one but me can change this selection (no matter what operation on the graph or its parts I do).

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Using color palettes

Post by Sandra » Mon Feb 08, 2010 1:16 pm

Hello UserLs,
First, it is a global setting (meaning I cannot have 2 graphs on my screen and select different color palettes for them!) So, when I switch between the graphs I have to manually reselect the palette for the graph. That would be fine, but what to do with a graph which was saved into a template and now I am restoring it from the template? The template file has no idea, what color palette was used!
I can reproduce your problem, and I have added in Bug report list with number [TF02014673]. We will try to fix it for next versions of TeeChart .NET.
Another problem. Ok, I have selected the color palette I like. But as soon as in my program I hit a line "new TChart()" or try to read a template file or create a new series for my graph for some odd reason you guys decided you know better what color palette I must use! It is more than just strange. Personally, I hate the one you set up as default so I constantly have to reselect my palette after each time I had touched the graph.

Ideally, I'd like to see it not as a global variable (we all know it is a bad practice to have them to begin with), but rather as a property on my TChart object and yes, I'd like it to be serialized. If I have 2 graphs (or more) than color palette from one of them has no effect on the others. And in no circumstances no one but me can change this selection (no matter what operation on the graph or its parts I do).
I found a simple project that works correctly and serialized good for code. Please, if this project doesn't work as you want and there are the problem still appears, please change code because we can reproduce your problem exactly here.

Project execution:

- Open project.
- Select palette for one chart
-Select palette for other chart.
-Push Export1/Push Import1 or Chart2 Push Export2/Push Import2.

tChart_Palette.zip
(18.21 KiB) Downloaded 635 times
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Re: Using color palettes

Post by UserLS » Mon Feb 08, 2010 4:32 pm

Ok, to be clear, I'll state my expectations here:

Code: Select all

            Graphics3D.ColorPalette = Theme.TeeChartPalette;
            var chart = new TChart();
At this point I expect Graphics3D.ColorPalette = Theme.TeeChartPalette... it is not.

Code: Select all

            Graphics3D.ColorPalette = Theme.TeeChartPalette;
            tChart1.Import.Template.Load("c:\\tChart.ten");
At this point I expect Graphics3D.ColorPalette = Theme.TeeChartPalette... it is not.

Using

Code: Select all

            ColorPalettes.ApplyPalette(tChart1.Chart, Theme.TeeChartPalette);
is no different - the results are the same - the color palette is reset (for no reason) to the default.

There are other places in my program where in some cases Color Palette is reset by your code while I am adding new series, but I cannot duplicate it easily outside of my program. But I am pretty sure that if you'd fix the cases above, then my color palette would stay. And again, I will repeat, it is rather weird you have it stored in a static property of your Graphics3D class. It does not belong there at all! It should be a property on a TChart class (not static!) and should be serialized with it.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Using color palettes

Post by Sandra » Tue Feb 09, 2010 9:38 am

Hello UserLs,

I could reproduce a problem where palette of chart is resetting when I import chart and appears default palette Opera. Please you could confirm if next code reproduce same problem that you have.

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private Steema.TeeChart.Styles.Bar bar1;
        private void InitializeChart()
        {
            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.FillSampleValues();
            bar1.ColorEach = true;
            Steema.TeeChart.Themes.ColorPalettes.ApplyPalette(tChart1.Chart, Steema.TeeChart.Themes.Theme.TeeChartPalette);
            tChart1.Export.Template.Save("C:\\TeeChartPalette1.ten"); 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Series.Clear();
            tChart1.Import.Template.Load("C:\\TeechartPalette1.ten");
        }
Thanks,
Best Regards,
Sandra Pazos / 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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Re: Using color palettes

Post by UserLS » Wed Feb 10, 2010 3:55 pm

Yes, the code you have will show one of my problems. As to your test project you've sent me: just make your charts resize when the form resizes (using anchors for example). Than select different palettes for the charts. So far so good... Now resize the form... This is a HUGE problem. Both charts are using the same palette! Why? (We all know: because it is a static property on your drawing class, but my users do not care for the implementation details. They want it work!)

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Using color palettes

Post by Sandra » Thu Feb 11, 2010 11:34 am

Hello UserLs,
Yes, the code you have will show one of my problems.
Ok. I have added the issue to bug report list whit number [TF02014681]. We will try to fix it for next versions of TeeChart .Net.
As to your test project you've sent me: just make your charts resize when the form resizes (using anchors for example). Than select different palettes for the charts. So far so good... Now resize the form... This is a HUGE problem. Both charts are using the same palette! Why?
Also, I could reproduce your problem and I have added to bug report list too whit number [TF02014682]. We will try to fix it for next versions of TeeChart.Net

Thanks,
Best Regards,
Sandra Pazos / 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