Highchart + Extjs +图表更新 [英] Highchart + Extjs + chart Updates

查看:178
本文介绍了Highchart + Extjs +图表更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置这个jsfiddle向你展示了关于Extjs和Highchart的问题:

I setup this jsfiddle to show you an issue regarding Extjs and Highchart:

http://jsfiddle.net/xea0w8n3/21/

var store = new Ext.data.ArrayStore({
    fields: ['month', 'value'],
    data : [
        ['jan', 1],
        ['feb', 2],
        ['mar', 3],
        ['apr', 4],
        ['mai', 5],
        ['jun', 6],
        ['jul', 16],
        ['aug', 2],
        ['sep', 7],
        ['oct', 4],
        ['nov', 3],
        ['dec', 11]
    ]
});


var chart = Ext.create('Chart.ux.Highcharts', {
    id:'chart',
    series:[{
        dataIndex: 'value'
    }],
    xField: 'month',
    store: store,
    chartConfig: {
        chart: {
            type: 'spline'
        },
        title: {
            text: 'A simple graph'
        },
        xAxis: {
            plotLines: [{
                color: '#FF0000',
                width: 5,
                value: 'mar'
            }]
        }
    }
});

store.load();


Ext.create('Ext.window.Window', {
    title: 'Highchart Testing',
    id:'window',
    closable : true,
    width: 300, 
    height: 400,
    layout:'fit',
    anchor:'100%',
    items:[chart],
    tbar:[
        {
            xtype:'button',
            text:'Add PlotLine',
            handler: function(){


              Ext.getCmp('chart').chart.yAxis[0].addPlotLine({
                      value:'12',
                      width: '2',
                      dashStyle: 'longdashdot',
                    color: 'red'
            });

            }
        }
    ]
}).show();

如果我添加一个绘图线并调整窗口大小,行消失:(

If I add a Plot Line and resize the window the line disappear :(

窗口打开时有什么想法来保持贴图吗?

Any ideas to keep the plotline while window is open?

提前感谢!

Regards

推荐答案

当我移动窗口时,我有一个类似的问题,线条消失了,还有发生在你身上?我通过在窗口的移动事件中隐藏并显示图表来解决问题,这有点愚蠢,但它对我有用。

I've had a similar issue with the line disappearing when I move the window. Does that also happen for you? I worked around the problem by hiding and showing the chart on the window's move event. It is a bit silly but it worked for me.

listeners: {
    // For me it was the move event
    resize: function (window) {
        var chart = Ext.getCmp('chart');
        chart.hide();
        chart.show();
    }
}

这篇关于Highchart + Extjs +图表更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆