I'm using radchart,in tht chart i'm able to show 4 series(binding by
programmatically) and in that one of the series is line as the value
will be same for each x axis value.Now i want to hide the all ItemLabel
except one ItemLabel i.e showing the item label at last x axis value,is
there any way to show only one ItemLabel for the series.I'm able to remove the values but the how to remove the background color also.
here is code which i have written in the chart binding.
productChart.DataBound += (o, a) =>
{
var dataSeries = productChart.DefaultView.ChartArea.DataSeries[3];
if (dataSeries != null)
{
foreach (var point in dataSeries.ToList())
{
string units = point.XCategory;
//if (units == "LIVE Non-Field")
if (units == "Office for Mac")
{
Style pathStyle1 = new Style(typeof(System.Windows.Shapes.Path));
pathStyle1.Setters.Add(new Setter(Shape.StrokeProperty, new SolidColorBrush(Color.FromArgb(255, 120, 193, 121))));
pathStyle1.Setters.Add(new Setter(Shape.StrokeThicknessProperty, 2));
Style lineStyle1 = new Style(typeof(Telerik.Windows.Controls.Charting.LineSeries));
lineStyle1.Setters.Add(new Setter(LineSeries.BorderLineStyleProperty, pathStyle1));
point.LabelFormat = "#Y{P0}";
objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle1;
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = (Style)lineStyle1;
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle;
}
else
{
objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle;
Style pathStyle1 = new Style(typeof(System.Windows.Shapes.Path));
pathStyle1.Setters.Add(new Setter(Shape.StrokeProperty, new SolidColorBrush(Color.FromArgb(0, 255, 255, 255))));
pathStyle1.Setters.Add(new Setter(Shape.StrokeThicknessProperty, 2));
Style lineStyle1 = new Style(typeof(Telerik.Windows.Controls.Charting.LineSeries));
lineStyle1.Setters.Add(new Setter(LineSeries.BorderLineStyleProperty, pathStyle1));
point.Label = " ";
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = (Style)lineStyle1;
}
}
}
};
and CustomStyle,
<Style x:Name="CustomStyle" TargetType="telerik:SeriesItemLabel">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Name="CustomStyle1" TargetType="telerik:SeriesItemLabel">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Green"/>
</Style>
Thanks in Advance.
here is code which i have written in the chart binding.
productChart.DataBound += (o, a) =>
{
var dataSeries = productChart.DefaultView.ChartArea.DataSeries[3];
if (dataSeries != null)
{
foreach (var point in dataSeries.ToList())
{
string units = point.XCategory;
//if (units == "LIVE Non-Field")
if (units == "Office for Mac")
{
Style pathStyle1 = new Style(typeof(System.Windows.Shapes.Path));
pathStyle1.Setters.Add(new Setter(Shape.StrokeProperty, new SolidColorBrush(Color.FromArgb(255, 120, 193, 121))));
pathStyle1.Setters.Add(new Setter(Shape.StrokeThicknessProperty, 2));
Style lineStyle1 = new Style(typeof(Telerik.Windows.Controls.Charting.LineSeries));
lineStyle1.Setters.Add(new Setter(LineSeries.BorderLineStyleProperty, pathStyle1));
point.LabelFormat = "#Y{P0}";
objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle1;
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = (Style)lineStyle1;
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle;
}
else
{
objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = this.CustomStyle;
Style pathStyle1 = new Style(typeof(System.Windows.Shapes.Path));
pathStyle1.Setters.Add(new Setter(Shape.StrokeProperty, new SolidColorBrush(Color.FromArgb(0, 255, 255, 255))));
pathStyle1.Setters.Add(new Setter(Shape.StrokeThicknessProperty, 2));
Style lineStyle1 = new Style(typeof(Telerik.Windows.Controls.Charting.LineSeries));
lineStyle1.Setters.Add(new Setter(LineSeries.BorderLineStyleProperty, pathStyle1));
point.Label = " ";
//objSeriesMapping4.SeriesDefinition.SeriesItemLabelStyle = (Style)lineStyle1;
}
}
}
};
and CustomStyle,
<Style x:Name="CustomStyle" TargetType="telerik:SeriesItemLabel">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Name="CustomStyle1" TargetType="telerik:SeriesItemLabel">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Green"/>
</Style>
Thanks in Advance.