user3036282
user3036282

Reputation: 1

I want to show node value in extjs 4 line chart

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', })
}]

Upvotes: 0

Views: 1200

Answers (1)

Lorenz Meyer
Lorenz Meyer

Reputation: 19915

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).

Upvotes: 1

Related Questions