带2个Y轴的ExtJS柱形图

带2个Y轴的ExtJS柱形图,extjs,charts,sencha-touch,extjs4,Extjs,Charts,Sencha Touch,Extjs4,我试着画一个柱状图,有两个系列,因此有两个Y轴,一个在左边,另一个在右边。但是这些列显示在同一个位置,在彼此的顶部,而不是并排显示。你知道怎么解决这个问题吗 诸如此类: Ext.onReady(function () { var chart; chart = new Ext.chart.Chart({ width: 800, height: 600, animate: true, store: store1,

我试着画一个柱状图,有两个系列,因此有两个Y轴,一个在左边,另一个在右边。但是这些列显示在同一个位置,在彼此的顶部,而不是并排显示。你知道怎么解决这个问题吗

诸如此类:

Ext.onReady(function () {
    var chart;


    chart = new Ext.chart.Chart({
        width: 800,
        height: 600,
        animate: true,
        store: store1,
        renderTo: Ext.getBody(),
        shadow: true,
        axes: [{
            type: 'Numeric',
            position: 'left',
            fields: ['data1'],
            label: {
                renderer: Ext.util.Format.numberRenderer('0,0')
            },
            title: 'Number of Hits',
            grid: true,
            minimum: 0
        }, {
            type: 'Category',
            position: 'bottom',
            fields: ['name'],
            title: 'Month of the Year'
        }, {
            type: 'Numeric',
            position: 'right',
            fields: ['data2'],
            title: 'Test'
        }],
        series: [{
            type: 'column',
            axis: 'left',
            highlight: true,
            xField: 'name',
            yField: 'data1'
        }, {
            type: 'column',
            axis: 'right',
            xField: 'name',
            yField: 'data2'
        }]
    });
});

谢谢

好吧,你不能把它们放在一起。原因是它们不在同一系列中。当同一系列中有两个数据时,它们会并排显示。在您的情况下,您有两个系列。。一个配置为使用左轴,另一个配置为使用右轴。我建议你对你的一个系列使用不同类型的图表

series: [{
    type: 'line', // Instead of column chart I am using line chart...
    axis: 'left',
    highlight: true,
    xField: 'name',
    yField: 'data1'
}, {
    type: 'column',
    axis: 'right',
    xField: 'name',
    yField: 'data2'
}]

好吧,你不能把它们并排放在一起。原因是它们不在同一系列中。当同一系列中有两个数据时,它们会并排显示。在您的情况下,您有两个系列。。一个配置为使用左轴,另一个配置为使用右轴。我建议你对你的一个系列使用不同类型的图表

series: [{
    type: 'line', // Instead of column chart I am using line chart...
    axis: 'left',
    highlight: true,
    xField: 'name',
    yField: 'data1'
}, {
    type: 'column',
    axis: 'right',
    xField: 'name',
    yField: 'data2'
}]

在存储中创建一个零值条目,并将其附加到第一个和第二个系列项目中。添加的数量取决于其他轴的Y系列字段项的长度

例如,创建两个分别具有yField的系列项目,如下所示:

yField: ['data1', 'data2','data4']

其中data4是存储中的零值项


这个解决方案非常有效

在存储中创建一个零值条目,并将其附加到第一个和第二个系列项目中。添加的数量取决于其他轴的Y系列字段项的长度

例如,创建两个分别具有yField的系列项目,如下所示:

yField: ['data1', 'data2','data4']

其中data4是存储中的零值项


这个解决方案非常有效

这将为左轴添加两列,为右轴添加第三列:

series: [{
    type: 'column',
    axis: 'left',
    highlight: true,
    label: {
        field: ['data1']
    },
    xField: ‘name’,
    yField: ['data1', 'data2','whateverUndefinedFieldNameYouComeUpWith'] // Use an undefined field
},{
    type: 'column',
    axis: 'right',
    highlight: true,
    label: {
        field: 'data3′
    },
    xField: 'name',
    yField: ['name','name','data3'] // or just use the same field you use for the x axis
}]

我希望您能理解。

这将为左轴添加两列,为右轴添加第三列:

series: [{
    type: 'column',
    axis: 'left',
    highlight: true,
    label: {
        field: ['data1']
    },
    xField: ‘name’,
    yField: ['data1', 'data2','whateverUndefinedFieldNameYouComeUpWith'] // Use an undefined field
},{
    type: 'column',
    axis: 'right',
    highlight: true,
    label: {
        field: 'data3′
    },
    xField: 'name',
    yField: ['name','name','data3'] // or just use the same field you use for the x axis
}]

希望你能明白。

好的,谢谢。如果没有办法做我想做的事,我会做的,否则!无关@Abdel:你他妈的为什么要投票批准这个标签维基编辑:?@sth,不知道怎么批准的!!我错了!我很抱歉,好的,谢谢。如果没有办法做我想做的事,我会做的,否则!无关@Abdel:你他妈的为什么要投票批准这个标签维基编辑:?@sth,不知道怎么批准的!!我错了!对不起,你能总结一下那篇帖子在你的回答中说了什么吗?这样的话,如果由于某种原因,帖子变得不可用,我们仍然有一个可用的答案,所以:-)这是一个简单且易于实现的原始问题解决方案。你能总结一下帖子在你的答案中所说的吗?这样的话,如果由于某种原因,帖子变得不可用,我们仍然有一个可用的答案,所以:-)这是一个简单且易于实现的原始问题的解决方案。