How to display treeMap value on the chart along with the name?

1 Answer 77 Views
Charts TreeMap
AJ
Top achievements
Rank 1
Iron
AJ asked on 11 Oct 2022, 09:41 AM

I want to be able to display the treemap value on the TreeMap chart.

My TreeMap Definition :


$("#treeMap").kendoTreeMap({
    dataSource: {
        data: [{
            items: [{
                name: "Seg1",
                value: 54
            },
            {
                 name: "Seg2",
                 value: 37
            },
            {
                 name: "Seg3",
                 value: 9
             }]
         }]
     },
     valueField: "value",
     textField: "name",
     colors: [["#FF7700","#FF77FF"]]
});

 

I want to be able to see the values also in the chart like Seg1 : 54 , Seg2 : 37 , Seg3 : 9 . How do I do that?

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Georgi Denchev
Telerik team
answered on 14 Oct 2022, 07:53 AM

Hi, AJ,

You can use the template configuration to render the value alongside the name.

template: "#:dataItem.name ?? ''# #:dataItem.value?? ''#",

Dojo

https://dojo.telerik.com/@gdenchev/OXuVUhUM 

Best Regards,
Georgi Denchev
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.

AJ
Top achievements
Rank 1
Iron
commented on 14 Oct 2022, 10:45 AM

Hello, yeah this helps, thank you. Is there a way to not get the treemap-title?
I have a workaround using 
$('.k-treemap-title').remove();
But can it done by making modifications to template or some other way?
Georgi Denchev
Telerik team
commented on 19 Oct 2022, 07:34 AM

Hello, AJ,

The title is part of the individual nodes so there's no separate configuration that can disable it. The template allows you to modify the content inside the node, but not the node itself.

The solution that you came up with looks good to me and it is probably what I would've suggested as well.

Best Regards,

Georgi

AJ
Top achievements
Rank 1
Iron
commented on 19 Oct 2022, 07:44 AM

Hello Georgi, 
Okay thanks for the help.
Tags
Charts TreeMap
Asked by
AJ
Top achievements
Rank 1
Iron
Answers by
Georgi Denchev
Telerik team
Share this question
or