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.
assuming the "not scheduled" data in your datasource is null or DBNull,
UltraChart1.LineChart.NullHandling = DontPlot;
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
allenovereem said: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
Infragistics.UltraChart.Shared.Styles.NullHandling.DontPlot
David,
That does work for the 7.1 implementation but the result is not actually useful as far as I can tell unless the zero value occurs before significant values for that item. In other words it appears that zero values that occur within the range of values for a certain item cause that item to be invisible (un-graphed).
It is my impression that zero values at the beginning or end of the range of columns for a group of items should not display as points at all...the line should start at the first point for which there is a significant value for that item and it should end at the last value for which there is a significant value for that item.
Does that make sense David? Is that possible?
I think Trevor has shown some logic that will work for cycling through values within a range of values and for causing the line for item(s) with zero values to run through points that are averages of points on either side while accurately reflecting the slope of the line for that item but I don't think it will address the zero values that are at the beginning and end of the range of values for that item. I also wonder if it is possible to suppress the point from appearing at those values since they are in fact averages and don't represent actual values. Did that work for you Trevor? I'd be interested to see more of the code (the part where you are calling the interpolate method, etc.).
Allen
Thought some visuals might help make this clearer. Note that the values to be plotted are indicated in the legend.
this
and finally...
Using Trevor's logic:
added the following lines along with adding his event handler as the event handler for InterpolateValues event.
using
...
None of which in my opinion yields acceptable results.
Thanks David. I finally got to attempt this yesterday. I'm new to C# and not very good at it. I ended up creating a few more arraylists to capture the row and column and data values for passing to the getFillColor method and it did work. Maybe I'll figure out how to use a jagged array to make it more efficient. Will post some code later. Wanted to thank you and say that it worked. Thanks again!
allenovereem said:Now if I could just synch the color of the ellipse with the color that is going to be displayed for that point in the legend...any ideas?
The legend icons should also be in your SceneGraph, and their Path properties should all include the string "Legend." they will also have their Row and Column properties set... so you should be able to change the color of the legend items as needed.
or, you could try finding the correct color for your ellipse using this.ChartColorModel.getFillColor(...).
I modified slightly for my implementation and this works great.
Now if I could just synch the color of the ellipse with the color that is going to be displayed for that point in the legend...any ideas?
Your idea for posting code appears to work well too. Here I'm using Firefox and I've copied the code from VS2003 into WordPad and then copied that to here. At least at this point the formatting appears intact!
Thanks!
added to the end of FillSceneGraph...
IAdvanceAxis xAxis = this.Grid["X"] as IAdvanceAxis; IAdvanceAxis yAxis = this.Grid["Y"] as IAdvanceAxis; int rowCount = this.ChartData.GetRowCount(); int colCount = this.ChartData.GetColumnCount(); ArrayList iPointsOut = new ArrayList(); for (int r = 0; r < rowCount; r++) { int indexOfNonNullPoint = -1; bool isolated = true; for (int c = 0; c < colCount; c++) { object objectValue = this.ChartData.GetObjectValue(r, c); if (objectValue != null && !(objectValue is System.DBNull)) { if (indexOfNonNullPoint != -1) { isolated = false; break; } indexOfNonNullPoint = c; } } if (isolated) { object objectValue = this.ChartData.GetObjectValue(r, indexOfNonNullPoint); double dataValue = System.Convert.ToDouble(objectValue); int xPosition = System.Convert.ToInt32(xAxis.Map(indexOfNonNullPoint)); int yPosition = System.Convert.ToInt32(yAxis.Map(dataValue)); iPointsOut.Add(new Point(xPosition, yPosition)); } } //Point[] isolatedPoints = this.GetIsolatedPoints(); foreach (Point isolatedPoint in iPointsOut) { // draw an ellipse Ellipse plotPoint = new Ellipse(isolatedPoint, 4); plotPoint.PE.Fill = Color.Black; plotPoint.Layer = this; // add the ellipse to the scene. scene.Add(plotPoint); }
Thanks. This looks like it has the potential to do it. Unfortunately I'm using VS2003 (writing to SCM4.5) so I'll have to figure out how to implement it differently than you have here before I bless it. Again thanks and I'll be back.
this "GetIsolatedPoints" method should get you what you need, so in FillSceneGraph you can just use code like this:
Point[] isolatedPoints = this.GetIsolatedPoints(); foreach (Point isolatedPoint in isolatedPoints) { // draw an ellipse Ellipse plotPoint = new Ellipse(isolatedPoint, 4); plotPoint.PE.Fill = Color.Purple; plotPoint.Layer = this; // add the ellipse to the scene. scene.Add(plotPoint); }
private Point[] GetIsolatedPoints() { IAdvanceAxis xAxis = this.Grid["X"] as IAdvanceAxis; IAdvanceAxis yAxis = this.Grid["Y"] as IAdvanceAxis; int rowCount = this.ChartData.GetRowCount(); int colCount = this.ChartData.GetColumnCount(); List<Point> result = new List<Point>(); for (int r = 0; r < rowCount; r++) { int indexOfNonNullPoint = -1; bool isolated = true; for (int c = 0; c < colCount; c++) { object objectValue = this.ChartData.GetObjectValue(r, c); if (objectValue != null && !(objectValue is DBNull)) { if (indexOfNonNullPoint != -1) { isolated = false; break; } indexOfNonNullPoint = c; } } if (isolated) { object objectValue = this.ChartData.GetObjectValue(r, indexOfNonNullPoint); double dataValue = Convert.ToDouble(objectValue); int xPosition = Convert.ToInt32(xAxis.Map(indexOfNonNullPoint)); int yPosition = Convert.ToInt32(yAxis.Map(dataValue)); result.Add(new Point(xPosition, yPosition)); } } return result.ToArray(); }