I have a XamDataChart that initially displays one set of data in two distinct lines. When I widen the chart, it morphs to display a single line. It seems to do this when there is a lot of data being displayed in the chart and not much room to display it. I’ve attached a project to display the anomaly.
Bump,
I have the same issue.
It appears to me if there are too many points to display the rendering of the chart line gets messed up a bit and makes it appear as though there were two lines.
Hi,
This is actually the intended behavior of the chart. If there are too many points to display such that they would just be rendering on top of eachother, the chart will show you a banded range to show you the difference between the high and the low values for that pixel. I've modified the colors in your chart so that you can see the range clearly:
In the above, the lighter red represents areas where there is a lot of difference betwee the high and low values over a small space. If the chart were to just draw all of the meanderings of the line, you would just see a dark mess of red, and performance would decrease due to the amount of geometry passed to WPF. The thicker the band is, the greater the spread between the high and low values. If you let your eye follow the top peaks of the light red, this is all the maximum values of the series, while if you let your eye follow the bottom peaks of the light red, this is all the minimum values of the series.
You normally wouldnt see this lighter band in your chart, but because you data varies so wildly over small amounts of space you can see thick sections of the band where the difference between the low values and the high values is great. If you were to zoom in on the chart, the thickness of the band would decrease as there is more space to show more individual points, until you reached a high zoome level where all the points would resolve.
Increasing the size of the chart also gives it more space to draw all the points, so you'll see the lighter band diminish as you stretch the chart horizontally.
Hope this helps!
-Graham
Sure does,
Thanks for the repies.
I don't believe there is currently a public property that will tell you that the chart has started banding in this manner. The behavior is driven by the Resolution property on the chart. The higher the value, the further apart the points it will try and coalesce into a banded representation. The default value for most series types is 1, to indicate that if points arent more than a pixel apart then they should be coalesced. So, if you were to take the number of horizontal pixels the chart has to render in (the actual width of the series) and compare that to the number of points you have added to the chart, you can tell if its going to resort to the banding. Does this help?
Your explanation and rationalization make perfect sense.
I think the confusion is that this information is typically depicted in a candlestick chart, rather than a double line chart. In fact, our proposed workaround was to attempt to switch it to a candlestick once there was so much data on the chart. Is this something we will have to handle or can you think of an easy way to do this? I.e. is there a property somewhere that the chart will let us know when it has begun rendering this high/low lines?