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

RadCartesianChart - Legend missing line-color indicator

1 Answer 144 Views
Chart
This is a migrated thread and some comments may be shown as answers.
paul
Top achievements
Rank 1
paul asked on 08 Apr 2015, 04:58 PM

Hello All,

Unable to display line-color indicator in the legend box for the "Price" series. I would expect to see a gray square immediately to the left of Price inside the legend. See attachment.

Here is the markup:

  <telerik:RadCartesianChart Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" Margin="0,0,20,0"
                                   Palette="Windows8" Name="HistoryChart"
                                   TrackBallLineStyle="{StaticResource TrackBallLineStyle}"
                                   TrackBallInfoStyle="{StaticResource TrackBallInfoStyle}">
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeContinuousAxis LabelFitMode="MultiLine"
                                                LabelInterval="1" LabelFormat="MMM d" />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" SnapMode="AllClosePoints"
                                                TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated" />
            </telerik:RadCartesianChart.Behaviors>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis LabelStyle="{StaticResource LeftLabelStyle}" />
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.Series>
                <telerik:AreaSeries CategoryBinding="BusinessDate"
                                    ValueBinding="Price"
                                    ItemsSource="{Binding ChartingWrapper.ChartingData}"
                                    Fill="{Binding ChartingWrapper.ChartingData, Converter={StaticResource ChartDataGradiantConverter}}"
                                    StrokeMode="Points" Stroke="{StaticResource MktPriceBrush}" StrokeThickness="2">
                    <telerik:AreaSeries.LegendSettings>
                        <telerik:SeriesLegendSettings Title="Price" />
                    </telerik:AreaSeries.LegendSettings>
                </telerik:AreaSeries>
                <telerik:LineSeries ValueBinding="TargetPriceUp" Stroke="{StaticResource UpsideBrush}">
                    <telerik:LineSeries.LegendSettings>
                        <telerik:SeriesLegendSettings Title="Target Price Up" />
                    </telerik:LineSeries.LegendSettings>
                </telerik:LineSeries>
                <telerik:LineSeries ValueBinding="TargetPriceDown" Stroke="{StaticResource DownsideBrush}">
                    <telerik:LineSeries.LegendSettings>
                        <telerik:SeriesLegendSettings Title="Target Price Down" />
                    </telerik:LineSeries.LegendSettings>
                </telerik:LineSeries>
            </telerik:RadCartesianChart.Series>
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid StripLinesVisibility="None" MajorLinesVisibility="X" />
            </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>
        <telerik:RadLegend BorderThickness="1" BorderBrush="LightGray"
                           Items="{Binding LegendItems, ElementName=HistoryChart}"
                           Margin="50,10" Grid.Row="1" Grid.Column="0"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Top" />

 ​

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 13 Apr 2015, 08:24 AM
Hello Paul,

I have attached a small project based on the code you provided. As you can see in the attached image, the marker brush is gray, as is the fill of the area series.

In your case, I do not see the fill of the area series, it seems to be transparent. This is why the marker brush is also transparent - by default the fill of the legend marker is bound to the fill of the area series. I am unsure why the fill of the area series is transparent in your case, perhaps you have some settings in code behind. If you were to remove these settings, the area series should display with the color from the palette and the legend marker will be correctly applied. If you need the fill of the area series to be transparent, you can use a line series instead. Another approach would be to set an item template for the legend where you pick the color of the marker by some custom logic.

Let us know if I was able to address the issue at hand properly and whether you need more information.

Regards,
Petar Marchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Chart
Asked by
paul
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or