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

[Solved] RadarLineSeries not displaying in different colors

4 Answers 122 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Florian
Top achievements
Rank 2
Florian asked on 25 Apr 2014, 03:59 PM
Hi Telerik,

we are using a RadPolarChart with RadarLineSeries. 

The chart palette like this:
<telerik:ChartPalette x:Key="chartPalette">
        <telerik:ChartPalette.FillEntries>
            <telerik:PaletteEntryCollection>
                <SolidColorBrush Color="#FFEFA500"></SolidColorBrush>
                <SolidColorBrush Color="#FF5D2985"></SolidColorBrush>
            </telerik:PaletteEntryCollection>
        </telerik:ChartPalette.FillEntries>
        <telerik:ChartPalette.StrokeEntries>
            <telerik:PaletteEntryCollection>
                <SolidColorBrush Color="DarkGray"></SolidColorBrush>
                <SolidColorBrush Color="DarkGray"></SolidColorBrush>
            </telerik:PaletteEntryCollection>
        </telerik:ChartPalette.StrokeEntries>
    </telerik:ChartPalette>

The chart is implemented this way:
<telerik:RadPolarChart x:Name="chart" Grid.Row="1" 
                                           Grid.Column="0"
                                           Visibility="{Binding ChartId,Converter={StaticResource PolarAssessmentChartGuidToVisivilityConverter}}"
                                           IsHitTestVisible="False"
                                           PaletteName="DefaultLightSelected"
                                           Palette="{StaticResource chartPalette}"
                                           Width="800">
                        <telerik:RadPolarChart.Grid>
                            <telerik:PolarChartGrid GridLineVisibility="Both">
                                <telerik:PolarChartGrid.PolarLineStyle>
                                    <Style TargetType="Line">
                                        <Setter Property="StrokeThickness" Value="3"/>
                                        <Setter Property="Stroke" Value="{StaticResource AppBarItemPointerOverBackgroundThemeBrush}"/>
                                    </Style>
                                </telerik:PolarChartGrid.PolarLineStyle>
                            </telerik:PolarChartGrid>
                        </telerik:RadPolarChart.Grid>
                        <telerik:RadPolarChart.PolarAxis>
                            <telerik:PolarAxis MajorStep="10" Maximum="100" Foreground="Transparent"/>
                        </telerik:RadPolarChart.PolarAxis>
                        <telerik:RadPolarChart.RadialAxis>
                            <telerik:CategoricalRadialAxis>
                                <telerik:CategoricalRadialAxis.LineStyle>
                                    <Style TargetType="Ellipse">
                                        <Setter Property="StrokeDashArray" Value="4, 2"/>
                                        <Setter Property="Stroke" Value="{StaticResource AppBarItemPointerOverBackgroundThemeBrush}"/>
                                    </Style>
                                </telerik:CategoricalRadialAxis.LineStyle>
                            </telerik:CategoricalRadialAxis>
                        </telerik:RadPolarChart.RadialAxis>
                        <telerik:RadPolarChart.Series>
                            <telerik:RadarLineSeries x:Name="RadarLineSeries1" ItemsSource="{Binding ChartInfos,Converter={StaticResource ListToFirstItemConverter}, ConverterParameter='ChartObjects'}" LegendTitle="1"  >
                                <telerik:RadarLineSeries.ValueBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="Wert"/>
                                </telerik:RadarLineSeries.ValueBinding>
                                <telerik:RadarLineSeries.CategoryBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="ChartTitle"/>
                                </telerik:RadarLineSeries.CategoryBinding>
                            </telerik:RadarLineSeries>
                            <telerik:RadarLineSeries x:Name="RadarLineSeries2" ItemsSource="{Binding ChartInfos,Converter={StaticResource ListToSecondItemConverter}, ConverterParameter='ChartObjects'}" LegendTitle="2">
                                <telerik:RadarLineSeries.ValueBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="Wert"/>
                                </telerik:RadarLineSeries.ValueBinding>
                                <telerik:RadarLineSeries.CategoryBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="ChartTitle"/>
                                </telerik:RadarLineSeries.CategoryBinding>
                            </telerik:RadarLineSeries>
                        </telerik:RadPolarChart.Series>
                    </telerik:RadPolarChart>

The color of the first series is resolved from the palette and right. However, the second series is displaying in the same colour, not in the second color, defined in the chart palette.

We can give more information if you need.

Regards,
Florian

4 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 30 Apr 2014, 08:13 AM
Hello,

I tried to reproduce this scenario using the given code but everything works as expected on our side. I have attached the example and a screenshot of the output. Could you please take a look and try to reproduce it?

I am looking forward to your reply.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Florian
Top achievements
Rank 2
answered on 05 May 2014, 08:36 AM
Hi Ivaylo,

Thanks for your answer.

I can reproduce it by inserting the code of your series in my "telerik:RadPolarChart.Series" Tag.

<telerik:RadarLineSeries x:Name="RadarLineSeries1"  LegendTitle="1"  >
                    <charting:CategoricalDataPoint Category="1" Value="100" />
                    <charting:CategoricalDataPoint Category="2" Value="70" />
                    <charting:CategoricalDataPoint Category="3" Value="44" />
                </telerik:RadarLineSeries>
                <telerik:RadarLineSeries x:Name="RadarLineSeries2"  LegendTitle="2">
                    <charting:CategoricalDataPoint Category="1" Value="75" />
                    <charting:CategoricalDataPoint Category="2" Value="95" />
                    <charting:CategoricalDataPoint Category="3" Value="65" />
                </telerik:RadarLineSeries>

This way i get a proper display of 2 series with different colors.

However, if i use my series code it wont work as i wrote in the first post.

<telerik:RadarLineSeries x:Name="RadarLineSeries1" ItemsSource="{Binding ChartInfos,Converter={StaticResource ListToFirstItemConverter}, ConverterParameter='ChartObjects'}" LegendTitle="1"  >
                                <telerik:RadarLineSeries.ValueBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="Wert"/>
                                </telerik:RadarLineSeries.ValueBinding>
                                <telerik:RadarLineSeries.CategoryBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="ChartTitle"/>
                                </telerik:RadarLineSeries.CategoryBinding>
                            </telerik:RadarLineSeries>
                            <telerik:RadarLineSeries x:Name="RadarLineSeries2" ItemsSource="{Binding ChartInfos,Converter={StaticResource ListToSecondItemConverter}, ConverterParameter='ChartObjects'}" LegendTitle="2">
                                <telerik:RadarLineSeries.ValueBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="Wert"/>
                                </telerik:RadarLineSeries.ValueBinding>
                                <telerik:RadarLineSeries.CategoryBinding>
                                    <telerik:PropertyNameDataPointBinding PropertyName="ChartTitle"/>
                                </telerik:RadarLineSeries.CategoryBinding>
                            </telerik:RadarLineSeries>

I am binding a List of Lists. The converters are returning either the first or the second element (List) of this List to the chart.

This is the structure:
List<List<ChartObjects>
Where ChartObjects has a Wert and ChartTitle property.

Here the code of a converter.
public object Convert(object value, Type targetType, object parameter, string language)
        {
            var res = ((IEnumerable)value).Cast<object>().ToList();
 
            dynamic obj = res.FirstOrDefault();
 
            if (parameter == null || obj == null) return obj;
 
            if (parameter.ToString() == "AktuellesErgebnis")
            {
                return obj.AktuellesErgebnis;
            }
            if (parameter.ToString() == "ChartObjects")
            {
                return obj.ChartObjects;
            }
            return obj;
        }

I hope you can reproduce the scenario.

Regards,
Florian









0
Ivaylo Gergov
Telerik team
answered on 05 May 2014, 09:25 AM
Hi Florian,

Again I tried to reproduce it using the information that you gave me but still I am not able. It will be perfect if you send me the project or isolate the issue in a separate one. Thus, I will be able to further investigate this.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Florian
Top achievements
Rank 2
answered on 05 May 2014, 01:47 PM
Hi Ivaylo,

We have solved the issue, it wasn't a problem with the RadPolarChart. We added wrong items to the converters list, so the chart series was just empty and not displaying.

It is working all fine now.

Thanks for your help.

Regards,
Florian

Tags
Chart for XAML
Asked by
Florian
Top achievements
Rank 2
Answers by
Ivaylo Gergov
Telerik team
Florian
Top achievements
Rank 2
Share this question
or