windend opened a new issue #8509: 两个$.getJSON数据报错
URL: https://github.com/apache/incubator-echarts/issues/8509
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   两个$.getJSON 用dataset找不到source,图形渲染不了,去掉一个getjson正常,使用内网映射到外网偶尔正常显示。
   报错: Uncaught TypeError: Cannot read property 'source' of undefined
   
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:4.1.0
   + Browser version [浏览器类型和版本]:chrome 66
   + OS Version [操作系统类型和版本]:mac 10.13
   
   
   
   
   
   ### Expected behaviour [期望结果]
   
   正常渲染数据
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 
option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   $.getJSON('data', function (data) {
           var { fname, msale, price, total } = data[0];  
           option = {
               title: {
                   text: '外卖数据'
               },
               tooltip: {},
               legend: {},
               dataset: {
                   dimensions: ['fname', '月售', '单价', '总价'],
                   source: [
                       [fname, msale, price, total]
                   ]
               },
               xAxis: {
                   type: 'category',
                   // data: ['fname', 'msale', 'price', 'total']
               },
               yAxis: { type: 'value' },
               series: [{
                       type: 'bar',
                       label: {
                           show: true,
                           position: 'top',
                           // rotate: 0
                       }
                   },
                   {
                       type: 'bar',
                       label: {
                           show: true,
                           position: 'top'
                       }
                   },
                   {
                       type: 'bar',
                       label: {
                           show: true,
                           position: 'top'
                       }
                   },
               ]
           };
           var i = 1;
           setInterval(function () {
               if(i < data.length) {
                   var data0 = option.dataset.source;
                   var { fname, msale, price, total } = data[i++];
                   s = [fname, msale, price, total];
                   data0.shift();
                   data0.push(s);
                   myChart.hideLoading();
                   myChart.setOption(option);
               }
           }, 1100);
       });
    
   
       $.getJSON('result', function (data) {
           option = {
               toolbox: {
                   feature: {
                       saveAsImage: {
                           name: 'wordCloud',
                           type: 'jpg'
                       }
                   }
               },
               series: {
                   type: 'wordCloud',
                   gridSize: 2,
                   sizeRange: [12, 50],
                   rotationRange: [-90, 90],
                   shape: 'pentagon',
                   textStyle: {
                       normal: {
                           color: function () {
                               return 'rgb(' + [
                                   Math.round(Math.random() * 255),
                                   Math.round(Math.random() * 255),
                                   Math.round(Math.random() * 255)
                               ].join(',') + ')';
                           }
                       },
                       emphasis: {
                           shadowBlur: 10,
                           shadowColor: '#333'
                       }
                   },
                   data: data
               }
           }
           chart.setOption(option);
       });
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org
For additional commands, e-mail: dev-h...@echarts.apache.org

Reply via email to