本文介绍了图例定制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何删除Path2Path3之间的填充,因为legend.label.padding应用于所有这些填充.

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/

推荐答案

最简单的方法是在js中手动选择此元素并设置自己的转换矩阵:

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)');

但这不是很好的解决方案,因为它不能抵抗Kendo库中的更改

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

您还可以尝试使用legend.item.visual属性在函数中有条件地设置图例: http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-legend.item.visual

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

这篇关于图例定制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 21:48