我在结果上遇到麻烦 线图 示例从extjs4中呈现列的正确渲染,但线条未正确,请注意图片中我需要如何拥有4,而在0 xpoint中绘制了4个,当第二个图绘制在2:2:enter image description here这是我的代码:

 panel3 = Ext.create('widget.panel', {

    width: 600,
    height: 200,
    frame: false,
    renderTo: 'line',
    layout: 'fit',
    items: {
        xtype: 'chart',
        animate: false,
        store: storeline,
        insetPadding: 20,
        gradients: [{
            angle: 90,
            id: 'bar-gradient',
            stops: {
                0: {
                    color: '#99BBE8'//C12283
                },
                70: {
                    color: '#77AECE'
                },
                100: {
                    color: '#77AECE'
                }
            }
        }],
        axes: [{
            type: 'Numeric',
            minimum: 0,
            maximum: 10,
            position: 'left',
            fields: ['data1'],
            title: false,
            grid: true,
            label: {
                renderer: Ext.util.Format.numberRenderer('0,0'),
                font: '10px Arial'
            }
        }, {
            type: 'Category',
            position: 'bottom',
            fields: ['name'],
            title: false,
            grid: true,
            label: {
                font: '11px Arial',
                rotate: {
                    degrees: 300
                }
            }
        }],
        series: [{
            type: 'column',
            axis: 'left',
            xField: 'name',
            yField: 'data1',
                display: 'over',
            style: {
                fill: 'url(#bar-gradient)',
                'stroke-width': 30
            }  ,
            markerConfig: {
                type: 'circle',
                size: 4,
                radius: 4,
                'stroke-width': 20,
                fill: '#38FFFF',
                stroke: '#38B8BF'
            }
        },
        {
            type: 'line',
            axis: 'left',
            xField: 'name',
            yField: 'data2',
            tips: {
                trackMouse: true,
                width: 110,
                height: 25,
                //baseCls: 'customtip', //bodyStyle: 'background:#6cc; ',
                renderer: function (storeItem, item) {
                    this.setTitle(storeItem.get('name') + ' : ' + storeItem.get('data2'));
                }
            },
            style: {
                fill: '#18428E',
                stroke: '#18428E',
                'stroke-width': 3
            },
            markerConfig: {
                type: 'circle',
                size: 5,
                radius: 5,
                'stroke-width': 0,
                fill: '#18428E',
                stroke: '#18428E'
            }
        }]
    }

});
有帮助吗?

解决方案

在您的轴定义中尝试更改

fields: ['data1'],

fields: ['data1', 'data2'],

还要验证将被加载到Data2字段的数据是实际整数。 Extjs可能将其读为字符串,因此无法在左轴上具有值匹配。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top