Tooltip for unbound RadHTML chart

1 Answer 22 Views
Chart (HTML5)
Kent
Top achievements
Rank 1
Kent asked on 30 Apr 2021, 07:48 PM

Hi,

How do I specify what I want to be the tootip for an unbound RadHTMLChart in code (VB)?
the code works but shows the Y value (tDays) in the tootip, I need it to show the Name field (Dept)

 

see code below:

                    Dim DeptSum = (From d In EmpData Group d By Dept = d.Department Into Group
                                   Select Dept, tDays = Group.Sum(Function(d) d.Days)).ToList

                    Dim PieChartDays As New PieSeries
                    Dim PieSlice As PieSeriesItem

                        For Each DP In DeptSum
                            PieSlice = New PieSeriesItem
                            PieSlice.Name = DP.Dept
                            PieSlice.Y = DP.Tdays
                            PieChartDays.SeriesItems.Add(PieSlice)
                        Next

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 12 May 2021, 01:36 PM

Hi Kent,

You can achieve that by showing the category inside the PieSeries.TooltipAppearance.ClientTemplate:

https://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/clienttemplates/defaultcs.aspx

For example, you can do it prior adding the dynamically created PieSeries to the chart:

        Dim PieChartDays As New PieSeries
        Dim PieSlice As PieSeriesItem

        For Each DP In DeptSum
            PieSlice = New PieSeriesItem
            PieSlice.Name = DP.Dept
            PieSlice.Y = DP.Tdays
            PieChartDays.SeriesItems.Add(PieSlice)
        Next

        PieChartDays.TooltipsAppearance.ClientTemplate = "#=category#"
        PieChart1.PlotArea.Series.Add(PieChartDays)
    End Sub

Regards,
Vessy
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 (HTML5)
Asked by
Kent
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or