Multiple area chart with different colors for each area

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
incadea
Newbie
Newbie
Posts: 20
Joined: Thu Jul 05, 2012 12:00 am

Multiple area chart with different colors for each area

Post by incadea » Thu Sep 20, 2012 6:45 am

Hi
I am creating an area chart in an ios application with multiple area series.
I have set SeriesArea.Transparency = 40;
Due to this all area series appear in the same blue color:
Screen shot 2012-09-20 at 12.03.21 PM.png
Screen shot 2012-09-20 at 12.03.21 PM.png (49.97 KiB) Viewed 8899 times
If i do not set the Transparency then it shows like :
Screen shot 2012-09-20 at 12.06.26 PM.png
Screen shot 2012-09-20 at 12.06.26 PM.png (41.73 KiB) Viewed 8902 times
So in the screenshot above the two areas are overlapping each other.
Please let me know how to show both areas with some transparency and different colors.

Thanks

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Multiple area chart with different colors for each area

Post by Pep » Fri Sep 21, 2012 2:09 pm

Hello,

I cannot reproduce the problem here using the following code, could you please be so kind to check if it works for you?

Code: Select all

					_controller.chart.Series.Add(new Steema.TeeChart.Styles.Area());	
					_controller.chart.Series.Add(new Steema.TeeChart.Styles.Area());	
					_controller.chart.Series.Add(new Steema.TeeChart.Styles.Area());	
					_controller.chart.Series[0].FillSampleValues(5);
					_controller.chart.Series[1].FillSampleValues(5);
					_controller.chart.Series[2].FillSampleValues(5);
				    Steema.TeeChart.Styles.Area area1 = _controller.chart.Series[0] as Steema.TeeChart.Styles.Area;
				    Steema.TeeChart.Styles.Area area2 = _controller.chart.Series[1] as Steema.TeeChart.Styles.Area;
				    Steema.TeeChart.Styles.Area area3 = _controller.chart.Series[2] as Steema.TeeChart.Styles.Area;
				    area1.Transparency = 40;
				    area2.Transparency = 40;
					area3.Transparency = 40;	
In the case the problem persist, please post the code you're using in order to test it here and fix if necessary.
Thanks1

incadea
Newbie
Newbie
Posts: 20
Joined: Thu Jul 05, 2012 12:00 am

Re: Multiple area chart with different colors for each area

Post by incadea » Mon Sep 24, 2012 5:00 am

Hello Pep

Following is my source code:

Code: Select all

Steema.TeeChart.Drawing.ChartFont font = new Steema.TeeChart.Drawing.ChartFont();
            font.Size = 5;
            int SeriesCount = 2;
            for (int i=1; i <=  SeriesCount; i++)
            {                
                Steema.TeeChart.Styles.Area SeriesArea = new Steema.TeeChart.Styles.Area(chart.Chart);
                SeriesArea.Title = "Series" + i;
                SeriesArea.Marks.Font = font;

                SeriesArea.Transparency = 40;

                SeriesArea.Marks.Visible = true;
                SeriesArea.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;
                SeriesArea.Marks.Transparent = true;        
            }
            for (int i=0; i <  10; i++)
            {
                for (int j=0; j <  SeriesCount-1; j++)
                {                   
                    chart.Chart.Series [j].Add(
                        Convert.ToDouble(i + j),                      
                        Convert.ToString(i + j) + "s"                    
                    );  

                }
            }
Thanks
Attachments
Screen shot 2012-09-24 at 10.26.58 AM.png
Screen shot 2012-09-24 at 10.26.58 AM.png (39.09 KiB) Viewed 8837 times

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

Re: Multiple area chart with different colors for each area

Post by Sandra » Mon Sep 24, 2012 1:59 pm

Hello incadea,

Your code helped us to detect your problem. Basically it is produced if you try to change values of transparency property before add points in series. I have added this issue in bug list report with number[TF02016355]. We will try to fix it to upcoming versions of TeeChartFor.Net. On the other hand, at the moment, to solve the problem you must change the values of transparency property after add points of series. You can do something as next code:

Code: Select all

Steema.TeeChart.Drawing.ChartFont font = new Steema.TeeChart.Drawing.ChartFont();
            font.Size = 5;
            int SeriesCount = 2;
            for (int i=1; i <=  SeriesCount; i  )
            {                
                Steema.TeeChart.Styles.Area SeriesArea = new Steema.TeeChart.Styles.Area(chart.Chart);
                SeriesArea.Title = "Series"   i;
                SeriesArea.Marks.Font = font;

               //SeriesArea.Transparency = 40;

                SeriesArea.Marks.Visible = true;
                SeriesArea.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;
                SeriesArea.Marks.Transparent = true;        
            }
            for (int i=0; i <  10; i  )
            {
                for (int j=0; j <  SeriesCount-1; j  )
                {                   
                    chart.Chart.Series [j].Add(
                        Convert.ToDouble(i   j),                      
                        Convert.ToString(i   j)   "s"                    
                    );  
				   (chart.Chart.Series[j] as Steema.TeeChart.Styles.Area).Transparency = 40; //solve the problem.
                }
            }
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

incadea
Newbie
Newbie
Posts: 20
Joined: Thu Jul 05, 2012 12:00 am

Re: Multiple area chart with different colors for each area

Post by incadea » Tue Sep 25, 2012 4:39 am

Thanks Sandra. My problem is solved.

Post Reply