如何在legend EXTJS-highcharts的Labeformter函数的Ext.each()中插入HTML
我指的是Highcharts文档,但我不太明白如何在labelFormatter func中的ExtJS循环中添加HTMl。 代码如下:如何在legend EXTJS-highcharts的Labeformter函数的Ext.each()中插入HTML,extjs,highcharts,Extjs,Highcharts,我指的是Highcharts文档,但我不太明白如何在labelFormatter func中的ExtJS循环中添加HTMl。 代码如下: getLegendConfig: function() { var ct = this; return { align: 'right', verticalAlign: 'top', layout: 'vertical', x: -25, y: 25, borderWidth: 0, floati
getLegendConfig: function() {
var ct = this;
return {
align: 'right',
verticalAlign: 'top',
layout: 'vertical',
x: -25,
y: 25,
borderWidth: 0,
floating: type === 'column',
itemMarginBottom: 5,
labelFormatter: function() {
var count = this.y || 0;
Ext.each(ct.data.series, function(ct) {
ct.data.map(function(pt) {
if (pt !== null) {
return [
'<div>',
Ext.util.Format.ellipsis("some name", 48),
'<span class="qx-highchart-legend-item-count">',
Ext.util.Format.number(pt.count, '0,000'),
'</span>',
'</div>'
].join('');
}
})
});
},
useHTML: true
};
}.createDelegate(this)
getLegendConfig:function(){
var-ct=此;
返回{
对齐:“右”,
垂直排列:“顶部”,
布局:“垂直”,
x:-25,
y:25,
边框宽度:0,
浮动:类型=='column',
项目MarginBottom:5,
labelFormatter:function(){
var count=this.y | | 0;
Ext.each(ct.data.series,函数(ct){
ct.data.map(功能(pt){
如果(pt!==null){
返回[
'',
Ext.util.Format.省略号(“some name”,48),
'',
Ext.util.Format.number(pt.count,'0000'),
'',
''
].加入(“”);
}
})
});
},
useHTML:true
};
}.createDelegate(此)
在上面的代码中,元素内部没有填充任何内容,不知道如何运行。有什么想法吗?
这是小提琴:
谢谢因为你的小提琴中没有实际的高阶图表,只有
getLegendConfig
部分,所以要给出准确的答案是很困难的。但是,这可以追溯到上一个关于带值面板的问题。这是一个类似的示例,其中值在面板上呈现:
以下是主要部分:
series.map((x) => {
return x.data.map(function(pt) {
if (pt !== null) {
return [
'<div>',
Ext.util.Format.ellipsis("name", 48),
'<span class="qx-highchart-legend-item-count">',
Ext.util.Format.number(pt.count, '0,000'),
'</span>',
'</div>'
].join('');
}
})
}),
series.map((x)=>{
返回x.data.map(函数(pt){
如果(pt!==null){
返回[
'',
Ext.util.Format.省略号(“name”,48),
'',
Ext.util.Format.number(pt.count,'0000'),
'',
''
].加入(“”);
}
})
}),
你必须用你的代码编写它,看看你是否能得到你想要的输出。基于我上面给出的示例,这将在一个简单的面板上呈现您想要的值,因此它应该与您的作品一起工作。让我知道它是如何运行的。如果你能发布一个Sencha文件来修改代码,那就更好了。当涉及到Sencha问题时,更容易让事情快速进行。@Akrion:这是小提琴: