Declined
Last Updated: 05 Jul 2024 12:59 by ADMIN
Raoul
Created on: 29 Jan 2022 15:49
Category: UI for WinForms
Type: Bug Report
0
Telerik.Wincontrols.chartview 2022.1.118.40 - Series legend - Can't change font and position in Float mode

Hi
I'm building a .net app with VB 2019.

With RadChartView, for some unknown reason, I can't change the Font on the Legend
Nor can I set the exact legend position when using following code

With myRadChartView

.ShowLegend = True
                    .ChartElement.LegendElement.Font = New Font("Arial", 12.0F, FontStyle.Regular)
                    .ChartElement.LegendPosition = LegendPosition.Float
                    .ChartElement.LegendOffset = New Point(1600, 300)

end with

NB: This was not working with previous release either.

2 comments
ADMIN
Dinko | Tech Support Engineer
Posted on: 05 Jul 2024 12:59

Hi,

The feedback item is closed due to inactivity. 

Regards,
Dinko | Tech Support Engineer
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.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 04 Feb 2022 14:23
Hello, Raoul,    


Setting the LegendElement.TitleElement.Font property will affect the title's font. As to the legend's items, it is necessary to handle the LegendElement.VisualItemCreating event and apply the desire font for the respective visual legend element. I have prepared a sample code snippet for your reference. Please refer to the below code snippet. 

Feel free to have a look at the following article demonstrating how to customize the legend:
https://docs.telerik.com/devtools/winforms/controls/chartview/features/legend#customize-legend

You can set the legend to float over the chart view. Here is how to set the legend to stay at position 1600, 300 over the chart area.

    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        AddHandler Me.RadChartView1.ChartElement.LegendElement.VisualItemCreating, AddressOf LegendElement_VisualItemCreating
        Dim barSeries As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries.LegendTitle = "Q1"
        barSeries.DataPoints.Add(New CategoricalDataPoint(177, "Harley"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(128, "White"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(143, "Smith"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(111, "Jones"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(118, "Marshall"))
        Me.RadChartView1.Series.Add(barSeries)
        Dim barSeries2 As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries2.LegendTitle = "Q2"
        barSeries2.DataPoints.Add(New CategoricalDataPoint(153, "Harley"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(141, "White"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(130, "Smith"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(88, "Jones"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(109, "Marshall"))
        Me.RadChartView1.Series.Add(barSeries2)
         
        

        Me.RadChartView1.ShowLegend = True
        Me.RadChartView1.LegendTitle = "Legend"
        Me.RadChartView1.ChartElement.LegendPosition = LegendPosition.Float
        Me.RadChartView1.ChartElement.LegendOffset = New Point(1600, 300)
        Me.RadChartView1.ChartElement.LegendElement.TitleElement.Font = f 
    End Sub
    Dim f As New Font("Arial", 12.0F, FontStyle.Regular)
    Private Sub LegendElement_VisualItemCreating(sender As Object, e As LegendItemElementCreatingEventArgs)
        e.ItemElement = New LegendItemElement(e.LegendItem)
        e.ItemElement.TitleElement.Font = f
    End Sub

Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem? Feel free to modify the project in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Principal
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.

Attached Files: