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/18 16:36:22 UTC

[GitHub] [echarts] kirincc edited a comment on issue #13894: [bug] heatmap in geo

kirincc edited a comment on issue #13894:
URL: https://github.com/apache/echarts/issues/13894#issuecomment-945953305


   > @kirinc [heatmap-geo.html](https://github.com/apache/echarts/files/7360114/heatmap-geo.html.txt) 注意去掉文件扩展名中的 .txt
   
   非常感谢,自定义 registerMap 地图的效果我参考makepie的配置已经实现。
   有一个新问题,不知是否需要提起新issue?
   
   官网的热力图demo:https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap
   我在本地使用ant-design-proV5.0.0 +  echartsV5.2.1/V4.9.0,都会存在同一个报错(如图)。
   ![image](https://user-images.githubusercontent.com/16648064/137772373-a5407257-e8f6-47b7-9289-57e1084ca90c.png)
   ![image](https://user-images.githubusercontent.com/16648064/137771407-09da086c-a2ca-4351-933d-267798424a3f.png)
   
   核心代码如下:不知是否能指出错误所在,或者需要我提供一个codesandbox
   
   ```js
   import React, { useEffect } from "react";
   import * as echarts from "echarts";
   import { VisualMapComponent } from "echarts/components";
   import { HeatmapChart } from "echarts/charts";
   import { CanvasRenderer } from "echarts/renderers";
   import { loadBaiduMap } from "../utils";
   
   echarts.use([VisualMapComponent, HeatmapChart, CanvasRenderer]);
   
   const BigScreen = () => {
     useEffect(() => {
       loadBaiduMap().then(BMap => {
         const chartDom = document.getElementById("myChartChina");
         if (!chartDom) return;
   
         const myChart = echarts.init(chartDom);
         const option = {
           animation: false,
           bmap: {
             center: [120.13066322374, 30.240018034923],
             zoom: 14,
             roam: true,
           },
           visualMap: {
             show: false,
             top: "top",
             min: 0,
             max: 5,
             seriesIndex: 0,
             calculable: true,
             inRange: {
               color: ["blue", "blue", "green", "yellow", "red"],
             },
           },
           series: [
             {
               type: "heatmap",
               coordinateSystem: "bmap",
               pointSize: 5,
               blurSize: 6,
               data: [
                 [120.14322240845, 30.236064370321, 1],
                 [120.14280555506, 30.23633761213, 1],
                 [120.14307598649, 30.236125905084, 1],
                 [120.14301682797, 30.236035316745, 1],
                 [120.1428734612, 30.236160551632, 1],
                 [120.14200215328, 30.23595702204, 1],
                 [120.14138577045, 30.236113748704, 1],
                 [120.1400398833, 30.235973050702, 1],
                 [120.13893453465, 30.23517220446, 1],
                 [120.1382899739, 30.234062922977, 1],
                 [116.316492, 39.9503, 1200],
                 [114.470789, 38.037838, 10200],
                 [126.467859, 45.681738, 20200],
                 [123.567469, 41.777989, 30200],
                 [125.325281, 43.872672, 40200],
                 [123.567469, 41.777989, 50200],
                 [101.726648, 36.534489, 60200],
                 [91.047937, 29.69583, 70200],
                 [87.83993, 43.682293, 80200],
                 [106.604578, 26.675096, 90200],
               ],
             },
           ],
         };
   
         myChart.setOption(option);
   
         // 添加百度地图插件
         let bmap = myChart.getModel().getComponent("bmap").getBMap();
         bmap.addControl(new BMap.MapTypeControl());
       });
     }, []);
   
     return (
       <div id="myChartChina" style={{ height: 500 }}></div>
     );
   };
   
   export default BigScreen;
   ```


-- 
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