We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing Base of Area Chart's Y val from zero

Thread ID:

Created:

Updated:

Platform:

Replies:

109052 May 28,2013 12:09 AM UTC May 31,2013 10:22 AM UTC WinForms 6
loading
Tags: Chart
Dennis Beaugrand
Asked On May 28, 2013 12:09 AM UTC

It appears that the default base of an area chart's Y value is zero instead of the minimum value.
This is a problems for me in trying to plot power levels which are often < 0.

So if I plot an area chart with points like this 

  Dim series As ChartSeries = New ChartSeries("test", ChartSeriesType.Area)

        series.Points.Add(1, 1)
        series.Points.Add(2, 2)
        series.Points.Add(3, 3)
        series.Points.Add(4, 4)
        series.Points.Add(5, 3)
        series.Points.Add(6, 2)
        series.Points.Add(7, 1)

       CC2.Series.Add (series)

Then I see one 'triangle' shape as expected

But if I reduce all the Y values by 2 then I see one smaller triangle in the middle and two inverted triangles on each side.

How do I set the area base to me the minimum value and not zero?



areachart_261c96d1.zip

Bharathiraja K [Syncfusion]
Replied On May 28, 2013 02:29 PM UTC

Hi Dennis,

 

Thanks for using Syncfusion products.

 

The first point of area chart is always tweaked from nearest value and also this is the default behavior of chart. So it is tweaked from zero. We can set the min and max  range to the chart primary axis dynamically using “Range” property. We suggest you to use the below code snippet to set min and max value to the chart axis.

 

[CS]

<code>

// Assign the Minimum value of Y-Axis to minY

minY=this.chartControl1.Series[0].Summary.MinY;

 

// Assign the Maximum value of Y-Axis to maxY

maxY = this.chartControl1.Series[0].Summary.MaxY;

 

// Customize the Y axis range and interval which has points of type double

this.chartControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;

 

// Set the Min and Max range to the Primary Y-Axis

this.chartControl1.PrimaryYAxis.Range.Min = minY;

this.chartControl1.PrimaryYAxis.Range.Max = maxY;

</code>

           

Please download the sample from the following link.

AreaChart.zip

 

For more details regarding  range and intervals please refer our online document link.

http://help.syncfusion.com/ug/windows%20forms/chart/documents/axisrangeandintervals.htm

 

Please let us know if you have any concerns.

 

Thanks,

Bharathiraja K.

 


Dennis Beaugrand
Replied On May 28, 2013 05:20 PM UTC

Sorry, that did not help - my picture ( attached to my post) still looks the same. I want the area under the line to be the area between the line and the baseline - NOT the area between the line and zero.
 
See attached output from your code which is upside down and another 'correct' area chart which is simply run using the same code using all positive numbers.
 
My issue is that both charts should look basically the same since all I did was add to each Y val
 
Thanks


Area Charts_59c56c37.zip

Bharathiraja K [Syncfusion]
Replied On May 30, 2013 03:28 PM UTC

Hi Dennis,

Thanks for your update.

We have analyzed your screen shots for negative and positive value and also compare with Microsoft excel chart. Both charts are rendering in correct format for positive and negative value. While we give the negative values to  the series, the chart would be render as inverted type and also this is the default behavior. Please check and compare the excel chart with syncfusion chart from the below link.

Please download the sample’s screen shots from the following link.

Screen_chart.zip   

Please let us know if you have any concerns.

Thanks,

Bharathiraja K.

 


Dennis Beaugrand
Replied On May 30, 2013 04:14 PM UTC

Microsoft Chart will work this way this if I add a hidden dummy series first - see attached sample.

Is there perhaps a way to offset the displayed Y values? - i.e make it lie.
If so then I could add 100 to each of my real Y values ( so everything is positive) and then display the Y axis offset -100.
For example if my Y value is -25, I would add 100 to it before giving it to chart so it is plotted as +75
Then as long as the Y Axis shows it at gridline '-25' then this will work.

If your Area chart will not do this then how else can I make it look ok?





test12_6ad93108.zip

Dennis Beaugrand
Replied On May 30, 2013 05:26 PM UTC

never mind - I solved it.

Just need to use custom origin 

    CC1.PrimaryYAxis.CustomOrigin = True
    CC1.PrimaryYAxis.Origin = -25
    CC1.PrimaryYAxis.Range = New MinMaxInfo(-25, 10, 1)

now -25 is at the bottom of the graph and the area builds from the bottom instead of  zero above.




Bharathiraja K [Syncfusion]
Replied On May 31, 2013 10:22 AM UTC

Hi Dennis,

 

Thanks for your update.


We are glad to know that your query has been resolved. Please let us know if you have any other concerns. We will be happy to help you out.


Thanks,

Bharathiraja K.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;