Legend Customization

╄→гoц情女王★ 提交于 2019-12-25 05:35:38

问题


I would like to know how to remove padding between Path2 and Path3 since legend.label.padding is applied to all of them.

legend: {
    visible: true,               
    labels: { padding: 10}
},
series: [{
    name: "Path1",
    data: stats,
    markers: {
        visible: false,
        color: 'red'
    }
}, {
    name: "Path2",
    data: stats2,
    markers: {
        visible: false
},{
    name: "Path3",
    data: stats2,
    markers: {
        visible: false,
        color: 'blue'
    }
}],

http://jsfiddle.net/3yhbyy2g/69/


回答1:


The easiest way is to manually select this element in js and set your own transformation matrix:

$('#chart > svg:nth-child(1) > g:nth-child(2) > g:nth-child(5) > g:nth-child(1) > g:nth-child(3)')
  .attr('transform', 'matrix(1,0,0,1,439,100.5)');

But this is not so good solution, because it is not resistant to changes in Kendo library

EDIT: You can also try to use legend.item.visual property to setup legend conditionally in function: http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-legend.item.visual



来源:https://stackoverflow.com/questions/30156110/legend-customization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!