Page 1 of 1

Move bar-chart zero point to the bottom left corner

Posted: Wed Jun 24, 2015 1:54 pm
by 13049883
Hello,

After I added a series to the bar-chart, its zero point located in the center of the left axis.
Example:
Image

Zero point is located in the bottom left corner as soon as I start showing a data, however until data are added to the chart it looks like shown on the screenshot.
Please, help me make it look consistently without data.

Thanks.

Re: Move bar-chart zero point to the bottom left corner

Posted: Thu Jun 25, 2015 8:18 am
by narcis
Hello,

To get proper axis scaling without populating the series in the chart, you need to manually set axes scales, for example:

Code: Select all

            tChart1.Axes.Left.SetMinMax(0, 10);
If your problems persist please attach a simple example project we can run "as-is" to reproduce the problem here.

Re: Move bar-chart zero point to the bottom left corner

Posted: Thu Jun 25, 2015 8:22 am
by 13049883
I have already tried this way, however this sets constant maximum for the Y axis. I want it to be changed automatically depending on data.

I do not know data in advance, so I cannot set the maximum.

Re: Move bar-chart zero point to the bottom left corner

Posted: Thu Jun 25, 2015 8:26 am
by narcis
Hello,

Thanks for your feedback.

Can you please attach a Short, Self Contained, Correct (Compilable), Example?

Thanks in advance.

Re: Move bar-chart zero point to the bottom left corner

Posted: Tue Jun 30, 2015 8:15 am
by 13049883
Thank you Narcis!
I did this in the following way: set the Y axis to some default value and use automatic settings when values to display are not null.

Code: Select all

if (allNulls)
{
    Chart.Axes.Left.Automatic = false;
    Chart.Axes.Left.SetMinMax(0, m_barChartYMaximum);
}
else
{
    Chart.Axes.Left.Automatic = true;
}