Page 1 of 2

Manually setting of X axis min/max value failed

Posted: Mon Jan 02, 2012 7:38 am
by 13047896
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

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

Posted: Tue Jan 03, 2012 12:42 pm
by 10050769
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,

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

Posted: Tue Jan 03, 2012 2:17 pm
by 13047896
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.

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

Posted: Wed Jan 04, 2012 11:48 am
by 10050769
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 593 times
Can you tell us, if previous project works as you expect?

I hope will helps.

Thanks,

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

Posted: Wed Jan 04, 2012 12:43 pm
by 13047896
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) :-)

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

Posted: Wed Jan 04, 2012 4:29 pm
by 10050769
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,

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

Posted: Thu Jan 05, 2012 9:02 am
by 13047896
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

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

Posted: Thu Jan 05, 2012 9:33 am
by narcis
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.

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

Posted: Thu Jan 05, 2012 9:45 am
by 13047896
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

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

Posted: Thu Jan 05, 2012 10:03 am
by narcis
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.

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

Posted: Thu Jan 05, 2012 10:19 am
by 13047896
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

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

Posted: Thu Jan 05, 2012 10:54 am
by narcis
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 22496 times
Mode2.jpg
Mode2.jpg (90.95 KiB) Viewed 22502 times
Does this fit your needs?

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

Posted: Thu Jan 05, 2012 11:48 am
by 13047896
Hi Narcis,

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

Best regards
Thomas

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

Posted: Thu Jan 05, 2012 12:33 pm
by narcis
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 22489 times
When unchecking the checkbox I get this with the one with 14 bars:
UnChecked1.jpg
UnChecked1.jpg (99.61 KiB) Viewed 22492 times
And this with the one with 5 bars:
UnChecked2.jpg
UnChecked2.jpg (81.2 KiB) Viewed 22477 times
Enabling checkboxes again I get the same as the first image with both applications

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

Posted: Thu Jan 05, 2012 12:50 pm
by 13047896
Hi Narcis, here are my screenshots.