You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/10/21 07:25:51 UTC

[GitHub] [echarts] Jeremyyang commented on issue #15817: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'regions')

Jeremyyang commented on issue #15817:
URL: https://github.com/apache/echarts/issues/15817#issuecomment-948332345


   the some error:Uncaught TypeError: Cannot read properties of undefined (reading 'regions')
   
   跑的是这里的示例: https://echarts.apache.org/examples/zh/editor.html?c=scatterGL-gps&gl=1
   
   ```
   <!DOCTYPE html>
   <html style="height: 100%">
   <head>
     <meta charset="utf-8">
   </head>
   
   <body style="height: 100%; margin: 0">
     <div id="container" style="height: 100%"></div>
   
     <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.1/dist/echarts.min.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts-gl/2.0.8/echarts-gl.min.js"></script>
   
     <script type="text/javascript">    
         var ROOT_PATH =
           'https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples';
         var app = {};
   
         var chartDom = document.getElementById('container');
         var myChart = echarts.init(chartDom);
         var option;
   
         var dataCount = 0;
         var CHUNK_COUNT = 230;
         // https://blog.openstreetmap.org/2012/04/01/bulk-gps-point-data/
         function fetchData(idx) {
           if (idx >= CHUNK_COUNT) {
             return;
           }
           var dataURL = ROOT_PATH + '/data/asset/data/gps/gps_' + idx + '.bin';
           var xhr = new XMLHttpRequest();
           xhr.open('GET', dataURL, true);
           xhr.responseType = 'arraybuffer';
           xhr.onload = function (e) {
             var rawData = new Int32Array(this.response);
             var data = new Float32Array(rawData.length);
             var addedDataCount = rawData.length / 2;
             for (var i = 0; i < rawData.length; i += 2) {
               data[i] = rawData[i + 1] / 1e7;
               data[i + 1] = rawData[i] / 1e7;
             }
             myChart.appendData({
               seriesIndex: 0,
               data: data
             });
             fetchData(idx + 1);
           };
           xhr.send();
         }
         option = {
           backgroundColor: '#000',
           title: {
             text: '10000000 GPS Points',
             left: 'center',
             textStyle: {
               color: '#fff'
             }
           },
           geo: {
             map: 'world',
             roam: true,
             label: {
               emphasis: {
                 show: false
               }
             },
             silent: true,
             itemStyle: {
               normal: {
                 areaColor: '#323c48',
                 borderColor: '#111'
               },
               emphasis: {
                 areaColor: '#2a333d'
               }
             }
           },
           series: [
             {
               name: '弱',
               type: 'scatterGL',
               progressive: 1e6,
               coordinateSystem: 'geo',
               symbolSize: 1,
               zoomScale: 0.002,
               blendMode: 'lighter',
               large: true,
               itemStyle: {
                 color: 'rgb(20, 15, 2)'
               },
               postEffect: {
                 enable: true
               },
               silent: true,
               dimensions: ['lng', 'lat'],
               data: new Float32Array()
             }
           ]
         };
         fetchData(0);
   
         option && myChart.setOption(option);
     </script>
   </body>
   
   </html>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org