You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "gy1016 (via GitHub)" <gi...@apache.org> on 2023/02/23 08:05:24 UTC

[GitHub] [echarts] gy1016 opened a new issue, #18302: [Bug] 属性“getModel”为私有属性,只能在类“ECharts”中访问。ts(2341)

gy1016 opened a new issue, #18302:
URL: https://github.com/apache/echarts/issues/18302

   ### Version
   
   5.4.1
   
   ### Link to Minimal Reproduction
   
   _No response_
   
   ### Steps to Reproduce
   
   useEffect(() => {
     const dom = document.getElementById("container")!;
     const myChart = echarts.init(dom, undefined, {
       renderer: "canvas",
       useDirtyRect: false,
     });
   
     const heatPoints: any[] = [];
   
     fetch("http://127.0.0.1:9999/query")
       .then((res) => res.json())
       .then(({ data }) => {
         for (let point of data)
           heatPoints.push([point.lng, point.lat, point.heat]);
         myChart.setOption({
           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",
               data: heatPoints,
               pointSize: 5,
               blurSize: 6,
             },
           ],
         });
        // [Bug] 属性“getModel”为私有属性,只能在类“ECharts”中访问。ts(2341)
         const bmap = myChart.**getModel**().getComponent("bmap").getBMap();
       });
   }, []);
   
   ### Current Behavior
   
   按照下面官网的这个例子,使用TS+React复现的时候,TS提示getModel是private方法
   https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap&version=5.4.1
   
   ### Expected Behavior
   
   getModel应该能够在myChart上使用
   
   ### Environment
   
   _No response_
   
   ### Any additional comments?
   
   _No response_


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


[GitHub] [echarts] daolanfler commented on issue #18302: [Bug] 属性“getModel”为私有属性,只能在类“ECharts”中访问。ts(2341)

Posted by "daolanfler (via GitHub)" <gi...@apache.org>.
daolanfler commented on issue #18302:
URL: https://github.com/apache/echarts/issues/18302#issuecomment-1590874961

   > `getModel` 方法确实没准备暴露给开发者,应该是 BMap 的相关文档应该更新,`as any` 可以解决这个报错吗?可以的话能麻烦给 [bmap/README.md](https://github.com/apache/echarts/blob/master/extension-src/bmap/README.md?rgh-link-date=2023-03-01T06%3A54%3A46Z) 提个 PR 修复一下文档吗?
   ![image](https://github.com/apache/echarts/assets/29777079/d94f2d79-6af1-4c3d-a91d-b4cfc6475bb1)
   可以解决这个报错。没有暴露 `getModel` 的话,那有其他办法能获取 bmap 实例吗?感觉这个操作还是挺常见的
   


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


[GitHub] [echarts] echarts-bot[bot] commented on issue #18302: [Bug] 属性“getModel”为私有属性,只能在类“ECharts”中访问。ts(2341)

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on issue #18302:
URL: https://github.com/apache/echarts/issues/18302#issuecomment-1441344364

   @gy1016 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
   <details><summary><b>TRANSLATED</b></summary><br>
   
   **TITLE**
   
   [Bug] The property "getModel" is private and can only be accessed in the class "ECharts". ts(2341)
   </details>


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


[GitHub] [echarts] Ovilia commented on issue #18302: [Bug] 属性“getModel”为私有属性,只能在类“ECharts”中访问。ts(2341)

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on issue #18302:
URL: https://github.com/apache/echarts/issues/18302#issuecomment-1449446083

   `getModel` 方法确实没准备暴露给开发者,应该是 BMap 的相关文档应该更新,`as any` 可以解决这个报错吗?可以的话能麻烦给 [bmap/README.md](https://github.com/apache/echarts/blob/master/extension-src/bmap/README.md) 提个 PR 修复一下文档吗?


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