Profile Picture

PrimaryY Axis & SecondaryY Axis zero align issue

Posted By inhyuk son 14 Years Ago
Author
Message
inhyuk son
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 21, Visits: 1
hi~
I have a problem.
I have two bar series, and one of the two has a negative value.
So I used a Y Axes(PrimaryY Axis & SecondaryY Axis).
But I can't align zero point each other.
What should i do?
Thanks~~



sample code:

NChart m_Chart;
NBarSeries m_Bar1;
NBarSeries m_Bar2;

Random random = new Random();
m_Chart = nChartControl1.Charts[0];

// add a bar series
m_Bar1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
m_Bar1.MultiBarMode = MultiBarMode.Series;
m_Bar1.DataLabelStyle.Visible = false;

// add another bar series
m_Bar2 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
m_Bar2.MultiBarMode = MultiBarMode.Clustered;
m_Bar2.DataLabelStyle.Visible = false;

// fill with random data
m_Bar1.Values.FillRandomRange(random, 5, -100, 100);
m_Bar2.Values.FillRandomRange(random, 5, 10, 500);

m_Bar1.DisplayOnAxis(StandardAxis.PrimaryY, false);
m_Bar1.DisplayOnAxis(StandardAxis.SecondaryY, true);

m_Chart.Axis(StandardAxis.SecondaryY).Visible = true;

m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0));
m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right;
m_Chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 0), false, false);

NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Nevron).Apply(nChartControl1.Document);

Attachments
chart.PNG (45 views, 10.00 KB)



Similar Topics


Reading This Topic