npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tmap-echarts

v1.0.2

Published

在天地图4.0地图上展示echarts的图表

Downloads

24

Readme

tmap-echarts

Tmap-echarts是在天地图4.0图层上展示echarts图表的插件,通过实现自定义覆盖物完成图表的渲染,几乎支持echarts中的所有图表,包括3D图表。

相比盖一个div在地图上,自定义覆盖物可以更灵活的去展示想要的效果,能与地图更完美的结合。

甚至可以在上面再盖一个echarts的百度地图(未尝试过)

效果

如果见过这个:https://echarts.apache.org/examples/zh/editor.html?c=map-usa-pie 那应该很好理解该插件。

效果图

安装

npm i tmap-echarts -S

在线示例

Edit tmap-echarts-demo

使用教程

import("tmap-echarts").then(({ echartsOverlay }) => {
      const option = {
        tooltip: {
          trigger: "item",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: "50%",
            data: [
              { value: 1048, name: "Search Engine" },
              { value: 735, name: "Direct" },
              { value: 580, name: "Email" },
              { value: 484, name: "Union Ads" },
              { value: 300, name: "Video Ads" },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      };
      const overlay = new echartsOverlay(
        new window.T.LngLat(116.40769, 39.89945),
        {
          width: 300,
          echartsOptions: option,
          updateCallBack: (chartView, map) => {
            // console.log(chartView, map);
            // console.log(map.getZoom());
            // console.log(chartView.getDom());
            // console.log(this);
          },
        }
      );
      map.addOverLay(overlay);
    });

更新数据

// echarts的option
overlay.refreshEchartsOption(options)

// 或者获取echart视图
overlay.getChart().setOption(options)

获取echart视图

overlay.getChart()

隐藏/显示

// 隐藏
overlay.hide()
// 显示
overlay.show()

删除视图/销毁视图

map.removeOverLay(overlay)

配置项

| 参数 | 说明 | 类型 | 默认值 | | ------- | -------------------- | ------ | ------ | | lnglat | 放置图表的经纬度位置 | lnglat | 无 | | options | 配置对象 | object | {} |

options

| 参数 | 说明 | 类型 | 默认值 | | -------------- | ------------------------------------------------------------ | -------- | ------ | | echartsOptions | echarts图表的option | object | {} | | width | 容器的长 | Number | 200 | | Height | 容器的高 | Number | 200 | | index | 容器在地图中的层级 | Number | 无 | | isDisScale | 是否禁用自动缩放 | Boolean | false | | scaleNum | 自动缩放的比例系数计算方式为(zoom / 10) * this.width * this.scaleNum | Number | 1 | | updateCallBack | update的回调函数,返回参数(chartView, map)=> {} | Function | Null |

依赖

其他

博客:随机的布尔值

赞助

赞助一杯咖啡