Hi Cho,
Thank you for your interest in Nevron Chart for .NET.
The following code shows how create a realtime chart has a scrollbar positioned at the end of the range:
Random m_Rand = new Random();
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.DataLabelStyle.Visible = false;
chart.Series.Add(bar);
chart.Axis(StandardAxis.PrimaryX).PagingView = new NNumericAxisPagingView();
nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = chart.Series[0] as NBarSeries;
bar.Values.Add(m_Rand.Next(100));
if (bar.Values.Count > 10)
{
while (bar.Values.Count > 100)
{
bar.Values.RemoveAt(0);
}
nChartControl1.RecalcLayout();
NAxis xAxis = chart.Axis(StandardAxis.PrimaryX);
chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
chart.Axis(StandardAxis.PrimaryX).PagingView.ZoomIn(new NRange1DD(xAxis.ContentRange.End - 10, xAxis.ContentRange.End), 0.1);
}
In this example the scrollbar will appear when the number of data points is above 10. Also keep in mind that it is a good idea to remove data points after a certain threshold to reduce computations.
Please let us know if you have any questions or meet any problems.
Best Regards,
Nevron Support Team