Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs折线图多行标签_Extjs_Charts_Extjs4_Linechart - Fatal编程技术网

Extjs折线图多行标签

Extjs折线图多行标签,extjs,charts,extjs4,linechart,Extjs,Charts,Extjs4,Linechart,我想在X轴的折线图上做一个标签,显示所选类别的摘要。我想格式化它,所以在类别名称下我有值。如果我这样做,它会起作用: return Ext.Date.format(v, 'M Y') + '\r' + (val.data.Budgeted==null?'':('$ '+Ext.util.Format.number(val.data.Budgeted, '0,000') + '\r')) + (val.data.Actual==null?'':('$ '+Ext.util.Format.numb

我想在X轴的折线图上做一个标签,显示所选类别的摘要。我想格式化它,所以在类别名称下我有值。如果我这样做,它会起作用:

return Ext.Date.format(v, 'M Y') + '\r' + 
(val.data.Budgeted==null?'':('$ '+Ext.util.Format.number(val.data.Budgeted, '0,000') + '\r')) +
(val.data.Actual==null?'':('$ '+Ext.util.Format.number(val.data.Actual, '0,000') + '\r'));
但是,正如我所发现的,每个字符的标签都在下降。所以,如果我没有\r,它会像它应该显示的那样显示,但是如果有N'\r'-s,那么标签本身会下降,因为它上面有N行文本

也将很高兴找到一种方式来格式化文本(对齐)

编辑:

我找到了一种方法,通过更改axis配置中的“drawVerticalLabels”函数。不过,在我看来,这是一种糟糕的方式。

我不得不做一些我认为非常类似的事情。上面有一张截图

我最终像HTML模板一样完成了它。我对ExtJS框架的熟悉程度不如现在,因此如果我必须重做它,我可能会使用xtemplate,但这对我来说是可行的:

series: [{
    type: 'line',
    title: 'This Year',
    axis: 'left',
    smooth: false,
    xField: 'date_value',
    yField: 'the_count',

    // custom tips
    tips: {
      trackMouse: true,
      width: 127,
      height: 70,
      hideDelay: 0,
      dismissDelay: 0,
      renderer: function(record) {
        this.setTitle('<table width=115><tr><th><b>' + 
            record.get('date_value') + 
            ':</b></th><td align=right>' + 
            record.get('the_count') + 
            '</td></tr><tr><th><b>Quota:</b></th><td align=right>' + 
            record.get('the_quota') +
            '</td></tr><tr><th><b>Diff:</b></th><td align=right>' +
            (record.get('the_quota') > record.get('the_count') ? 
                '-' + (record.get('the_quota') - record.get('the_count')) :
                '+' + (record.get('the_count') - record.get('the_quota'))
            ) + '</td></tr></table>'
        );
      }
    }
}]
系列:[{
键入:“行”,
标题:"今年",,
轴:'左',
平滑:假,
xField:'日期\值',
伊菲尔德:“你的计数”,
//定制提示
小贴士:{
轨迹鼠标:是的,
宽度:127,
身高:70,
hideDelay:0,
解雇延迟:0,
渲染器:函数(记录){
此.setTitle(“”+
record.get('date_value')+
':' + 
record.get('the_count')+
‘配额:’+
record.get('the_quota')+
“差异:”+
(record.get('the_quota')>record.get('the_count')?
“-”+(record.get('u配额”)-record.get('u计数'):
“+”+(record.get('u count')-record.get('u quota'))
) + ''
);
}
}
}]

多行可以通过在轴渲染器中插入“\n”作为换行符来完成,默认情况下,它是居中的。

我不希望它是提示,我已经有了提示。我希望X轴的标签是多行的