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
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
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.
Okay good. I was looking for more details. Our standalone Sparkline control supports linear interpolate.
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.
StepLineSeries does not support UnknownValuePlotting.
You can suggest new product ideas for future versions (or vote for existing ones) at <https://es.infragistics.com/community/ideas>. Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you. Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it.
Let me know if you have any questions.
Michael DiFilippoSoftware DeveloperInfragistics, Inc.
Perform the following to exclude markers
stepLineSeries.AssigningCategoryMarkerStyle += StepLineSeries_AssigningCategoryMarkerStyle; stepLineSeries.IsCustomCategoryMarkerStyleAllowed = true; private void StepLineSeries_AssigningCategoryMarkerStyle(object sender, AssigningCategoryMarkerStyleEventArgs args) { var excludePoint = new DateTime(2021, 1, 6); if (args.EndDate == excludePoint) { args.Fill = Color.Transparent; args.Stroke = Color.Transparent; } }
Ok, that was the conclusion I'd come to also. I just wanted to avoid having Markers on those entries should I add them, but I think it's a small price to pay. Thanks for all your help.
I would try creating a new datasource by iterating your real data that has nulls or no values and insert values based on the previous item. That way it interpolates the way you want. If that doesn't work out for you and you have a valid solution with UltraChart then you can continue to use it.
dt1.Rows.Add(new object[] { new DateTime(2021, 1, 1), 1, 4 }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 2), 2, 4 }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 6), 3, 2 }); dt1.Rows.Add(new object[] { new DateTime(2021, 1, 15), 4, 2 }); dt1.Rows.Add(new object[] { new DateTime(2021, 2, 1), 5, 3 }); dt1.Rows.Add(new object[] { new DateTime(2021, 2, 3), 4, 4 });
Ok, thanks. It's strange that it doesn't default to not displaying blanks, particularly on a Time Axis, as effectively every date that is missing is a null value, so actual null values shouldn't be treated any differently.
I will add this to the above product ideas.
Is there a way I should be able to get the above to work without the duplicated axis, or am I better just reverting to WInCharts?