While working on a composite line chart, I create a NumericTimeSeries, setting the ValueColumn, LabelColumn and TimeValueColumn and then binding it to a datatable. The SQL query used to produce the datatable currently sorts the result by the TimeValueColumn but I am thinking this is unecessary based on how I think the Chart engine is creating the points. I removed the sort from the query and the linechart still produces the chart correctly. My question is- is there any performance gain by sending a sorted datatable vs an usorted table? I can see the benefit in removing it on the database side but was not completly sure if I am hurting anything on the chart generation.
Teodor,
Thanks for the reply. I did find out that you do need to sort the input datasource for numericTimeSeries. It seems that when creating the datapoint lines, they are drawn in the sequence presented by the datasource. For example if you had 4 points in this order (sorted):
3/14/2011 1
3/15/2011 2
3/16/2011 3
3/17/2011 4
the line would drawn from points 3/14/2011 (1) to 3/15/2011 (2), 3/15/2011 (2) to 3/16/2011 (3) and 3/16/2011 (3) to 3/17/2011 (4). You would then see a straight line from 1 - 4.
However if the same data was not sorted by date and looked like this in the datasource:
The line would be drawn from points 3/14/2011 (1) to 3/16/2011 (3), 3/16/2011 (3) to 3/15/2011 (2) and 3/15/2011 (2) to 3/17/2011 (4). You would then not see a straight line but something like a backwards Z.
So the answer to my question would be that in NumericTimeSeries ALWAYS sort the data by the datetime column.
Hi,
The chart is just getting the data from the data source that you are providing. From the chart perspective there is no performance difference.