hi,
I use radchart in my project, since i use NoXaml dll, my DataSeries no longer displayed. I try to define the SerieStyle on the chart area and on the SplineAreaSeriesDefinition and PieSeries but it doesn't works.
In the OutPutWindow: i got a warning when i click on the legend : System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.Charting.ChartLegend', AncestorLevel='1''. BindingExpression:Path=LegendItemMarkerShape; DataItem=null; target element is 'ChartLegendItem' (Name=''); target property is 'MarkerShape' (type 'MarkerShape')
This is the xaml code :
And this is my C# Code to add Series
Thanks for you help
Best regards
I use radchart in my project, since i use NoXaml dll, my DataSeries no longer displayed. I try to define the SerieStyle on the chart area and on the SplineAreaSeriesDefinition and PieSeries but it doesn't works.
In the OutPutWindow: i got a warning when i click on the legend : System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.Charting.ChartLegend', AncestorLevel='1''. BindingExpression:Path=LegendItemMarkerShape; DataItem=null; target element is 'ChartLegendItem' (Name=''); target property is 'MarkerShape' (type 'MarkerShape')
This is the xaml code :
<
telerik:RadChart
telerik:StyleManager.Theme
=
"Windows8"
x:Name
=
"radAreaChart"
UseDefaultLayout
=
"False"
BorderThickness
=
"0"
Background
=
"{x:Null}"
BorderBrush
=
"{x:Null}"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"auto"
></
RowDefinition
>
<
RowDefinition
Height
=
"*"
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"auto"
/>
</
Grid.ColumnDefinitions
>
<
telerik:ChartTitle
telerik:StyleManager.Theme
=
"Windows8"
x:Name
=
"AreaChartTitle"
HorizontalAlignment
=
"Center"
Content
=
"{Binding Resource.ConnectionPerProfile}"
Grid.Row
=
"0"
Grid.Column
=
"1"
Background
=
"{x:Null}"
FontFamily
=
"Segoe UI Semibold"
BorderThickness
=
"0"
OuterBorderBrush
=
"{x:Null}"
FontSize
=
"13.333"
>
</
telerik:ChartTitle
>
<
telerik:ChartArea
telerik:StyleManager.Theme
=
"Windows8"
Grid.Row
=
"1"
x:Name
=
"AreaChart"
Margin
=
"0"
LegendName
=
"AreaChartLegend"
>
</
telerik:ChartArea
>
<
telerik:ChartLegend
telerik:StyleManager.Theme
=
"Windows8"
Grid.Row
=
"1"
x:Name
=
"AreaChartLegend"
Header
=
"{Binding Resource.Legend}"
Margin
=
"-4,0"
Grid.Column
=
"1"
/>
</
Grid
>
</
telerik:RadChart
>
And this is my C# Code to add Series
AreaChart.DataSeries.Clear();
AreaChart.AxisX.AutoRange =
true
;
AreaChart.AxisY.AxisStyles.AlternateStripLineStyle =
this
.Resources[
"HorizontalStripLineStyle"
]
as
Style;
AreaChart.SeriesStyles.SplineAreaSeriesStyle =
this
.Resources[
"ScatterAreaSeriesStyle"
]
as
Style;
DataSeries chartProfilesSeries =
new
DataSeries();
chartProfilesSeries.Definition =
new
SplineAreaSeriesDefinition();
chartProfilesSeries.Definition.SeriesStyle =
this
.Resources[
"ScatterAreaSeriesStyle"
]
as
Style;
if
(
null
!= (
this
.DataContext
as
MainViewModel).LstChartTotalDateConnexion)
{
foreach
(ChartsDateConnectionDTO c
in
(
this
.DataContext
as
MainViewModel).LstChartTotalDateConnexion)
{
chartProfilesSeries.Add(
new
DataPoint()
{
//Label = String.Format("{0} : {1} ", Strings.TotalOfconnection, c.Date.ToString("dd/MM")),
YValue = c.Connection,
XCategory = c.Date.ToString(
"dd/MM"
),
Tooltip = String.Format(
"{0} du {1} "
, Strings.TotalOfconnection, c.Date.ToString(
"dd/MM"
))
});
}
chartProfilesSeries.Definition.SeriesName = String.Format(
"{0}"
, Strings.TotalOfconnection);
chartProfilesSeries.LegendLabel = String.Format(
"{0}"
, Strings.TotalOfconnection);
chartProfilesSeries.Definition.ShowItemToolTips =
true
;
chartProfilesSeries.Definition.ShowItemLabels =
true
;
chartProfilesSeries.Definition.InteractivitySettings.HoverScope = InteractivityScope.Series;
chartProfilesSeries.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Series;
AreaChart.DataSeries.Add(chartProfilesSeries);
Thanks for you help
Best regards