一个2维的飞线组件2

效果图

2. FlyLine2 组件 - 图1

飞线使用

组件引入

  1. import Vue from 'vue'
  2. import {FlyLine2} from 'special-ui'
  3. Vue.use(FlyLine2)

组件使用

  1. <template>
  2. <div class="container">
  3. <fly-line2 :width="1820" :height="900" :dataset="data" :config="config"></fly-line2>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'App',
  9. data () {
  10. return {
  11. data: [
  12. {
  13. from: { x: 300, y: 300},
  14. to: { x: 700, y: 100},
  15. raduis: 0.5
  16. },
  17. {
  18. from: { x: 1200, y: 300},
  19. to: { x: 800, y: 100},
  20. raduis: 0.5
  21. },
  22. {
  23. from: { x: 1300, y: 100},
  24. to: { x: 1600, y: 300},
  25. raduis: -0.5
  26. }
  27. ],
  28. config: {
  29. //marker点半径
  30. // markerRadius: 2,
  31. //marker点颜色,为空或null则默认取线条颜色
  32. // markerColor: null,
  33. // 线条类型 solid、dashed; 有lineDash并且设值则dashed
  34. lineDash: [5, 4],
  35. //线条宽度
  36. lineWidth: 1,
  37. //线条颜色
  38. colors: ['#F9815C', '#F8AB60', '#EDCC72', '#E2F194', '#94E08A', '#4ECDA5'],
  39. //移动点半径
  40. moveRadius: 3,
  41. //移动点颜色
  42. fillColor: '#fff',
  43. //移动点阴影颜色
  44. shadowColor: '#fff',
  45. //移动点阴影大小
  46. shadowBlur: 2
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. .container {
  54. height: 100%;
  55. }
  56. </style>

组件参数

属性 说明 默认值
width 画布宽度 0
height 画布高度 0
dataset 飞线数组 []
config 飞线参数配置 {}

config: 数组

属性 说明 默认值
markerRadius marker点半径 3, 为0则没有圆点显示
markerColor marker颜色 null, 不设置则和线条颜色一致
lineWidth 线条宽度 1
lineDash 虚线设置 [], 为空数组则显示实线
colors 飞线颜色 []
moveRadius 移动点半径 3
fillColor 移动点颜色 ‘#fff’
shadowColor 移动点阴影颜色 ‘#fff’
shadowColor 移动点阴影颜色 ‘#fff’
shadowBlur 移动点阴影大小 5