Jump to content
Software FX Community

How do I display a nice line graph without breakages in the line when a graph has hidden points with values of DBNull?


User (Legacy)

Recommended Posts

Hi,

I have a series that is displayed as a line graph in a ChartFX for VS .NET

2005 chart. It uses data from a column that has some DBNull values.

The line prints out, with the DBNull points printing as hidden points.

These hidden points cause breaks in the nice line.

I would like the line graph to appear unbroken. I would like a straight

line to be drawn from the closest point on its left to the closest point on

its right. How can I accomplish this?

(Note: I would definitely rather not have to loop through all values and

assign fake values to the points that would make the line graph work out to

have no line breaks. I realize that I could calculate a weighted average

value between the closest point on the left and right, and set the hidden

point's value to this fake value.)

Thanks a lot for your help,

Brook Hunter

Link to comment
Share on other sites

You will need a separate set of dates for each series, your data needs to 

look like this:

Date1 Series1 Date2 Series2

1/1/2001 30 1/1/2001 40

1/3/2001 20 1/4/2001 45

1/6/2001 50 1/5/2001 70

null null 1/6/2001 60

Notice that using this approach, all null values (if any) end up at the end

of the dataset.

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

  • 3 years later...

I have got a similar issue with this.

Working with C#, I am plotting a real time data stream against time where my data arrives at unknown time intervals. My chart is updated once a second, via a timer event that refreshes the chart. Since the data coming is potentially never ending, I dont want to plot every single data sample that has arrived, otherwise, I might end up with a chart that contains an infinate number of data. So I created a scrolling window, where I only plot the last minute or so of data.

I need to use a line graph where I pass the chart data as an (x,y) coordinate set, as described in the scatter plot documentation. However, I want my data points to be connected with a line, hence my need to plot this as a line graph.

Since my data arrives at irregular intervals, my plot ends up looking like this:

chart1.Data.Y[1, 0] = 20;

chart1.Data.Y[1, 1] = null;  // no data sample at this time

chart1.Data.Y[1, 2] = 25;

chart1.Data.Y[1, 3] = null; // no data sample at this time

chart1.Data.Y[1, 4] = null; // no data sample at this time

chart1.Data.Y[1, 5] = 22;

chart1.Data.Y[1, 6] = 23;

chart1.Data.Y[1, 7] = null; // no data sample at this time

....

....

....

....

The line breaks where the data point is null, but I want a continuous line between two available points. I think, essentually, I want a scatter plot that is connected with a line.

 Is there anyway I can acheive this given the nature of my data?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...