Stacked100 - Bar

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Woehr.Mi
Newbie
Newbie
Posts: 38
Joined: Mon Jun 23, 2008 12:00 am

Stacked100 - Bar

Post by Woehr.Mi » Fri Dec 05, 2008 2:47 pm

Hello,

at the moment I work with the webcharts stacked100-Bars.
I have different Bars created, that are all Stacked100-Bars.
Sometimes I add values to every Bar-Series (Index 0 .. 6) per Timestamp, which I have created (i.e. EndDate, see below) and sometimes I only add values to a few of my 7 BarSeries (i.e. StartDate, see below).

Code: Select all

        DateTime StartDate = new DateTime(2008, 01, 02, 10, 00, 00);
        DateTime EndDate = new DateTime(2008, 01, 02, 12, 00, 00);

        Chart_Stack = WebChart_Stack.Chart;
        Chart_Stack.Axes.Bottom.Automatic = true;

        bar_stacked[0].Add(StartDate, 4);
        bar_stacked[1].Add(StartDate, 20);
        bar_stacked[5].Add(StartDate, 10);
        bar_stacked[6].Add(StartDate, 2);
        
        bar_stacked[0].Add(EndDate, 40);
        bar_stacked[1].Add(EndDate, 30);
        bar_stacked[2].Add(EndDate, 20);
        bar_stacked[3].Add(EndDate, 20);
        bar_stacked[4].Add(EndDate, 20);
        bar_stacked[5].Add(EndDate, 20);
        bar_stacked[6].Add(EndDate, 20);
The Problem here is that I get Gaps in the WebChart between the Stacked100-Bars and the Values are not drawn correctly.
What can I do to get this working correctly?

Best regards
Michael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Dec 05, 2008 3:02 pm

Hi Michael,

That's because for stacked charts you need to have same number of values in all series. For series where no values exist you can add null points, for example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		void InitializeChart()
		{
			for (int i = 0; i < 7; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.Bar());
				((Steema.TeeChart.Styles.Bar)tChart1[i]).MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked100;
			}

			DateTime StartDate = new DateTime(2008, 01, 02, 10, 00, 00);
			DateTime EndDate = new DateTime(2008, 01, 02, 12, 00, 00);

			tChart1[0].Add(StartDate, 4);
			tChart1[1].Add(StartDate, 20);
			tChart1[2].Add(StartDate, 0, Color.Transparent);
			tChart1[3].Add(StartDate, 0, Color.Transparent);
			tChart1[4].Add(StartDate, 0, Color.Transparent);
			tChart1[5].Add(StartDate, 10);
			tChart1[6].Add(StartDate, 2);

			tChart1[0].Add(EndDate, 40);
			tChart1[1].Add(EndDate, 30);
			tChart1[2].Add(EndDate, 20);
			tChart1[3].Add(EndDate, 20);
			tChart1[4].Add(EndDate, 20);
			tChart1[5].Add(EndDate, 20);
			tChart1[6].Add(EndDate, 20); 
		}
Best Regards,
Narcís Calvet / 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