Hi Alan,
The easiest way to achieve this is by having a dummy series with value 0:
NChart chart = nChartControl1.Charts[0];
NPointSeries point = new NPointSeries();
point.Values.Add(10);
point.Values.Add(20);
point.Values.Add(30);
chart.Series.Add(point);
NPointSeries dummySeries = new NPointSeries();
dummySeries.DataLabelStyle.Visible = false;
dummySeries.Size = new NLength(0);
dummySeries.Values.Add(0);
dummySeries.Legend.Mode = SeriesLegendMode.None;
chart.Series.Add(dummySeries);
nChartControl1.Refresh();
Alternatively you can install a new content view:
class NCustomContentAxisView : NContentAxisView
{
public override NRange1DD GetViewRange(NRange1DD range, ref bool isZoomed)
{
range = base.GetViewRange(range, ref isZoomed);
if (!isZoomed)
{
range.Normalize();
if (range.Begin > 0)
{
range.Begin = 0;
}
else if (range.End < 0)
{
range.End = 0;
}
}
return range;
}
}
private void button1_Click(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
chart.Axis(StandardAxis.PrimaryY).View = new NCustomContentAxisView();
NPointSeries point = new NPointSeries();
point.Values.Add(10);
point.Values.Add(20);
point.Values.Add(30);
chart.Series.Add(point);
nChartControl1.Refresh();
}
Hope this helps - let us know if you meet any problems.
Best Regards,
Nevron Support Team