If I have a Composite Chart with two NumericTimeSeries, but don't have values on all dates for both series, why can't I just graph the values from one point to the next.
E.g. if I have the following datatable:
It seems the only options I have for Null handling are Zero, InterpolatedSimple, DontPlot or Custom. I just want to graph directly from one value to the next. It seems the only way I can do this is to copy my values onto the dates on my other series, like so:
But this then displays dots on the graph, when there is no change on those dates.
Is there a way to do this?
Thanks,Campbell
Actually, based on your comment in the other thread, about WinChart being outdated, I started taking a look at UltraDataChart, and am running into a similar problem.
I have a chart, and have two sets of data, numeric values at a particular date. I want to plot these using StepLineSeries. However, both sets don't have all the same dates, so when a value is missing on one set, I want the step to continue on to the next date. However, it just doesn't draw the missing values.
Here is my code:
private void LoadCharts() { // Using single datasource for both series: DataTable dt1 = new DataTable(); dt1.Columns.Add("Date", typeof(DateTime)); dt1.Columns.Add("Series 1", typeof(int)); dt1.Columns.Add("Series 2", typeof(int)); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 1), 1, 4 }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 2), 2, null }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 6), 3, 2 }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 15), 4, null }); dt1.Rows.Add(new object[] { new DateTime(2021, 2, 1), 5, 3 }); dt1.Rows.Add(new object[] { new DateTime(2021, 2, 3), 4, 4 }); var xAxis = new TimeXAxis() // CategoryXAxis() { DataSource = dt1, DateTimeMemberPath = "Date" }; var yAxis = new NumericYAxis(); var stepLineSeries1 = new StepLineSeries() { DataSource = dt1, ValueMemberPath = "Series 1", XAxis = xAxis, YAxis = yAxis }; this.ultraDataChart1.Series.Add(stepLineSeries1); var stepLineSeries2 = new StepLineSeries() { DataSource = dt1, ValueMemberPath = "Series 2", XAxis = xAxis, YAxis = yAxis }; this.ultraDataChart1.Series.Add(stepLineSeries2); this.ultraDataChart1.Axes.Add(xAxis); this.ultraDataChart1.Axes.Add(yAxis); // Using a separate datasource for each series DataTable dt2 = new DataTable(); dt2.Columns.Add("Date", typeof(DateTime)); dt2.Columns.Add("Series 1", typeof(int)); dt2.Rows.Add(new object[] { new DateTime(2021, 1, 1), 1 }); dt2.Rows.Add(new object[] { new DateTime(2021, 1, 2), 2 }); dt2.Rows.Add(new object[] { new DateTime(2021, 1, 6), 3 }); dt2.Rows.Add(new object[] { new DateTime(2021, 1, 15), 4 }); dt2.Rows.Add(new object[] { new DateTime(2021, 2, 1), 5 }); dt2.Rows.Add(new object[] { new DateTime(2021, 2, 3), 4 }); var xAxis2 = new TimeXAxis() // CategoryXAxis() { DataSource = dt2, DateTimeMemberPath = "Date" }; var yAxis2 = new NumericYAxis(); var stepLineSeries3 = new StepLineSeries() { DataSource = dt2, ValueMemberPath = "Series 1", XAxis = xAxis2, YAxis = yAxis2 }; this.ultraDataChart2.Series.Add(stepLineSeries3); this.ultraDataChart2.Axes.Add(xAxis2); this.ultraDataChart2.Axes.Add(yAxis2); DataTable dt3 = new DataTable(); dt3.Columns.Add("Date", typeof(DateTime)); dt3.Columns.Add("Series 2", typeof(int)); dt3.Rows.Add(new object[] { new DateTime(2021, 1, 1), 4 }); dt3.Rows.Add(new object[] { new DateTime(2021, 1, 6), 2 }); dt3.Rows.Add(new object[] { new DateTime(2021, 2, 1), 3 }); dt3.Rows.Add(new object[] { new DateTime(2021, 2, 3), 4 }); var xAxis3 = new TimeXAxis() { DataSource = dt3, DateTimeMemberPath = "Date" }; var stepLineSeries4 = new StepLineSeries() { DataSource = dt3, ValueMemberPath = "Series 2", XAxis = xAxis3, YAxis = yAxis2 }; this.ultraDataChart2.Series.Add(stepLineSeries4); this.ultraDataChart2.Axes.Add(xAxis3); }
This results in a form like so:
How can I get the continuous charting as per the second example (which uses two separate datasources, and unfortunately wouldn't display unless I added an x-axis for each datasource), but using a single datasource.
Okay good. I was looking for more details. Our standalone Sparkline control supports linear interpolate.
Thanks Michael. I can't see LinearInterpolate as an option. I'm using a Composite chart type with layer chart type of Line Chart. However, I've managed to resolve my issue by creating an additional data point on each date, setting NullHandling to InterpolateSimple, and setting MidPointAnchors to false.
Hello Campbell,
Thank you for contacting Infragistics. Are you looking for LinearInterpolate where the line continues to the next point? Please refer to the following topic. Which chart type are using?
www.infragistics.com/.../sparkline-interpolating-unknown-values