Git Product home page Git Product logo

leaflet.migration's Introduction

leaflet.migration

leaflet plugin that provides migration lines layer.

alt text

Installation

npm install -S leaflet.migration

Rquirements

  • leaflet ^1.5.1
  • node 10.8.0

Usage

import 'leflet.migration';
const data = [{
  labels: ['from', 'to'],
  from: [lat, lng],
  to: [lat, lng],
  color: '',
  value: ''
}];
const migrationLayer = L.migrationLayer(data, {
  pulseRadius: 10,
  arcWidth: 1,
  label: true,
}).addTo(map);

migrationLayer.setStyle({ pulse: { radius: 20 }})
migrationLayer.setData([])
map.remove(migrationLayer)

API

Data

type description
[<MigrationData>] migration data list

MigrationData

attribute type description
labels [<string>from, <string> to] label
from [<number>lat, <number>lng] from label latlng
from [<number>lat, <number>lng] to label latlng
color string the color of each arc and pulse
value number intense value of migration line

Options|Style

option type default description
pulseRadius number 10 pulse max radius, pulse radius from 3 to this value
arcWidth number 1 arc border width
label boolean true set it to false if you don't want show label

Options|EventHandler

method returns description
replacePopover(<pixel>x, <pixel>y, <MigrationData>data, <integer>index) Element replace default popover by return element
onShowPopover(<MigrationData>data, <integer>index) none called on mouse hover pulse
onHidePopover(<integer>index) none called on mouse leave pulse

Methods

method returns descrition
setData([<MigrationData>]) this update migration data
setStyle(options) this update style
show() this show layer
hide() this hide layer
play() this run animate of arc and pulse
pause() this pause animate of arc and pulse

Methods inherited from L.Layer

method returns descrition
onAdd(<Map> map) this called on L.migrationLayer(data, style).addTo(map)
onRemove(<Map> map) this called on map.remove(migrationLayer)

Development

feature list

2.0.1

  • fix spark cannot move

2.0.0

  • accomplish setData/setStyle
  • accomplish addTo and remove function
  • update init options
  • add demo to gh-pages
  • customize popover

1.1.0

  • update return value of new MigrationLayer()

1.0.3

  • set pulse size by data value, radius, zoom

1.0.0

  • add webpack
  • add popover
  • config data, style
  • layer.setData

leaflet.migration's People

Contributors

dependabot[bot] avatar lin-123 avatar tbswang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.