Tuesday, April 21, 2009

Strange values in chart

Infragistics stacked column chart allows to display both negative and not negative values. However, I was adding some post processing based on values and discovered that one has to be careful with Box.Value.

Among others I had a stacked column with values 0, -50, 0, 50, 0. This is what I obtained (Box[][] rows were collected from SceneGraph by Row and Column):


((NumericDataPoint)rows[3][0].DataPoint)
Value: 0.0
((NumericDataPoint)rows[3][1].DataPoint)
Value: -50.0
((NumericDataPoint)rows[3][2].DataPoint)
Value: 0.0
((NumericDataPoint)rows[3][3].DataPoint)
Value: 50.0
((NumericDataPoint)rows[3][4].DataPoint)
Value: 0.0

rows[3][0].Value
0.0
rows[3][1].Value
-50.0
rows[3][2].Value
-50.0
rows[3][3].Value
50.0
rows[3][4].Value
-50.0


There is a kind of warning in the documentation of Box.Value:

The intent behind any data objects referenced by this property are dependent upon the Layer that added this Primitive to the scene graph.
They tend to use it, though, as I saw on forums.

I spent some time trying to find better way then casting Box.DataPoint to NumericDataPoint, but I failed.

No comments: