ChartLegend

Why does adding the SegmentColorPath="SegmentColor" property to the following LineSeries cause the ChartLegend in the chart to only show Column, but after removing it, both ChartLegends can be displayed normally? Or if I set the LineSeries' IsSeriesVisible to true, both ChartLegends can also be displayed normally. Why is this?

Image_8825_1755487589889                      
<DataTemplate x:Key="itemTemplate">
                        <StackPanel Margin="10,0,10,0" Orientation="Horizontal">
                            <CheckBox
                                HorizontalAlignment="Center"
                                IsChecked="{Binding IsSeriesVisible}"
                                Style="{StaticResource CheckBoxStyle}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Checked">
                                        <i:InvokeCommandAction Command="{Binding ElementName=MainIndex, Path=DataContext.ChangedSeriesCommand}" CommandParameter="{Binding ElementName=RealtimeChart}" />
                                    </i:EventTrigger>
                                    <i:EventTrigger EventName="Unchecked">
                                        <i:InvokeCommandAction Command="{Binding ElementName=MainIndex, Path=DataContext.ChangedSeriesCommand}" CommandParameter="{Binding ElementName=RealtimeChart}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </CheckBox>
                            <TextBlock
                                HorizontalAlignment="Center"
                                FontFamily="{StaticResource PingFang}"
                                FontSize="16"
                                FontWeight="Bold"
                                Foreground="White"
                                Text="{Binding Label}" />
                        </StackPanel>
                    </DataTemplate>
                <syncfusion:SfChart.Legend>
                    <syncfusion:ChartLegend
                        Margin="0,-50"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Top"
                        FontFamily="{StaticResource PingFang}"
                        FontSize="18"
                        IconVisibility="Collapsed"
                        ItemMargin="10,0"
                        ItemTemplate="{StaticResource itemTemplate}" />
                </syncfusion:SfChart.Legend>
                <syncfusion:RangeColumnSeries Label="Column" SegmentColorPath="Brush" />
                <syncfusion:LineSeries
                    IsSeriesVisible="False"
                    ItemsSource="{Binding MmData}"
                    Label="Line"
                    SegmentColorPath="SegmentColor"
                    StrokeThickness="3"
                    XBindingPath="ID"
                    YBindingPath="TBlockPosition">
                    <syncfusion:LineSeries.XAxis>
                        <syncfusion:CategoryAxis Interval="50" OpposedPosition="{Binding DataContext.IsLineSeriesOpposedPosition, RelativeSource={RelativeSource AncestorType=Page}}">
                            <syncfusion:CategoryAxis.AxisLineStyle>
                                <Style TargetType="Line">
                                    <Setter Property="Stroke" Value="#04bee0" />
                                    <Setter Property="StrokeThickness" Value="2" />
                                </Style>
                            </syncfusion:CategoryAxis.AxisLineStyle>
                        </syncfusion:CategoryAxis>
                    </syncfusion:LineSeries.XAxis>
                </syncfusion:LineSeries>

1 Reply

PM Priyadharshni Murugan Syncfusion Team August 18, 2025 01:39 PM UTC

Hi Tom,           

 

We have reviewed your reported query regarding the legend visibility when using SegmentColorPath in LineSeries. Based on the code you provided, the legend appears correctly on our end.

 

To assist further, we’ve shared a tested sample along with an output screenshot for your reference. Please take a look, and if the issue still persists, kindly modify our sample to replicate the scenario. This will help us investigate more effectively and provide a suitable solution.

 

Thank you for your understanding and continued support. 

 

Regards,

Priyadharshni M


Attachment: WPFSamples_12191e54.zip

Loader.
Up arrow icon