legend.labels.template - HTML format

1 Answer 18 Views
Charts
Barnabas
Top achievements
Rank 1
Barnabas asked on 21 May 2024, 08:00 AM

Is it possible to use HTML fragments in the legends.template (https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/legend.labels#legendlabelstemplate)?

I tried several html tags (<span></span>, <br/>), but the template is rendered as clear text, not as html text. even the \n does not work :

config:



legend: {
    position: "bottom",
    labels: {
      template:
      function(e){
        return '<span style="color: red;">' + e.text +'</span>';
      }  
    }
  }

result:

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 24 May 2024, 07:47 AM

Hi Barnabas,

The Chart legend label cannot render html as such. The Kendo UI Chart allows some legend customization of the item visuals: https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/legend.item#legenditemvisual

You can also use an external legend to customize the legend: https://docs.telerik.com/kendo-ui/knowledge-base/external-legend

Regards,
Nikolay
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Charts
Asked by
Barnabas
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or