Extjs 5 Chart Legend Issue

Nie*_*ree 5 extjs extjs-chart extjs5

我试图添加legend到我的extjs 5图表,它似乎不起作用.这是一个错误还是我做错了什么?

legend: {  
    docked: 'top',
    style: {
         borderColor: 'red',
         borderStyle: 'solid'
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 4

我已经在同一个问题上工作了一段时间 - 最后提交了一份 Sencha Bug 报告:

http://www.sencha.com/forum/showthread.php?289279-Sencha-5-Charts-Broken-Legend

长话短说,“据说”在下一个 EXTjs 推出中会修复这个问题。不幸的是,这对我们现在没有帮助......

但是,您可以为图例创建一个 tpl - 但我的 tpl 不如本机 extjs 图例那么强大。它仍然会显示/隐藏该系列,但不会掩盖图例中的系列。我仍在完善 TPL,并会在工作完成后发布更新。

legend: {
        docked: 'top',
        border: 0,
        style: { borderColor: 'red' },
        tpl: [            
            '<tpl for=".">',                
                '<div class="myLegendItem" style="float:left;margin:5px;padding:0px;cursor:pointer;">',
                      '<div class="" style="float:left;margin:2px;width:10px;height: 10px; background:{mark};opacity:.6"></div><div style="float:left;">{name}</div>',                                      
                '</div>',                    
            '</tpl>'                
        ],
        itemSelector: '.myLegendItem'
},
Run Code Online (Sandbox Code Playgroud)