1.1.9 • Published 3 years ago

vue-legend v1.1.9

Weekly downloads
13
License
MIT
Repository
github
Last release
3 years ago

vue-legend

Demo

demo

Usage

Download the library:

npm install vue-legend

Import the library for your project:

import Vue from 'vue';
import vueLegend from 'vue-legend';

Vue.use( vueLegend );

props

参数说明类型可选值默认值
value / v-model绑定值Object--
data图例数据Array-[]
option图例配置Object-{}
editable是否显示配置图标Booleantrue / falsefalse

option

option = {
  show: false,
  type: 'scroll', // plain: 普通图例 / scroll: 滚动图例
  orient: 'vertical', // horizontal: 横向图例 / vertical: 纵向图例
  /**
   * 图例容器的样式,标准写法 (position不可改,为absolute)
   * **/
  style: {
    cursor: 'pointer',
    padding: '10px'
  },
  itemGap: 10,
  animation: true, // 翻页是否需要动画
  animationDurationUpdate: 0.8, // 翻页动画时长,单位s
  /**
   * 图例标记的样式
   * **/
  tagStyle: {
    display: 'inline-block',
    verticalAlign: 'middle',
    borderWidth: '1px',
    height: '14px',
    lineHeight: '10px',
    padding: '1px',
    boxSizing: 'border-box',
    width: '25px',
    borderRadius: '3px',
    marginRight: '1px',
    textAlign: 'center'
  },
  /**
   * 图例标记选中的样式,为空的时候自动根据分类配置的颜色
   * **/
  activeTagStyle: {
    backgroundColor: '#c23531'
  },
  /**
   * 图例标记未选中的样式
   * **/
  inactiveTagStyle: {
    backgroundColor: '#ccc'
  },
  /**
   * 图例文字的样式
   * **/
  textStyle: {
    display: 'inline-block',
    verticalAlign: 'middle',
    height: '14px',
    lineHeight: '10px',
    padding: '1px',
    boxSizing: 'border-box',
    fontSize: '12px',
    color: '#333'
  },
  /**
   * 图例文字选中的样式,为空的时候自动根据分类配置的颜色
   * **/
  activeTextStyle: {},
  /**
   * 图例文字未选中的样式
   * **/
  inactiveTextStyle: {
    color: '#ccc'
  },
  formatter: string => string // 格式转换,翻译
}

data

data = ['分类1', '分类2']
data = [{
  name: '分类1', tagStyle, activeTagStyle, inactiveTagStyle, textStyle, activeTextStyle, inactiveTextStyle, formatter
}, {
  name: '分类2', tagStyle, activeTagStyle, inactiveTagStyle, textStyle, activeTextStyle, inactiveTextStyle, formatter
}]

events

事件名说明参数
change图例变化legendMode
setting图例配置图例样式
1.1.9

3 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago