Stacked Bars with "non-complete" series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Hermes
Newbie
Newbie
Posts: 33
Joined: Fri Feb 03, 2012 12:00 am

Stacked Bars with "non-complete" series

Post by Hermes » Thu Feb 23, 2012 9:19 pm

When a bar series has a point that another series on the same chart doesn't it gives an exception.

The chart is generated like this:

Code: Select all

WebChart lChart = new WebChart();
                lChart.ID = "myChart";
                lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
                ((Steema.TeeChart.Styles.Bar)lChart.Chart.Series[0]).MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
                lChart.Chart.Series[0].Add(1, 1, "lala1");
                lChart.Chart.Series[0].Add(3, 2, "lala2");
                lChart.Chart.Series[0].Add(6, 3, "lala3");
                lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
                lChart.Chart.Series[1].Add(1, 2, "lala1");
                //lChart.Chart.Series[1].Add(3, 4, "lala2");
                lChart.Chart.Series[1].Add(6, 4, "lala2");
and gives this exception "Index was outside the bounds of the array."

Is this ok?

Thanks in advance

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

Re: Stacked Bars with "non-complete" series

Post by Sandra » Mon Feb 27, 2012 10:56 am

Hello Hermes,

I can not reproduce your problem using last version of TeeChart.Net. Can you tell us, which version are you using?

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

Hermes
Newbie
Newbie
Posts: 33
Joined: Fri Feb 03, 2012 12:00 am

Re: Stacked Bars with "non-complete" series

Post by Hermes » Mon Feb 27, 2012 1:21 pm

Sorry about that, the problem occurs when I save the chart to a .ten file or to a stream.

Code: Select all

lChart.Chart.Export.Template.Save
I am using 2011 4.1.2012.01030

Thanks!

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

Re: Stacked Bars with "non-complete" series

Post by Sandra » Tue Feb 28, 2012 12:59 pm

Hello Hermes,

Next code works fine for me using last version of TeeChart.Net:

Code: Select all

    protected void Page_Load(object sender, EventArgs e)
    {
        //chart
        WebChart lChart = new WebChart();
        lChart.ID = "myChart";
        lChart.TempChart = TempChartStyle.Session;
        Page.Form.Controls.Add(lChart);
        MemoryStream tmpChart = new MemoryStream();
       //Series
        lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
        ((Steema.TeeChart.Styles.Bar)lChart.Chart.Series[0]).MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
        lChart.Chart.Series[0].Add(1, 1, "lala1");
        lChart.Chart.Series[0].Add(3, 2, "lala2");
        lChart.Chart.Series[0].Add(6, 3, "lala3");
        lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
        lChart.Chart.Series[1].Add(1, 2, "lala1");
        lChart.Chart.Series[1].Add(3, 4, "lala2");
        lChart.Chart.Series[1].Add(6, 4, "lala2");
        lChart.Chart.Export.Template.Save(@"C:\TChart1.ten");
        //export Chart to a MemoryStream template
        lChart.Chart.Export.Template.Save(tmpChart);
      //save template to a Session variable
    }
Can you tell us if your problem appears using previous code?

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

Hermes
Newbie
Newbie
Posts: 33
Joined: Fri Feb 03, 2012 12:00 am

Re: Stacked Bars with "non-complete" series

Post by Hermes » Wed Feb 29, 2012 10:39 am

The problem is that you uncommented a line that I commented on purpose to show the problem

Code: Select all

    protected void Page_Load(object sender, EventArgs e)
    {
        //chart
        WebChart lChart = new WebChart();
        lChart.ID = "myChart";
        lChart.TempChart = TempChartStyle.Session;
        Page.Form.Controls.Add(lChart);
        MemoryStream tmpChart = new MemoryStream();
       //Series
        lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
        ((Steema.TeeChart.Styles.Bar)lChart.Chart.Series[0]).MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
        lChart.Chart.Series[0].Add(1, 1, "lala1");
        lChart.Chart.Series[0].Add(3, 2, "lala2");
        lChart.Chart.Series[0].Add(6, 3, "lala3");
        lChart.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
        lChart.Chart.Series[1].Add(1, 2, "lala1");
//        lChart.Chart.Series[1].Add(3, 4, "lala2"); /*<-- I remove this line in purpose to show what happens when a point is missing in one series */
        lChart.Chart.Series[1].Add(6, 4, "lala2");
        lChart.Chart.Export.Template.Save(@"C:\TChart1.ten");
        //export Chart to a MemoryStream template
        lChart.Chart.Export.Template.Save(tmpChart);
      //save template to a Session variable
    }

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

Re: Stacked Bars with "non-complete" series

Post by Sandra » Tue Mar 06, 2012 12:37 pm

Hello Hermes,

Sorry for the delay. Finally I can reproduce your problem and I have added it in bug list report with number [TF02016068]. We will try to fix it for next maintenace releases.

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

Hermes
Newbie
Newbie
Posts: 33
Joined: Fri Feb 03, 2012 12:00 am

Re: Stacked Bars with "non-complete" series

Post by Hermes » Wed Mar 07, 2012 10:31 am

Great! Thanks!

Post Reply