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

vue-mapboxgl-components

v1.2.14

Published

>基于 [Vue](https://cn.vuejs.org/index.html) 和 [Mapbox-gl](https://www.mapbox.com/mapbox-gl-js/api/) 的地理信息可视化组件库

Downloads

49

Readme

基于 VueMapbox-gl 的地理信息可视化组件库

快速开始

安装依赖


可以通过 npm 添加依赖

  npm i vue-mapboxgl-components --save

或者通过 yarn 添加依赖

  yarn add vue-mapboxgl-components

引入


在 Vue 项目的 main.js 中写入以下内容:

import Vue from 'vue'
<!-- 引入组件的JavaScript文件 -->
import 'vue-mapboxgl-components'
<!-- 引入组件的CSS文件,如果没有CSS,Popups和Markers等元素将无效。 -->
import 'vue-mapboxgl-components/lib/vue-mapboxgl-components.css'
import App from './App.vue'

Vue.config.productionTip = false

new Vue({
  render: h => h(App)
}).$mount('#app')

以上代码便完成了 vue-mapboxgl-components 的引入。

开始使用


开发环境已经搭建完毕,在需要使用可视化图表的页面通过 html 标签的形式使用,如:

<template>
  <div id="app">
    <mapview :map-config="mapConfig" :osm-config="osmConfig"
      :map-types="mapTypes" :line="lineData" :point="pointData"
      @pointClick="callback">
      <!-- markers、popup、control的配置在详细文档中有说明 -->
      <!-- <markers ... ></markers> -->
      <!-- <popup ... ></popup> -->
      <!-- <control ... ></control> -->
    </mapview>
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {
      mapConfig: {
        <!-- 中心点 -->
        center: [120.142577, 30.27719],
        <!-- 缩放等级 -->
        zoom: 5,
        <!-- 视角俯视的倾斜角度 -->
        pitch: 0,
        <!-- 地图的旋转角度 -->
        bearing: 0,
        <!-- 地图的最小缩放等级 -->
        maxZoom: 0,
        <!-- 地图的最大缩放等级 -->
        minZoom: 22
      },
      osmConfig: {
        <!-- osm地址 -->
        osmUrl: 'http://xxx.xxx.xxx.xxx:8700',
        <!-- 地图样式 -->
        backgroundStyle: 'custombrightstyle'
      },
      <!-- 地图的可视化类型 -->
      mapTypes: ['line', 'point'],
      <!-- 线配置项 -->
      lineConfig: {
        color: 'green',
        width: 3,
        opacity: 0.5,
        useCurve: true,
        showAnimation: true,
        data: [
          [{ lng: 122, lat: 40 }, { lng: 120, lat: 30 }],
          [{ lng: 110, lat: 36 }, { lng: 120, lat: 30 }]
        ]
      },
      <!-- 点配置项 -->
      pointConfig: {
        useMultiColor: false,
        color: 'orange',
        textColor: 'red',
        showAnimation: true,
        opacity: 0.8,
        radius: 20,
        textOffset: 1,
        data: [
          { lng: 122, lat: 40, value: 10, name: '地点1' },
          { lng: 110, lat: 36, value: 30, name: '地点2' },
          { lng: 120, lat: 30, value: 10, name: '地点3' }
        ]
      }
    }
  },
  methods: {
    <!-- 响应事件 -->
    callback (data) {
      console.log(data)
    }
  }
}
</script>

<style lang="less">
html,body{
  margin: 0;
  width: 100%;
  height: 100%;
}
#app {
  width: 100%;
  height: 100%;
}
</style>

动态点和动态连线

案例

使用heatmap实现热力图

使用heatmap实现热力图

使用markers实现自定义点图

使用markers实现自定义点图