Profile Picture

Stacked Area with negative values

Posted By Alex W 13 Years Ago
Author
Message
Alex W
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 5, Visits: 1
Hi,
I need to create a stacked area chart with negative values. The chart should look exactly like the Excel chart in the attached screenshot. As long as Stacked area charts do not support negative values, I tried to create stacked series manually by adding values from previous series to the next.
I.e.

var stackedValues = new List();

// add the first area series
var areaSeries = (NAreaSeries)chart.Series.Add(SeriesType.Area);
areaSeries.FillStyle = new NColorFillStyle(Color.RoyalBlue);
var areaSeriesValues = new List { 10, 23, 12, 24, 16, 19, 17 };
stackedValues.AddRange(areaSeriesValues);
areaSeries.Values.AddRange(stackedValues);

// add the second area series
var areaSeries2 = (NAreaSeries)chart.Series.Add(SeriesType.Area);
areaSeries2.FillStyle = new NColorFillStyle(Color.DarkSalmon);
var areaSeries2Values = new List { -5, -13, -22, 15, 26, 11, -12 };

for (var i = 0; i < areaSeries2Values.Count; i++)
{
stackedValues[i] += areaSeries2Values[i];
}
areaSeries2.Values.AddRange(stackedValues);

But the first series overlaps the second, and the chart does not look like the Excel chart.
How can I make Nevron area chart with negative values look exactly like Excel stacked area chart? Or could I emulate Excel stacked area chart using another series type?

Thanks


Attachments
StackedAreaChart.png (342 views, 40.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hello Alex,

You can use an area series (NAreaSeries) for the blue area and place a high-low series (NHighLowSeries) on top to display the red area.

In general our stacked area charts do not regard negative values - they use only absolute values.

Best Regards,
Nevron Support Team



Alex W
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 5, Visits: 1
Thank you very much! Using NHighLowSeries resolves the problem



Similar Topics


Reading This Topic