Stacked Bar chart issues

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Stacked Bar chart issues

Post by Neelam » Wed Jun 24, 2009 3:08 pm

Hi
i am uploading an application 'teechart_test." The application basically let user enter no of bars to display in the textbox given and then the user can see respective no of bars in chart. Please see "BAR_ORIGINAL_MAXPOINT.vb" and run it.
-TChart1.Page.MaxPointsPerPage
Following issues-
1. if user puts 1 in textbox and then click no of bars ,then the bar display is not correct.
2. if user puts 2 in textbox and then click no of bar, then it displays 2 bars and bar display is correct- so this ok
3. But if user puts 5 in textbox and then click no of bar, then it displays 6 bars and Thats not OK.
4. But if user puts 7 in textbox and then click no of bar, then it displays 8 bars and that too there is NO SPACE BETWEEN THEM and Thats not OK.
5.But if user puts 8 in textbox and then click no of bar, then it displays 8 bars(which is OK) and BUT there is NO SPACE BETWEEN THEM and Thats not OK.

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

Re: Stacked Bar chart issues

Post by Sandra » Thu Jun 25, 2009 8:35 am

Hello shikha,

I couldn't reproduce your issues in the last update of version 3 of TeeChartFor .Net. Please see this thread and check that with last version works fine your application.
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Stacked Bar chart issues

Post by Neelam » Thu Jun 25, 2009 9:31 am

great, but the first issue is still there.. that is "if user puts 1 in textbox and then click no of bars ,then the bar display is not correct.That is bar is 1 but it has many levels stacked on it ( that is more than 3 levels/colors stacked on it)"

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

Re: Stacked Bar chart issues

Post by Sandra » Thu Jun 25, 2009 10:44 am

Hi asupriya,


I could reproduce your problem and I have added to the list of Bug Report with number [TF02014262] 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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Stacked Bar chart issues

Post by Neelam » Thu Jun 25, 2009 10:51 am

THANX.. BUT PLEASE LET ME KNOW SOME WORK AROUND FOR THIS FOR NOW AS ITS VERY IMPORTANT.. THANX IN ADVANCE

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

Re: Stacked Bar chart issues

Post by Narcís » Thu Jun 25, 2009 12:08 pm

Hi shikha,

You could set bottom axis minimum and maximum values instead, for example:

Code: Select all

TChart1.Axes.Bottom.SetMinMax(0.5, 1.5)
Hope this helps!
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Stacked Bar chart issues

Post by Neelam » Thu Jun 25, 2009 12:24 pm

thanks, but how would i know what min and max values i need to set in TChart1.Axes.Bottom.SetMinMax function. if i set it the values u have given it doews not behave correctly(ie i dont see expected output for example if enter 1 for no of bars and then press button then now i can see 3 bars instead of 1!).
i have used this code-

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Axes.Bottom.SetMinMax(0.5, 1.5)
TChart1.Page.MaxPointsPerPage = Val(Me.TextBox1.Text)
End Sub

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

Re: Stacked Bar chart issues

Post by Narcís » Thu Jun 25, 2009 1:03 pm

Hi shikha,

You can do something like this:

Code: Select all

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim NumBars as Integer = Val(Me.TextBox1.Text)

If (NumBars=1) then
TChart1.Axes.Bottom.SetMinMax(0.5, 1.5)
TChart1.Page.MaxPointsPerPage = 0
Else
TChart1.Axes.Bottom.Automatic=True
TChart1.Page.MaxPointsPerPage = NumBars
End IF
End Sub
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Stacked Bar chart issues

Post by Neelam » Thu Jun 25, 2009 2:21 pm

great.. but one thing.. in this case the bar width becomes less when entered 1 in textbox.. any resolution for that?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Stacked Bar chart issues

Post by Yeray » Thu Jun 25, 2009 2:32 pm

Hi shikha,

Try playing with the SetMinMax entered values. Having less distance (for example 0.6, 1.4) I think that the bar should look wider.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Stacked Bar chart issues

Post by Neelam » Fri Jun 26, 2009 1:34 pm

Thanks.

But there is more issue-
I want taht the Y axis values should be scaled for each chart based on max Y axis values in taht specific chart.
So for example-
1. when we display just one bar and its value is say 50 than Y axis should be scaled upto 50 + .5
2.when we display just two bars and their value is say 50 and 80 than Y axis should be scaled upto 80 + .5(as 80 is higher)

Please help with this.. many thanks for ur help

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Stacked Bar chart issues

Post by Yeray » Fri Jun 26, 2009 3:04 pm

Hi shikha,

Then you should calculate chart's left axis maximum manually looking into the shown bars and which is the highest. Here is the complete example in csharp:

Code: Select all

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

        private Steema.TeeChart.Styles.Bar bar1, bar2, bar3, bar4;

        private void InitializeChart()
        {
            chartController1.Chart = tChart1;
            tChart1.Aspect.View3D = false;

            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar3 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar4 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);

            bar1.Marks.Visible = false;
            bar2.Marks.Visible = false;
            bar3.Marks.Visible = false;
            bar4.Marks.Visible = false;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    tChart1[i].Add((j+1)*100);
                }
            }

            bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
            tChart1.Page.MaxPointsPerPage = 2;

            numericUpDown1.Minimum = 1;
            numericUpDown1.Maximum = tChart1[0].Count;
        }
        
        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            tChart1.Page.MaxPointsPerPage = (int)numericUpDown1.Value;
            if (tChart1.Page.MaxPointsPerPage == 1)
            {
                tChart1.Axes.Bottom.SetMinMax(-0.25, 0.25);
            }
            else
            {
                tChart1.Axes.Bottom.Automatic = true;
            }

            tChart1.Refresh();

            double tmpMax;
            double MaxVisible = 0;

            for (int ValueIndex = 0; ValueIndex < tChart1[0].Count; ValueIndex++)
            {
                tmpMax = 0;
                if ((ValueIndex <= tChart1[0].LastVisibleIndex) && (ValueIndex >= tChart1[0].FirstVisibleIndex))
                {
                    for (int SeriesIndex = 0; SeriesIndex < tChart1.Series.Count; SeriesIndex++)
                    {
                        tmpMax = tmpMax + tChart1[SeriesIndex].YValues[ValueIndex];
                    }
                    if (tmpMax > MaxVisible)
                    {
                        MaxVisible = tmpMax;
                    }
                }
            }
            tChart1.Axes.Left.AutomaticMaximum = false;
            tChart1.Axes.Left.Maximum = MaxVisible + tChart1.Axes.Left.MaximumOffset;
            tChart1.Header.Text = MaxVisible.ToString();
        }
    }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply