RadLegend Icon color does not match Series stroke (color)

1 Answer 80 Views
Chart
Steve
Top achievements
Rank 1
Iron
Steve asked on 27 Jun 2023, 07:59 PM

When setting the Stroke of a series (in this case a ScatterLineSeries) to something other than the default, the RadLegend icon color does does not sync to match.  I have tried nulling and resetting the LegendProvider of the legend in hopes it would grab the new colors, but I can't seem to find a work around for this issue.  Is there anything I can do to keep the series and the icon colors in sync when they are set?

Xaml:

<Grid RowDefinitions="*">

        <telerik:RadCartesianChart x:Name="chart"
                                   Grid.Row="0">

            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:NumericalAxis x:Name="xAxis" />
            </telerik:RadCartesianChart.HorizontalAxis>

            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:NumericalAxis x:Name="yAxis" />
            </telerik:RadCartesianChart.VerticalAxis>

            <telerik:RadCartesianChart.Series />

            <telerik:RadCartesianChart.Annotations>

                <telerik:CartesianGridLineAnnotation x:Name="marker"
                                                     Axis="{x:Reference xAxis}" />

            </telerik:RadCartesianChart.Annotations>

            <telerik:RadCartesianChart.ChartBehaviors>

                <telerik:ChartSelectionBehavior x:Name="selection"
                                                DataPointSelectionMode="Single"
                                                SelectionChanged="ChartSelectionBehavior_SelectionChanged" />
            </telerik:RadCartesianChart.ChartBehaviors>

        </telerik:RadCartesianChart>

        <ScrollView Grid.Row="0"
                    VerticalOptions="Start"
                    x:Name="legendContainer"
                    HeightRequest="80">
            <telerik:RadLegend x:Name="legend"
                               LegendProvider="{x:Reference Name=chart}" />
        </ScrollView>
    </Grid>

Code Behind:

ScatterLineSeries lineSeries = new ScatterLineSeries() { DisplayName = series.Name, //Stroke = series.Color, cannot set this, as legend icon color will not match StrokeThickness = series.Thickness, XValueBinding = new PropertyNameDataPointBinding(nameof(SeriesData.XScaled)), YValueBinding = new PropertyNameDataPointBinding(nameof(SeriesData.YScaled)), ItemsSource = data };

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 30 Jun 2023, 09:59 AM

Hello Steve,

I tested the case and reproduced the issue only on Android. I have logged it on your behalf here: https://feedback.telerik.com/maui/1614636-chart-android-legend-color-does-not-sync-with-the-scatterlineseries-stroke-color  Press the follow button to track its progress. 

I have tried different scenarios still there isn't an option I can suggest to workaround the behavior. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Chart
Asked by
Steve
Top achievements
Rank 1
Iron
Answers by
Didi
Telerik team
Share this question
or