Kadaw Tomtom Kadaw Tomtom - 1 month ago 7
ASP.NET (C#) Question

asp.net plotting empty points

I have 1 data serie plotted on a chart. However, there are periods where there are no data and this causes the chart to draw a line from the end of 1 data point to the start of the next data point. Is there a way to plot empty points or insert breaks in the line chart?

I'm using a databound datesource.

enter image description here

Thanks,

Answer

You'll have to insert the dates that does not have data into your collection.

Probably you have a collection that looks like:

[
 { Date: 02/02/2016, Value: 100},
 { Date: 02/03/2016, Value: 123},
 { Date: 02/05/2016, Value: 5},
 { Date: 02/06/2016, Value: 200},
]

As you can see, day 4 is missing. You'll have to add it with value 0 (zero).

[
 { Date: 02/02/2016, Value: 100},
 { Date: 02/03/2016, Value: 123},
 { Date: 02/04/2016, Value: 0},
 { Date: 02/05/2016, Value: 5},
 { Date: 02/06/2016, Value: 200},
]

That was just an example, you'll have to do it when you get your data.

Regards,

Comments