I have a vertical bar chart where I am filling the chart series from the code-behind, and the x-axis values are dates.
I need to draw a line across the chart that represents a "target" value.
I have read the documentation for using the ChartMarkedZone for this purpose, so I tried this code but it does not work.
The problem is that setting
does not work. But what do I set the ValueStartX and ValueEndX values to when my x-axis points are dates?
Thanks for any help. Dan
I need to draw a line across the chart that represents a "target" value.
I have read the documentation for using the ChartMarkedZone for this purpose, so I tried this code but it does not work.
Telerik.Reporting.Processing.Chart chart = (Telerik.Reporting.Processing.Chart)sender; Telerik.Reporting.Chart chartDef = (Telerik.Reporting.Chart)chart.ItemDefinition; Telerik.Reporting.Charting.ChartSeries series = new Telerik.Reporting.Charting.ChartSeries(); while (dtThisDate <= dtEndDate) { seriesItem = new Telerik.Reporting.Charting.ChartSeriesItem(); seriesItem.YValue = (long)barvalue; seriesItem.Label.TextBlock.Appearance.TextProperties.Color = Color.Black; series.AddItem(seriesItem); chartDef.PlotArea.XAxis.Items.Add(new ChartAxisItem(dtThisDate.Month.ToString() + "/" + dtThisDate.Day.ToString() + "/" + dtThisDate.Year.ToString())); } if (targetParm != "" && targetParm != "0") { Telerik.Reporting.Charting.ChartMarkedZone mzone = new ChartMarkedZone(); mzone.ValueStartY = Convert.ToInt32(targetParm); mzone.ValueEndY = Convert.ToInt32(targetParm); mzone.ValueStartX = chartDef.PlotArea.XAxis.MinValue; mzone.ValueEndX = chartDef.PlotArea.XAxis.MaxValue; mzone.Appearance.Border.Color = Color.Red; mzone.Appearance.Border.Width = 3; chartDef.PlotArea.Add(mzone); }The problem is that setting
mzone.ValueStartX = chartDef.PlotArea.XAxis.MinValuedoes not work. But what do I set the ValueStartX and ValueEndX values to when my x-axis points are dates?
Thanks for any help. Dan