/// <summary> /// Create a ISeriesHost with a DateTime Axis and a TimeSpan so it can pick the appropriate interval. /// </summary> /// <param name="timeSpan">Time span for the data.</param> /// <returns>ISeriesHost for testing.</returns> private static Chart CreateDateTimeAxisWithIntervalChart(TimeSpan timeSpan) { Chart chart = new Chart(); DateTimeAxis dateTimeAxis = new DateTimeAxis(); dateTimeAxis.Orientation = AxisOrientation.Horizontal; chart.Axes.Add(dateTimeAxis); DataPointSeries series = new LineSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); DateTime start = new DateTime(2008, 1, 1); series.ItemsSource = new DateTime[] { start, start + timeSpan }; chart.Series.Add(series); return chart; }
public void AxisInAxisCollection() { Chart chart = new Chart(); DateTimeAxis dateTimeAxis = new DateTimeAxis(); dateTimeAxis.Orientation = AxisOrientation.Horizontal; dateTimeAxis.IntervalType = DateTimeIntervalType.Days; dateTimeAxis.Interval = 1; chart.Axes.Add(dateTimeAxis); DataPointSeries series = new LineSeries(); series.DependentValueBinding = new Binding("Day"); series.IndependentValueBinding = new Binding(); series.ItemsSource = new DateTime[] { new DateTime(2008, 1, 1), new DateTime(2008, 1, 2) }; chart.Series.Add(series); TestAsync( chart, () => chart.Refresh()); }