Using highcharts in sencha touch - Can't render empty chart

倖福魔咒の 提交于 2019-12-12 03:04:22

问题


i'm trying to port some highchart charts from a php web appplication to a Sencha Touche mobile app.

I want to put an empty chart in my View page and populate it dinamycally with some jsonp calls. Here's my view code (not all the 130 lines...):

{
xtype : 'panel',
scrollable: true,
html : 'INSERIRE QUI I GRAFICI E LE TABELLE',
items : [
    {
        xtype : 'panel',
        layout : 'fit',
        html : 'AREA PER GRAFICO',
        itemId : 'chartRenderPanel',
        margin: '180px'
    },
    {   //sample code, to be replaced with a consinstent config...
        xtype: 'highchart',
        chartConfig: {
           chart: {
                  type: 'spline'
           },
           title: {
                  text: 'A simple graph'
          },
          xAxis: {
                  plotLines: [{
                  color: '#FF0000',
                  width: 5,
                  value: 'mar'
                  }]
          }
          }
                  },
          {
           xtype : 'panel',
           layout : 'fit',
           html : 'AREA PER TABELLE',
           itemId : 'tableRenderPanel',
           margin: '180px'
        }
        ]
}

The Highchart part is taken from this fiddle http://jsfiddle.net/marcme/DmsGx/

it works on the fiddle but not in my mobile app: debugging with chrome, i get stuck here in the Highcharts.js:

update : function(delay) {
        var cdelay = delay || this.updateDelay;
        if(!this.updateTask) {
            this.updateTask = new Ext.util.DelayedTask(this.draw, this);
        }
        this.updateTask.delay(cdelay);
    },

With "Uncaught TypeError: undefined is not a function " message in the console.

Please, help! : )

Lorenzo


回答1:


You have to call DelayedTask differently in sencha touch than you do in Extjs. Change this

this.updateTask = new Ext.util.DelayedTask(this.draw, this);

to this

if (Ext.util.DelayedTask)
    this.updateTask = new Ext.util.DelayedTask(this.draw, this);
else
    this.updateTask = Ext.create('Ext.util.DelayedTask', this.draw, this);


来源:https://stackoverflow.com/questions/16743348/using-highcharts-in-sencha-touch-cant-render-empty-chart

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