This is a migrated thread and some comments may be shown as answers.

DataSeries Style

1 Answer 49 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jean
Top achievements
Rank 1
Jean asked on 04 Jun 2014, 02:26 PM
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 :

<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

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 05 Jun 2014, 10:05 AM
Hi Olivier,

I think that there might be some misunderstanding. We have never supported NoXaml for the old RadChart. It is an old control and has several limitation, one of which is the implicit styling mechanism. This is why we do not ship NoXaml binaries for the Charting dll.

If you have not yet integrated the old RadChart into your application I suggest that you completely remove the Charting reference and migrate to the new ChartView. The ChartView is actually a set of controls - RadCartesianChart, RadPieChart, RadPolarChart and ChartDataSource. It has a much better performance rate, it is very flexible and easy to set up, and it resolves many of the limitations that the old chart had.
References:
Online examples
Online documentation
sdk samples (you may want to install the sdk browser)

Regards,
Petar Marchev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Chart
Asked by
Jean
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or