trend.PlotArea.XAxis.Clear();
for (int j = 8; j >= 0; j--)
trend.PlotArea.XAxis.AddItem(
DateTime.Now.Subtract(TimeSpan.FromHours(j)).ToOADate().ToString());
The data from sql has to me mapped to the correct position according to the X-Axis labels. I don't know how to do this. Next problem is, when setting a x-axis series with OADate() elements is to get the trend.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.LongTime; to Date and time display.
2.) When I don't set X-axis labels from code-behind (as told above), but just binding the chart to the sql table and mapping the DateTime column to the X-Axis.
trend.PlotArea.XAxis.DataLabelsColumn = "DatumTijd";
It shows the data correctly and I can Zoom in the chart. This feature works great. Except when placing this chart inside an ajax updatepanel. (Actualy I create the whole chart in a code-behind dll wich is actualy a webpart. The webpart is instanciated and placed in a webpartzone and the webpartzone is in an ajax updatepanel, so the rendered content wil be nested inside a div/table inside a webpartzone, inside an ajax updatepanel). Then the X-Axis will be drawn on top of the chart(instead of under). Data(graph-line) is sometimes rendered on the wrong place accoriding to the Y-Axis (looks like the Y-Axis is mirrored)
3.) Datapoint markers are drawn correctly with:
series.Appearance.PointMark.Visible = _showValues;
series.Appearance.PointMark.Border.Width = 2;
series.Appearance.PointMark.Border.Color = System.Drawing.Color.Red;
series.Appearance.PointMark.Dimensions.AutoSize = false;
series.Appearance.PointMark.Dimensions.Height = 5;
series.Appearance.PointMark.Dimensions.Width = 5;
Except for the tooltips wich are generated in:
void RadChart2_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e)
{
if (_showValues)
e.SeriesItem.ActiveRegion.Tooltip =
DateTime.FromOADate(e.SeriesItem.XValue).ToString();
}
Tooltips are never displayed (will tooltips work with zooming enabled???)
4.) How to turn off the values inside the graph that display next to the data-points.
I hope someone can put me on the right track and I still hope that all requested features can be compined together.
Thanks for your help,
Arno
| protected void CategoryGrid_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridNestedViewItem) |
| { |
| //Find the RadGrid |
| radProdGrid = e.Item.FindControl("radProdutsGrid") as RadGrid; |
| // Find the chart |
| rcProduct = e.Item.FindControl("RadChart2") as RadChart; |
| radProdGrid.DataSource = productInfoView; |
| } |
| } |