Manually setting of X axis min/max value failed

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Mon Jan 02, 2012 7:38 am

Hello support team,

I have a problem with teechart wpf version 3.5.3700.30575.

In my chart there are 13 series of type "Bar". I want the X-axis has a fixed value range from 0 to 14. The first load of the chart works perfectly, but when I refill the chart and set the axis minimum and maximum limits the wrong limits are displayed. The call of DoInvalidate() also takes no effect.

Here a code snippet, Automatic, AutomaticMinimum and AutomaticMaximum of X axis is set to False.

Code: Select all

  
       private static void CheckMinMax(Chart aChart, bool isAuto)
        {
            try
            {
                aChart.tchart.Axes.Bottom.Automatic = isAuto;

                if (!isAuto)
                {
                    //if (aChart.XMin != double.MinValue)
                    //{
                    //    aChart.tchart.Axes.Bottom.Minimum = aChart.XMin;
                    //}

                    //if (aChart.XMax != double.MaxValue)
                    //{
                    //    aChart.tchart.Axes.Bottom.Maximum = aChart.XMax;
                    //}

                    if (aChart.XMin != double.MinValue && aChart.XMax != double.MaxValue)
                    {
                        aChart.tchart.Axes.Bottom.SetMinMax(aChart.XMin, aChart.XMax);
                    }
                }

                aChart.tchart.DoInvalidate();
            }
            catch (Exception _e)
            {
                Trace.WriteLine(_e.Message + " " + _e.StackTrace);
            }
        }
Please see also attached screenshots.

Thanks
Attachments
after_refilling_and_setMinMax.png
after_refilling_and_setMinMax.png (43.51 KiB) Viewed 22584 times
first_load.png
first_load.png (53.43 KiB) Viewed 22464 times

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

Re: Manually setting of X axis min/max value failed

Post by Sandra » Tue Jan 03, 2012 12:42 pm

Hello Lothar Leischnig,

Can you please send us a simple code, where we can reproduce exactly your problem here and try to find a good solution for you?

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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Tue Jan 03, 2012 2:17 pm

Hello, here is a testproject where you can see the problem. The chart is wrapped into an usercontrol. When you press the "switchmode" button and reset it, the axis limits get lost.
Attachments
ChartTestApp.zip
Please copy Teechart.WPF.dll to Xamlcontrols folder (version see first topic entry)
(457.48 KiB) Downloaded 550 times
HtCoreInterface.zip
Please unzip dll to Xamlcontrols folder
(82.19 KiB) Downloaded 550 times

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

Re: Manually setting of X axis min/max value failed

Post by Sandra » Wed Jan 04, 2012 11:48 am

Hello Lothar Leischnig,

I have made a simple code, using Window of WPF and last version 3 of TeeChartWPF and your requirements works fine for me. I think that project I have attached, help you to achieve as you want.
WpfApplication3.zip
(16.45 KiB) Downloaded 587 times
Can you tell us, if previous project works as you expect?

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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Wed Jan 04, 2012 12:43 pm

Hi Sandra,

thanks for the quick reply.

I have started your application. I have changed one row, it's the Automatic=False for unchecked mode (stacked). The effect is the same as in my test app. You set X min/max to -1 and 3, but I see -2 to 4. Why?

Greetings
Thomas Freyer (not Lothar, it's our CEO, who had ordered teechart) :-)
Attachments
WpfApplication3.zip
(16.61 KiB) Downloaded 541 times

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

Re: Manually setting of X axis min/max value failed

Post by Sandra » Wed Jan 04, 2012 4:29 pm

Hello Thomas,

I have change a little my code and I have done next:

Code: Select all

    private void checkBox1_Checked(object sender, RoutedEventArgs e)
        {
            tChart1.Series.Clear();
            bar1 = new Steema.TeeChart.WPF.Styles.Bar(tChart1.Chart);
            for (int i = 0; i < 3; i++)
            {
                bar1.Add(i, y[i]);
            }
            tChart1.Axes.Bottom.Automatic = true;
          
        }
        private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
        {
            tChart1.Series.Clear();
            bar1 = new Steema.TeeChart.WPF.Styles.Bar(tChart1.Chart);
            bar2 = new Steema.TeeChart.WPF.Styles.Bar(tChart1.Chart);
            for (int i = 0; i < 3; i++)
            {
                bar1.Add(i, y[i]);
                bar2.Add(i, y1[i]);
            }
          
            bar1.MultiBar = Steema.TeeChart.WPF.Styles.MultiBars.Stacked;

            tChart1.Axes.Bottom.Automatic = false;
            tChart1.Axes.Bottom.Minimum = 0;
            tChart1.Axes.Bottom.Maximum = 2;
Can you tell us if previous code works as you expect?
You set X min/max to -1 and 3, but I see -2 to 4. Why?
I check it in last version 4 and doesn't occurs, seems the problem is solved in it. If you do the same that I suggested you previous, this problem is solved. Can you confirm it?

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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Thu Jan 05, 2012 9:02 am

Hi Sandra,

I have checked your code, it worked for this special case. I guess it's a problem with the range of values which is included in the series. If I set an axis limit outside of this range it seems the chart renders a random limit. I will try to fill up the series with transparent points to fit these limits.

What an upgrade to version 4 cost?

Thomas

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

Re: Manually setting of X axis min/max value failed

Post by Narcís » Thu Jan 05, 2012 9:33 am

Hi Thomas,

Looking back at the example project you sent, I see the problem with bottom axis range being reset is this line:
chart.XAuto = true;
Which sets its range back to automatic. Removing it preserves the 0-14 range. Is this what you where looking for?
What an upgrade to version 4 cost?
Here you have upgrade options available and their prices.
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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Thu Jan 05, 2012 9:45 am

Hi Narcis,

in mode 2 there is an auto-scale bottom axis and in mode 1 a fixed one. This is intentional.

Best regards
Thomas

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

Re: Manually setting of X axis min/max value failed

Post by Narcís » Thu Jan 05, 2012 10:03 am

Hi Thomas,

Ok, that's the reason why bottom axis scaling changes then. TeeChart axes in automatic mode represent series' minimum and maximum values. Am I missing something here? Am I not understanding which is your exact problem?

Thanks in advance.
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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Thu Jan 05, 2012 10:19 am

Hi Narcis,

the problem is the following. Once I have set the Automatic = True to False and changed back again the limits for this mode the limits will not displayed. For example, I have 3 bar series with values of range 1 to 13 and I set minimum = 0 and maximum to 14, because I would like to have some space to the left and right, the chart displays a minimum value lesser than 0 and greater than 14 and the bars overlap.

Best regards
Thomas

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

Re: Manually setting of X axis min/max value failed

Post by Narcís » Thu Jan 05, 2012 10:54 am

Hi Thomas,
the problem is the following. Once I have set the Automatic = True to False and changed back again the limits for this mode the limits will not displayed. For example, I have 3 bar series with values of range 1 to 13 and I set minimum = 0 and maximum to 14, because I would like to have some space to the left and right, the chart displays a minimum value lesser than 0 and greater than 14 and the bars overlap.
Ok, I see. Your chart user control is somewhat limited and doesn't provide access to the complete TeeChart API. For us to be able to search for a solution in v3 it would be helpful if you arranged a project reproducing the issue without encapsulating TeeChart. On the other hand, I tried running your application with TeeChart .NET 2011 and I got consistent results for both modes:
Mode1.jpg
Mode1.jpg (91.79 KiB) Viewed 22364 times
Mode2.jpg
Mode2.jpg (90.95 KiB) Viewed 22370 times
Does this fit your needs?
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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Thu Jan 05, 2012 11:48 am

Hi Narcis,

I've modified your testapp to show you the problem. See attachments.

Best regards
Thomas
Attachments
WpfApplication3_not_working.zip
only change: bar series have less values than maximum of bottom axis
(16.64 KiB) Downloaded 518 times
WpfApplication3_working.zip
(16.64 KiB) Downloaded 583 times

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

Re: Manually setting of X axis min/max value failed

Post by Narcís » Thu Jan 05, 2012 12:33 pm

Hi Thomas,

I don't see any problem with the projects you sent using latest TeeChart for .NET v3 release available at the client download area. The only difference in the code is that you add 5 values instead of 14 when the checkbox is unchecked but since bottom axis is set to 0-14 its scale is constant. Toggling the checkbox always produces the same chart here. Should I perform any specific step to reproduce the issue? Is that what you get?

Running both applications I get this:
checked.jpg
checked.jpg (98.56 KiB) Viewed 22357 times
When unchecking the checkbox I get this with the one with 14 bars:
UnChecked1.jpg
UnChecked1.jpg (99.61 KiB) Viewed 22360 times
And this with the one with 5 bars:
UnChecked2.jpg
UnChecked2.jpg (81.2 KiB) Viewed 22345 times
Enabling checkboxes again I get the same as the first image with both applications
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

Lothar Leischnig
Newbie
Newbie
Posts: 12
Joined: Mon Jan 07, 2008 12:00 am

Re: Manually setting of X axis min/max value failed

Post by Lothar Leischnig » Thu Jan 05, 2012 12:50 pm

Hi Narcis, here are my screenshots.
Attachments
unchecked2.png
unchecked2.png (20.9 KiB) Viewed 22358 times
unchecked1.png
unchecked1.png (24.58 KiB) Viewed 22342 times
checked.png
checked.png (24.37 KiB) Viewed 22363 times

Post Reply