Thanks in Advance.
3 Answers, 1 is accepted
It seems that this flat line serves as an annotation. If this is the case, and it annotates some value (and it does not represent some data), then I will suggest that you use a line annotation to achieve this.
Greetings,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for the reply,we doesn't find any annotations property in chart control and i have posted the picture as a sample that i need the value to be shown for the last point(x-axis value) of the line series,which is binding to the another y axis(right side). And that line will dynamically changes when we change the week.
Let me share some of the code below
void SrcObj_RadChart1DataCompleted(object sender, RadChart1DataCompletedEventArgs e)
{
List<WebService.ChartData> objListAPS = new List<WebService.ChartData>();
objListAPS = (List<WebService.ChartData>)e.Result.ToList();
RadChart1.DefaultView.ChartArea.AdditionalYAxes.Clear();
RadChart1.PaletteBrushes.Clear();
RadChart1.SeriesMappings.Clear();
AxisY axisY = new AxisY();
axisY.AxisName = "AxisY2";
axisY.Title = "";
axisY.IsZeroBased = true;
axisY.DefaultLabelFormat = "#VAL{P0}";
RadChart1.DefaultView.ChartArea.AdditionalYAxes.Add(axisY);
RadChart1.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "#VAL{C0}";
BarSeriesDefinition BarDefVTBUnits = new BarSeriesDefinition();
BarSeriesDefinition BarDefYOYUnits = new BarSeriesDefinition();
LineSeriesDefinition lineDefVTBUnits = new LineSeriesDefinition() { ShowPointMarks = false };
LineSeriesDefinition lineDefYOYUnits = new LineSeriesDefinition() { ShowPointMarks = false};
RadChart1.DefaultView.ChartLegend.Background = new SolidColorBrush(Color.FromArgb(255, 75, 119, 255));
RadChart1.DefaultView.ChartArea.AxisY.StripLinesVisibility = Visibility.Collapsed;
RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
RadChart1.DefaultView.ChartLegend.UseAutoGeneratedItems = true;
RadChart1.DefaultView.ChartLegend.Header = "";
RadChart1.DefaultView.ChartLegendPosition = Telerik.Windows.Controls.Dock.Bottom;
RadChart1.DefaultView.ChartLegend.Foreground = new SolidColorBrush(Colors.White);
RadChart1.DefaultView.ChartLegend.LegendItemStyle = new Style() { TargetType = typeof(ChartLegendItem) };
RadChart1.DefaultView.ChartLegend.LegendItemStyle.Setters.Add(new Setter() { Property = Control.ForegroundProperty, Value = new SolidColorBrush(Colors.White) });
RadChart1.AxisForeground = new SolidColorBrush(Colors.Black);
RadChart1.AxisElementBrush = new SolidColorBrush(Colors. Black);
RadChart1.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 175, 149, 164));
RadChart1.BorderThickness = new Thickness(1);
SeriesMapping objSeriesMapping1 = new SeriesMapping();
objSeriesMapping1.SeriesDefinition = BarDefVTBUnits;
BarDefVTBUnits.LabelSettings.LabelDisplayMode = LabelDisplayMode.Inside;
objSeriesMapping1.LegendLabel = "Actuals";
objSeriesMapping1.SeriesDefinition = BarDefVTBUnits;
objSeriesMapping1.SeriesDefinition.Appearance.Fill = new SolidColorBrush(Color.FromArgb(255, 70, 130, 180));
objSeriesMapping1.ItemMappings.Add(new ItemMapping("ProductGroup", DataPointMember.XCategory));
objSeriesMapping1.ItemMappings.Add(new ItemMapping("Actuals", DataPointMember.YValue));
objSeriesMapping1.SeriesDefinition.ItemLabelFormat = "#Y{C0}";
RadChart1.SeriesMappings.Add(objSeriesMapping1);
SeriesMapping objSeriesMapping2 = new SeriesMapping();
objSeriesMapping2.SeriesDefinition = BarDefYOYUnits;
BarDefYOYUnits.LabelSettings.LabelDisplayMode = LabelDisplayMode.Inside;
objSeriesMapping2.LegendLabel = "Forecast";
objSeriesMapping2.SeriesDefinition = BarDefYOYUnits;
objSeriesMapping2.SeriesDefinition.Appearance.Fill = new SolidColorBrush(Colors.Brown);
objSeriesMapping2.ItemMappings.Add(new ItemMapping("ProductGroup", DataPointMember.XCategory));
objSeriesMapping2.ItemMappings.Add(new ItemMapping("Budget", DataPointMember.YValue));
objSeriesMapping2.SeriesDefinition.ItemLabelFormat = "#Y{C0}";
RadChart1.SeriesMappings.Add(objSeriesMapping2);
SeriesMapping objSeriesMapping3 = new SeriesMapping();
objSeriesMapping3.SeriesDefinition = lineDefVTBUnits;
BarDefVTBUnits.LabelSettings.LabelDisplayMode = LabelDisplayMode.Inside;
objSeriesMapping3.LegendLabel = "Attained Forecast";
objSeriesMapping3.SeriesDefinition.AxisName = "AxisY2";
objSeriesMapping3.SeriesDefinition.Appearance.Fill = new SolidColorBrush(Color.FromArgb(255, 236, 182, 48));
objSeriesMapping3.ItemMappings.Add(new ItemMapping("ProductGroup", DataPointMember.XCategory));
objSeriesMapping3.ItemMappings.Add(new ItemMapping("SellInRatio", DataPointMember.YValue));
objSeriesMapping3.SeriesDefinition.ItemLabelFormat = "#Y{P0}";
RadChart1.SeriesMappings.Add(objSeriesMapping3);
SeriesMapping objSeriesMapping4 = new SeriesMapping();
objSeriesMapping4.SeriesDefinition = lineDefYOYUnits;
BarDefYOYUnits.LabelSettings.LabelDisplayMode = LabelDisplayMode.Inside;
objSeriesMapping4.LegendLabel = "Target Attain";
objSeriesMapping4.SeriesDefinition.AxisName = "AxisY2";
objSeriesMapping4.SeriesDefinition.Appearance.Fill = new SolidColorBrush(Color.FromArgb(255, 120, 193, 121));
objSeriesMapping4.ItemMappings.Add(new ItemMapping("ProductGroup", DataPointMember.XCategory));
objSeriesMapping4.ItemMappings.Add(new ItemMapping("TargetAttain", DataPointMember.YValue));
objSeriesMapping4.SeriesDefinition.ItemLabelFormat = "#Y{P0}";
RadChart1.SeriesMappings.Add(objSeriesMapping4);
}
for the objSeriesMapping4 which is line series(dynamically changes) which we need is that the line should show point label for the last x-axis and remaining previous x-axis values the line point labels show be hidden or removed.I'm attaching a picture (i.e the line colored green and label values is 81%).
I have attached an example application in which only the last label of the line series is visible. This is not supported by the chart out-of-the-box, but you can easily work-around it by using the DataBound and LayoutUpdated events of the chart.
All the best,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.