I want to show node value in extjs 4 line chart

一个人想着一个人 提交于 2019-12-11 23:22:02

问题


When we take mouse on line chart node then it is showing nodes values. Same thing i want to permanently without pointing to node.

My complete code is:

items:[{
    xtype:'displayfield', 
    value:'Avg. Freight Percentage'
},{ 
    xtype: 'linechart', 
    store: store30DaysTo180Days,
    xField: 'days',
    height:200,
    yField: 'averageFreightPercentLast', 
    xAxis: new Ext.chart.CategoryAxis({ title: 'In Days', })
}]

回答1:


The config label is for this purpose. Try something like:

series: [{
    type: 'line',
    axis: 'left',
    markerConfig: {
        type: 'cross'
    },
    highlight: true,
    label: {
        display: 'inside', // or 'rotate'
        field: 'revenue',
        'text-anchor': 'start'
// I found that undocumented property with values 'start', 'end' or 'middle'
    },
    tips: {
        trackMouse: true,
        width: 80,
        height: 25,
        renderer: function(storeItem, item) {
            this.setTitle(item.value[1] + ' $</span>');
        }
    },
    xField: 'month',
    yField: 'revenue'
}]

For more information look at the docs for label.

Unfortunately, there are only few possibilities to style it. To get something good, you need to use the renderer function (this one really allows you to do all you can think of for a label).



来源:https://stackoverflow.com/questions/20216570/i-want-to-show-node-value-in-extjs-4-line-chart

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