I am trying to display daily production data on a line chart in pounds of product produced per hour. We have 2 departments that appear on this chart however, some days 1 of the 2 departments may not be scheduled for production. On these days in my chart, I don't want to show a zero value for pounds per hour because it shows as a sharp dip in productivity. I need the line chart to skip that day for the zero value.Can anyone shed some light on how I can accomplish this?My datasource is a datatable with decimal values for the points on the line.Thanks in advance for your help,Trevor BraunThe Stirling Creamery Ltd.
Allen,I wasn't content with the result of the Don'tPlot, so I started using InterpolateCustom instead, however I'm not sure if 7.1 has this option. If it does, this is the quick and dirty code I used to get the result I wanted:
private void Chart_InterpolateValues(object sender, InterpolateValuesEventArgs e){// hold the null column numbers and the values of the dataint [] ni = e.NullValueIndices;Array vals = e.Values;// lastgood will be the last position in which a non-null was foundint lastgood = 0;// looping through all the null points in my dataforeach (int n in ni){ if(n > 0 && n < vals.Length) { // test for a non-null value to see and mark it as the last good position // if it is non-null if (vals.GetValue((int)n - 1) != null ) { lastgood = n - 1; } // if i'm at the end of my datavalues and i have a null value to deal with, // just set it to the last known good value if(n + 1 == vals.Length) { double lgval = (double)vals.GetValue(lastgood); vals.SetValue(lgval, (int)n); } else if (vals.GetValue((int)n + 1) != null && lastgood != n) { // grab the last non-null and the next non-null value double lgval = (double)vals.GetValue(lastgood); double ngval = (double)vals.GetValue(n + 1); // grab the information for the interpolation int divideby = n + 1 - lastgood; double incremental = (ngval - lgval) / divideby; // for all the consecutive nulls between the lastgood position // and the next non-null position, insert a linear interpolation value for (int spcs = lastgood + 1; spcs < n + 1; spcs++) { double tmp = lgval + (incremental * (spcs - lastgood)); vals.SetValue(tmp, (int)spcs); } } }}}I hope this helps.
I have the same issue as Trevor and would like to have the line continue from the point for which a value exists on to the next point for which a value exists as if the columns (for which a particular row has no value) weren't even being graphed for that item.
In other words, if I weigh myself on 3 of 7 days and I weigh Foo Bar 5 of 7 days then I don't want my weight to dip down to zero on those other 2 days if I try to plot coordinates for both Foo Bar and myself in the same chart for that week.
I tried the line above just to see what the effect would be but I get an error message when I try to compile (C#): The name 'DontPlot' does not exist in the class or namespace
Fairly new to Infragistics. Using UltraWinChart.v7.1 and VS2003 (Version 7.1.6030 .NET Framework 1.1) as I have to write to a system (Eclipsys SCM v. 4.5) that requires it.
Would sure appreciate some code samples.
Thanks.
allen
Well, I have it working but I'm not getting the result I was looking for which I guess I wasn't clear enough on in my original post. Changing the null handling gives me line segments but I still want a single poly line drawn from the start to the finish. For example, I just want the line to continue from say July 10 to the data point on July 13 if there is no data for July 11 or July 12.Thanks again for your help.Trevor
Thanks very, very much for the reply, David.
I'm sure I figure something out, but just out of curiosity, since decimals can't be null, is there another way?
assuming the "not scheduled" data in your datasource is null or DBNull,
UltraChart1.LineChart.NullHandling = DontPlot;