Adding a ScrollBar to C1Chart
You can add a scrollbar to C1Chart by linking the chart axis with the standard scrollbar like the following:
•XAML
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<c1chart:C1Chart x:Name="chart" ></c1chart:C1Chart>
<ScrollBar x:Name="sb" Orientation="Horizontal" Grid.Row="1" />
</Grid>
•C#
// create some data
int npts = 1000;
double[] x = new double[npts], y = new double[npts];
for (int i = 0; i < npts; i++)
{
x[i] = i; y[i] = 100 * Math.Sin(0.1 * i) * Math.Cos(0.01 * i);
}
// add data to the chart
chart.Data.Children.Add(new XYDataSeries() { XValuesSource = x, ValuesSource = y });
chart.ChartType = ChartType.Line;
// setup axis
double xscale = 0.05; // show only 1/20 of the full data range
chart.View.AxisX.Min = 0; chart.View.AxisX.Max = npts-1;
chart.View.AxisX.Scale = xscale;
sb.Minimum = 0; sb.Maximum = 1;
sb.SmallChange = 0.5*xscale; sb.LargeChange = xscale;
sb.ViewportSize = 1.0 / (1.0 - xscale) - 1.0;
// connect axis with toolbar
sb.ValueChanged += (s, e) => chart.View.AxisX.Value = sb.Value;