As you have already found RadChart does not handle DateTime values natively. That is why they should be converted to double. Now, two adjacent days would have double values that differ by 1. So, when XAxis.AutoScale is true RadChart calculates certain range, but it is not guaranteed, that the all ticks will appear for specific time of the day. In order to get a better understanding of this, please set RadChart.PlotArea.XAxis.Appearance.CustomFormat
to something that includes time e.g. "MMMM/yy/dd hh:mm" If the labels are too long and not entirely visible, please set RadChart.AutoLayout
. Now, with the above custom format you should actually find that it is not the bar that moves, but the ticks as they are not guaranteed to match midnight or another fixed moment of the day.
The solution here would be to use AutoScale=false
and custom axis range. You have already tried this and the bar does not match the tick. One possible reason would be the actual DateTime value of the item. If the axis range is calculated, so that the ticks match midnight, but the item's XValue matches noon, the bar would appear off the tick. The solution would be to adjust (actually to floor) the Bar's XValue - you can hook ItemDataBound
event of the chart for this.
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed