Compare commits
66 Commits
V2.7.1-alp
...
V2.9.2-alp
Author | SHA1 | Date | |
---|---|---|---|
9b84417f01 | |||
86da84af2e | |||
1ea106fd83 | |||
7491b34711 | |||
a2875684ce | |||
f581aee5c3 | |||
3f5148cea3 | |||
e270fadcd2 | |||
beaef5c59a | |||
b17399416a | |||
5f3fdfc798 | |||
e7c237cbac | |||
3d3de766e3 | |||
330815d90a | |||
4f6fc240d2 | |||
1d0f369509 | |||
ea058a90c3 | |||
934e3f314a | |||
eea32d7e39 | |||
7dd7baebba | |||
4a7fdf0c1c | |||
53991795a0 | |||
dde29fa61a | |||
c82b979432 | |||
e938b66dc0 | |||
71a9be2a13 | |||
f0432e4c42 | |||
65f5b529bf | |||
054854480a | |||
6ce83e1fd8 | |||
8e5f279b6e | |||
22afc8e787 | |||
eb78915c93 | |||
22c88c4ea5 | |||
c98ca00179 | |||
c257ca6d9c | |||
ce4cf0d342 | |||
7df0c0247a | |||
df2369dfe4 | |||
db52e8cdc0 | |||
f8e438b0c4 | |||
1a13bc08c5 | |||
ba90fb2faa | |||
7799ef3dae | |||
33456176f7 | |||
dd37ba167a | |||
fdd1e243a7 | |||
57b6c726eb | |||
be410da013 | |||
d4206f066c | |||
73a5084c0e | |||
9a039b3f10 | |||
5ee1d408b6 | |||
419fa0c3a9 | |||
d2bb06a36c | |||
94824f32d8 | |||
b99410ef94 | |||
4b69668327 | |||
d15bcf34cb | |||
43a04efb62 | |||
81b8bef8e1 | |||
6467bd516f | |||
62c5998938 | |||
247221729f | |||
c48aa8ee84 | |||
b18962855c |
67
CHANGELOG.md
67
CHANGELOG.md
@ -1,3 +1,70 @@
|
|||||||
|
# 2.9.2-alpha (2020-06-16)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- **scrollBoard:** reset animationIndex when config upate.
|
||||||
|
|
||||||
|
# 2.9.1-alpha (2020-06-16)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- **scrollRankingBoard:** Calculation optimization of negative values. [(#101)](https://github.com/DataV-Team/DataV/pull/101).
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **digitalFlop:** add number formatter.
|
||||||
|
|
||||||
|
# 2.9.0-alpha (2020-06-10)
|
||||||
|
|
||||||
|
### ScrollBoard
|
||||||
|
|
||||||
|
- **hoverPause:** add `hoverPause` configuration [(#96)](https://github.com/DataV-Team/DataV/pull/96).
|
||||||
|
- **mouseover:** add `mouseover` event [(#96)](https://github.com/DataV-Team/DataV/pull/96).
|
||||||
|
|
||||||
|
# 2.8.4-alpha (2020-05-25)
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **uuid:** Use uuid to produce unique id.
|
||||||
|
|
||||||
|
# 2.8.3-alpha (2020-05-06)
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **activeRingChart:** add `showOriginValue` configuration.
|
||||||
|
- **capsuleChart:** add `showValue` configuration.
|
||||||
|
|
||||||
|
# 2.8.2-alpha (2020-05-06)
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **borderBox8:** add `reverse` configuration.
|
||||||
|
|
||||||
|
# 2.8.1-alpha (2020-05-03)
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **digitalFlop:** Use `\n` to start a newline.
|
||||||
|
- **digitalFlop:** `rowGap` configuration.
|
||||||
|
|
||||||
|
# 2.7.4-alpha (2020-04-15)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- **capsuleChart:** Calculate exception when min value is less 5 [(#59)](https://github.com/DataV-Team/DataV/pull/59).
|
||||||
|
|
||||||
|
# 2.7.3-alpha (2020-01-16)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- **activeRingChart:** `parseInt` precision lost.
|
||||||
|
|
||||||
|
# 2.7.2-alpha (2020-01-10)
|
||||||
|
|
||||||
|
### Perfect
|
||||||
|
|
||||||
|
- **ativeRingChart:** Add digitalFlopToFixed configuration.
|
||||||
|
|
||||||
# 2.7.1-alpha (2020-01-08)
|
# 2.7.1-alpha (2020-01-08)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
1548
dist/datav.map.vue.js
vendored
1548
dist/datav.map.vue.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/datav.min.vue.js
vendored
2
dist/datav.min.vue.js
vendored
File diff suppressed because one or more lines are too long
@ -28,7 +28,7 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
@ -78,6 +78,11 @@ export default {
|
|||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
fill: '#fff'
|
fill: '#fff'
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @description Digital flop toFixed
|
||||||
|
* @type {Number}
|
||||||
|
*/
|
||||||
|
digitalFlopToFixed: 0,
|
||||||
/**
|
/**
|
||||||
* @description CRender animationCurve
|
* @description CRender animationCurve
|
||||||
* @type {String}
|
* @type {String}
|
||||||
@ -89,7 +94,13 @@ export default {
|
|||||||
* @type {String}
|
* @type {String}
|
||||||
* @default animationFrame = 50
|
* @default animationFrame = 50
|
||||||
*/
|
*/
|
||||||
animationFrame: 50
|
animationFrame: 50,
|
||||||
|
/**
|
||||||
|
* @description showOriginValue
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default showOriginValue = false
|
||||||
|
*/
|
||||||
|
showOriginValue: false
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
@ -102,33 +113,47 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
digitalFlop () {
|
digitalFlop() {
|
||||||
const { mergedConfig, activeIndex } = this
|
const { mergedConfig, activeIndex } = this
|
||||||
|
|
||||||
if (!mergedConfig) return {}
|
if (!mergedConfig) return {}
|
||||||
|
|
||||||
const { digitalFlopStyle, data } = mergedConfig
|
const {
|
||||||
|
digitalFlopStyle,
|
||||||
|
digitalFlopToFixed,
|
||||||
|
data,
|
||||||
|
showOriginValue
|
||||||
|
} = mergedConfig
|
||||||
|
|
||||||
const value = data.map(({ value }) => value)
|
const value = data.map(({ value }) => value)
|
||||||
|
|
||||||
const sum = value.reduce((all, v) => all + v, 0)
|
let displayValue
|
||||||
|
|
||||||
const percent = parseInt(value[activeIndex] / sum * 100) || 0
|
if (showOriginValue) {
|
||||||
|
displayValue = value[activeIndex]
|
||||||
|
} else {
|
||||||
|
const sum = value.reduce((all, v) => all + v, 0)
|
||||||
|
|
||||||
|
const percent = parseFloat((value[activeIndex] / sum) * 100) || 0
|
||||||
|
|
||||||
|
displayValue = percent
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: '{nt}%',
|
content: showOriginValue ? '{nt}' : '{nt}%',
|
||||||
number: [percent],
|
number: [displayValue],
|
||||||
style: digitalFlopStyle
|
style: digitalFlopStyle,
|
||||||
|
toFixed: digitalFlopToFixed
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ringName () {
|
ringName() {
|
||||||
const { mergedConfig, activeIndex } = this
|
const { mergedConfig, activeIndex } = this
|
||||||
|
|
||||||
if (!mergedConfig) return ''
|
if (!mergedConfig) return ''
|
||||||
|
|
||||||
return mergedConfig.data[activeIndex].name
|
return mergedConfig.data[activeIndex].name
|
||||||
},
|
},
|
||||||
fontSize () {
|
fontSize() {
|
||||||
const { mergedConfig } = this
|
const { mergedConfig } = this
|
||||||
|
|
||||||
if (!mergedConfig) return ''
|
if (!mergedConfig) return ''
|
||||||
@ -137,7 +162,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
config () {
|
config() {
|
||||||
const { animationHandler, mergeConfig, setRingOption } = this
|
const { animationHandler, mergeConfig, setRingOption } = this
|
||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
@ -150,7 +175,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init () {
|
init() {
|
||||||
const { initChart, mergeConfig, setRingOption } = this
|
const { initChart, mergeConfig, setRingOption } = this
|
||||||
|
|
||||||
initChart()
|
initChart()
|
||||||
@ -159,17 +184,20 @@ export default {
|
|||||||
|
|
||||||
setRingOption()
|
setRingOption()
|
||||||
},
|
},
|
||||||
initChart () {
|
initChart() {
|
||||||
const { $refs } = this
|
const { $refs } = this
|
||||||
|
|
||||||
this.chart = new Charts($refs['active-ring-chart'])
|
this.chart = new Charts($refs['active-ring-chart'])
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig() {
|
||||||
const { defaultConfig, config } = this
|
const { defaultConfig, config } = this
|
||||||
|
|
||||||
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
this.mergedConfig = deepMerge(
|
||||||
|
deepClone(defaultConfig, true),
|
||||||
|
config || {}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
setRingOption () {
|
setRingOption() {
|
||||||
const { getRingOption, chart, ringAnimation } = this
|
const { getRingOption, chart, ringAnimation } = this
|
||||||
|
|
||||||
const option = getRingOption()
|
const option = getRingOption()
|
||||||
@ -178,7 +206,7 @@ export default {
|
|||||||
|
|
||||||
ringAnimation()
|
ringAnimation()
|
||||||
},
|
},
|
||||||
getRingOption () {
|
getRingOption() {
|
||||||
const { mergedConfig, getRealRadius } = this
|
const { mergedConfig, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
@ -200,7 +228,7 @@ export default {
|
|||||||
color: mergedConfig.color
|
color: mergedConfig.color
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRealRadius (active = false) {
|
getRealRadius(active = false) {
|
||||||
const { mergedConfig, chart } = this
|
const { mergedConfig, chart } = this
|
||||||
|
|
||||||
const { radius, activeRadius, lineWidth } = mergedConfig
|
const { radius, activeRadius, lineWidth } = mergedConfig
|
||||||
@ -211,14 +239,15 @@ export default {
|
|||||||
|
|
||||||
let realRadius = active ? activeRadius : radius
|
let realRadius = active ? activeRadius : radius
|
||||||
|
|
||||||
if (typeof realRadius !== 'number') realRadius = parseInt(realRadius) / 100 * maxRadius
|
if (typeof realRadius !== 'number')
|
||||||
|
realRadius = (parseInt(realRadius) / 100) * maxRadius
|
||||||
|
|
||||||
const insideRadius = realRadius - halfLineWidth
|
const insideRadius = realRadius - halfLineWidth
|
||||||
const outSideRadius = realRadius + halfLineWidth
|
const outSideRadius = realRadius + halfLineWidth
|
||||||
|
|
||||||
return [insideRadius, outSideRadius]
|
return [insideRadius, outSideRadius]
|
||||||
},
|
},
|
||||||
ringAnimation () {
|
ringAnimation() {
|
||||||
let { activeIndex, getRingOption, chart, getRealRadius } = this
|
let { activeIndex, getRingOption, chart, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
@ -251,12 +280,12 @@ export default {
|
|||||||
}, activeTimeGap)
|
}, activeTimeGap)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
const { init } = this
|
const { init } = this
|
||||||
|
|
||||||
init()
|
init()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy() {
|
||||||
const { animationHandler } = this
|
const { animationHandler } = this
|
||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-1">
|
<div class="dv-border-box-1" :ref="ref">
|
||||||
|
<svg class="border" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`10, 27 10, ${height - 27} 13, ${height - 24} 13, ${height - 21} 24, ${height - 11}
|
||||||
|
38, ${height - 11} 41, ${height - 8} 73, ${height - 8} 75, ${height - 10} 81, ${height - 10}
|
||||||
|
85, ${height - 6} ${width - 85}, ${height - 6} ${width - 81}, ${height - 10} ${width - 75}, ${height - 10}
|
||||||
|
${width - 73}, ${height - 8} ${width - 41}, ${height - 8} ${width - 38}, ${height - 11}
|
||||||
|
${width - 24}, ${height - 11} ${width - 13}, ${height - 21} ${width - 13}, ${height - 24}
|
||||||
|
${width - 10}, ${height - 27} ${width - 10}, 27 ${width - 13}, 25 ${width - 13}, 21
|
||||||
|
${width - 24}, 11 ${width - 38}, 11 ${width - 41}, 8 ${width - 73}, 8 ${width - 75}, 10
|
||||||
|
${width - 81}, 10 ${width - 85}, 6 85, 6 81, 10 75, 10 73, 8 41, 8 38, 11 24, 11 13, 21 13, 24`" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="150px"
|
width="150px"
|
||||||
height="150px"
|
height="150px"
|
||||||
@ -52,20 +63,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DvBorderBox1',
|
name: 'DvBorderBox1',
|
||||||
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
ref: 'border-box-1',
|
||||||
|
|
||||||
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
||||||
|
|
||||||
defaultColor: ['#4fd2dd', '#235fa7'],
|
defaultColor: ['#4fd2dd', '#235fa7'],
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-10" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
<div class="dv-border-box-10" :ref="ref" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
||||||
|
<svg class="border" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
4, 0 ${width - 4}, 0 ${width}, 4 ${width}, ${height - 4} ${width - 4}, ${height}
|
||||||
|
4, ${height} 0, ${height - 4} 0, 4
|
||||||
|
`" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="150px"
|
width="150px"
|
||||||
height="150px"
|
height="150px"
|
||||||
@ -20,20 +27,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DvBorderBox10',
|
name: 'DvBorderBox10',
|
||||||
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
ref: 'border-box-10',
|
||||||
|
|
||||||
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
||||||
|
|
||||||
defaultColor: ['#1d48c4', '#d3e1f8'],
|
defaultColor: ['#1d48c4', '#d3e1f8'],
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
</filter>
|
</filter>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
20, 32 ${width * 0.5 - titleWidth / 2}, 32 ${width * 0.5 - titleWidth / 2 + 20}, 53
|
||||||
|
${width * 0.5 + titleWidth / 2 - 20}, 53 ${width * 0.5 + titleWidth / 2}, 32
|
||||||
|
${width - 20}, 32 ${width - 8}, 48 ${width - 8}, ${height - 25} ${width - 20}, ${height - 8}
|
||||||
|
20, ${height - 8} 8, ${height - 25} 8, 50
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:filter="`url(#${filterId})`"
|
:filter="`url(#${filterId})`"
|
||||||
@ -209,6 +216,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -231,13 +239,17 @@ export default {
|
|||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-11',
|
ref: 'border-box-11',
|
||||||
filterId: `borderr-box-11-filterId-${timestamp}`,
|
filterId: `border-box-11-filterId-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#8aaafb', '#1f33a2'],
|
defaultColor: ['#8aaafb', '#1f33a2'],
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<path
|
<path
|
||||||
v-if="width && height"
|
v-if="width && height"
|
||||||
fill="transparent"
|
:fill="backgroundColor"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:d="`
|
:d="`
|
||||||
@ -92,6 +92,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -106,13 +107,17 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = +new Date()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-12',
|
ref: 'border-box-12',
|
||||||
filterId: `borderr-box-12-filterId-${timestamp}`,
|
filterId: `borderr-box-12-filterId-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#2e6099', '#7ce7fd'],
|
defaultColor: ['#2e6099', '#7ce7fd'],
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="dv-border-box-13" :ref="ref">
|
<div class="dv-border-box-13" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
<path
|
<path
|
||||||
fill="transparent"
|
:fill="backgroundColor"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:d="`
|
:d="`
|
||||||
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
||||||
@ -54,10 +54,13 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = +new Date()
|
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-13',
|
ref: 'border-box-13',
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-2" :ref="ref">
|
<div class="dv-border-box-2" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
7, 7 ${width - 7}, 7 ${width - 7}, ${height - 7} 7, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`2, 2 ${width - 2} ,2 ${width - 2}, ${height - 2} 2, ${height - 2} 2, 2`"
|
:points="`2, 2 ${width - 2} ,2 ${width - 2}, ${height - 2} 2, ${height - 2} 2, 2`"
|
||||||
@ -35,6 +39,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-3" :ref="ref">
|
<div class="dv-border-box-3" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
23, 23 ${width - 24}, 23 ${width - 24}, ${height - 24} 23, ${height - 24}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline class="dv-bb3-line1"
|
<polyline class="dv-bb3-line1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`4, 4 ${width - 22} ,4 ${width - 22}, ${height - 22} 4, ${height - 22} 4, 4`"
|
:points="`4, 4 ${width - 22} ,4 ${width - 22}, ${height - 22} 4, ${height - 22} 4, 4`"
|
||||||
@ -39,6 +43,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-4" :ref="ref">
|
<div class="dv-border-box-4" :ref="ref">
|
||||||
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
${width - 15}, 22 170, 22 150, 7 40, 7 28, 21 32, 24
|
||||||
|
16, 42 16, ${height - 32} 41, ${height - 7} ${width - 15}, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline class="dv-bb4-line-1"
|
<polyline class="dv-bb4-line-1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`145, ${height - 5} 40, ${height - 5} 10, ${height - 35}
|
:points="`145, ${height - 5} 40, ${height - 5} 10, ${height - 35}
|
||||||
@ -46,6 +51,10 @@ export default {
|
|||||||
reverse: {
|
reverse: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-5" :ref="ref">
|
<div class="dv-border-box-5" :ref="ref">
|
||||||
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
10, 22 ${width - 22}, 22 ${width - 22}, ${height - 86} ${width - 84}, ${height - 24} 10, ${height - 24}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
class="dv-bb5-line-1"
|
class="dv-bb5-line-1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
@ -43,6 +47,10 @@ export default {
|
|||||||
reverse: {
|
reverse: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-6" :ref="ref">
|
<div class="dv-border-box-6" :ref="ref">
|
||||||
<svg class="dv-svg-container" :width="width" :height="height">
|
<svg class="dv-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
9, 7 ${width - 9}, 7 ${width - 9}, ${height - 7} 9, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<circle :fill="mergedColor[1]" cx="5" cy="5" r="2"/>
|
<circle :fill="mergedColor[1]" cx="5" cy="5" r="2"/>
|
||||||
<circle :fill="mergedColor[1]" :cx="width - 5" cy="5" r="2" />
|
<circle :fill="mergedColor[1]" :cx="width - 5" cy="5" r="2" />
|
||||||
<circle :fill="mergedColor[1]" :cx="width - 5" :cy="height - 5" r="2" />
|
<circle :fill="mergedColor[1]" :cx="width - 5" :cy="height - 5" r="2" />
|
||||||
@ -39,6 +43,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="dv-border-box-7"
|
class="dv-border-box-7"
|
||||||
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}`"
|
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}; background-color: ${backgroundColor}`"
|
||||||
:ref="ref"
|
:ref="ref"
|
||||||
>
|
>
|
||||||
<svg class="dv-svg-container" :width="width" :height="height">
|
<svg class="dv-svg-container" :width="width" :height="height">
|
||||||
@ -37,6 +37,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<defs>
|
<defs>
|
||||||
<path
|
<path
|
||||||
:id="path"
|
:id="path"
|
||||||
:d="`M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`"
|
:d="pathD"
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
/>
|
/>
|
||||||
<radialGradient
|
<radialGradient
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
|
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
|
||||||
<animateMotion
|
<animateMotion
|
||||||
:dur="`${dur}s`"
|
:dur="`${dur}s`"
|
||||||
:path="`M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`"
|
:path="pathD"
|
||||||
rotate="auto"
|
rotate="auto"
|
||||||
repeatCount="indefinite"
|
repeatCount="indefinite"
|
||||||
/>
|
/>
|
||||||
@ -33,6 +33,8 @@
|
|||||||
</mask>
|
</mask>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`5, 5 ${width - 5}, 5 ${width - 5} ${height - 5} 5, ${height - 5}`" />
|
||||||
|
|
||||||
<use
|
<use
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
stroke-width="1"
|
stroke-width="1"
|
||||||
@ -63,6 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -79,15 +82,23 @@ export default {
|
|||||||
dur: {
|
dur: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 3
|
default: 3
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
|
},
|
||||||
|
reverse: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-8',
|
ref: 'border-box-8',
|
||||||
path: `border-box-8-path-${timestamp}`,
|
path: `border-box-8-path-${id}`,
|
||||||
gradient: `border-box-8-gradient-${timestamp}`,
|
gradient: `border-box-8-gradient-${id}`,
|
||||||
mask: `border-box-8-mask-${timestamp}`,
|
mask: `border-box-8-mask-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#235fa7', '#4fd2dd'],
|
defaultColor: ['#235fa7', '#4fd2dd'],
|
||||||
|
|
||||||
@ -99,6 +110,13 @@ export default {
|
|||||||
const { width, height } = this
|
const { width, height } = this
|
||||||
|
|
||||||
return (width + height - 5) * 2
|
return (width + height - 5) * 2
|
||||||
|
},
|
||||||
|
pathD () {
|
||||||
|
const { reverse, width, height } = this
|
||||||
|
|
||||||
|
if (reverse) return `M 2.5, 2.5 L 2.5, ${height - 2.5} L ${width - 2.5}, ${height - 2.5} L ${width - 2.5}, 2.5 L 2.5, 2.5`
|
||||||
|
|
||||||
|
return `M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -105,6 +105,15 @@
|
|||||||
</mask>
|
</mask>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
15, 9 ${width * 0.1 + 1}, 9 ${width * 0.1 + 4}, 6 ${width * 0.52 + 2}, 6
|
||||||
|
${width * 0.52 + 6}, 10 ${width * 0.58 - 7}, 10 ${width * 0.58 - 2}, 6
|
||||||
|
${width * 0.9 + 2}, 6 ${width * 0.9 + 6}, 10 ${width - 10}, 10 ${width - 10}, ${height * 0.1 - 6}
|
||||||
|
${width - 6}, ${height * 0.1 - 1} ${width - 6}, ${height * 0.8 + 1} ${width - 10}, ${height * 0.8 + 6}
|
||||||
|
${width - 10}, ${height - 10} ${width * 0.92 + 7}, ${height - 10} ${width * 0.92 + 2}, ${height - 6}
|
||||||
|
11, ${height - 6} 11, ${height * 0.15 - 2} 15, ${height * 0.15 - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
|
<rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
@ -116,6 +125,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -128,15 +138,19 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-9',
|
ref: 'border-box-9',
|
||||||
|
|
||||||
gradientId: `border-box-9-gradient-${timestamp}`,
|
gradientId: `border-box-9-gradient-${id}`,
|
||||||
maskId: `border-box-9-mask-${timestamp}`,
|
maskId: `border-box-9-mask-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#11eefd', '#0078d2'],
|
defaultColor: ['#11eefd', '#0078d2'],
|
||||||
|
|
||||||
|
@ -31,19 +31,27 @@
|
|||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
.dv-capsule-chart .capsule-item div {
|
.dv-capsule-chart .capsule-item .capsule-item-column {
|
||||||
|
position: relative;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.dv-capsule-chart .capsule-item .capsule-item-column .capsule-item-value {
|
||||||
|
font-size: 12px;
|
||||||
|
transform: translateX(100%);
|
||||||
}
|
}
|
||||||
.dv-capsule-chart .unit-label {
|
.dv-capsule-chart .unit-label {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.dv-capsule-chart .unit-text {
|
.dv-capsule-chart .unit-text {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
@ -7,16 +7,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="capsule-container">
|
<div class="capsule-container">
|
||||||
<div
|
<div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
|
||||||
class="capsule-item"
|
<div
|
||||||
v-for="(capsule, index) in capsuleLength"
|
class="capsule-item-column"
|
||||||
:key="index"
|
:style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
|
||||||
>
|
>
|
||||||
<div :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"></div>
|
<div
|
||||||
|
v-if="mergedConfig.showValue"
|
||||||
|
class="capsule-item-value"
|
||||||
|
>{{ capsuleValue[index] }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="unit-label">
|
<div class="unit-label">
|
||||||
<div v-for="(label, index) in labelData" :key="label + index">{{ label }}</div>
|
<div
|
||||||
|
v-for="(label, index) in labelData"
|
||||||
|
:key="label + index"
|
||||||
|
>{{ label }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -38,7 +45,7 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
@ -54,42 +61,61 @@ export default {
|
|||||||
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
|
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
|
||||||
* @example color = ['#000', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red']
|
* @example color = ['#000', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red']
|
||||||
*/
|
*/
|
||||||
colors: ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293'],
|
colors: [
|
||||||
|
'#37a2da',
|
||||||
|
'#32c5e9',
|
||||||
|
'#67e0e3',
|
||||||
|
'#9fe6b8',
|
||||||
|
'#ffdb5c',
|
||||||
|
'#ff9f7f',
|
||||||
|
'#fb7293'
|
||||||
|
],
|
||||||
/**
|
/**
|
||||||
* @description Chart unit
|
* @description Chart unit
|
||||||
* @type {String}
|
* @type {String}
|
||||||
* @default unit = ''
|
* @default unit = ''
|
||||||
*/
|
*/
|
||||||
unit: ''
|
unit: '',
|
||||||
|
/**
|
||||||
|
* @description Show item value
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default showValue = false
|
||||||
|
*/
|
||||||
|
showValue: false
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
|
|
||||||
capsuleLength: [],
|
capsuleLength: [],
|
||||||
labelData: []
|
capsuleValue: [],
|
||||||
|
labelData: [],
|
||||||
|
labelDataLength: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
config () {
|
config() {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calcData () {
|
calcData() {
|
||||||
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
|
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
|
||||||
|
|
||||||
mergeConfig()
|
mergeConfig()
|
||||||
|
|
||||||
calcCapsuleLengthAndLabelData()
|
calcCapsuleLengthAndLabelData()
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig() {
|
||||||
let { config, defaultConfig } = this
|
let { config, defaultConfig } = this
|
||||||
|
|
||||||
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
this.mergedConfig = deepMerge(
|
||||||
|
deepClone(defaultConfig, true),
|
||||||
|
config || {}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
calcCapsuleLengthAndLabelData () {
|
calcCapsuleLengthAndLabelData() {
|
||||||
const { data } = this.mergedConfig
|
const { data } = this.mergedConfig
|
||||||
|
|
||||||
if (!data.length) return
|
if (!data.length) return
|
||||||
@ -98,14 +124,24 @@ export default {
|
|||||||
|
|
||||||
const maxValue = Math.max(...capsuleValue)
|
const maxValue = Math.max(...capsuleValue)
|
||||||
|
|
||||||
this.capsuleLength = capsuleValue.map(v => maxValue ? v / maxValue : 0)
|
this.capsuleValue = capsuleValue
|
||||||
|
|
||||||
|
this.capsuleLength = capsuleValue.map(v => (maxValue ? v / maxValue : 0))
|
||||||
|
|
||||||
const oneFifth = maxValue / 5
|
const oneFifth = maxValue / 5
|
||||||
|
|
||||||
this.labelData = new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))
|
const labelData = Array.from(
|
||||||
|
new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))
|
||||||
|
)
|
||||||
|
|
||||||
|
this.labelData = labelData
|
||||||
|
|
||||||
|
this.labelDataLength = Array.from(labelData).map(v =>
|
||||||
|
maxValue ? v / maxValue : 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import Charts from '@jiaminghi/charts'
|
import Charts from '@jiaminghi/charts'
|
||||||
@ -19,10 +21,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: `charts-container-${timestamp}`,
|
ref: `charts-container-${id}`,
|
||||||
chartRef: `chart-${timestamp}`,
|
chartRef: `chart-${id}`,
|
||||||
|
|
||||||
chart: null
|
chart: null
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -162,17 +163,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-10',
|
ref: 'decoration-10',
|
||||||
|
|
||||||
animationId1: `d10ani1${timestamp}`,
|
animationId1: `d10ani1${id}`,
|
||||||
animationId2: `d10ani2${timestamp}`,
|
animationId2: `d10ani2${id}`,
|
||||||
animationId3: `d10ani3${timestamp}`,
|
animationId3: `d10ani3${id}`,
|
||||||
animationId4: `d10ani4${timestamp}`,
|
animationId4: `d10ani4${id}`,
|
||||||
animationId5: `d10ani5${timestamp}`,
|
animationId5: `d10ani5${id}`,
|
||||||
animationId6: `d10ani6${timestamp}`,
|
animationId6: `d10ani6${id}`,
|
||||||
animationId7: `d10ani7${timestamp}`,
|
animationId7: `d10ani7${id}`,
|
||||||
|
|
||||||
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-11',
|
ref: 'decoration-11',
|
||||||
|
|
||||||
|
@ -7,20 +7,22 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
.dv-decoration-4 .normal {
|
.dv-decoration-4 .normal {
|
||||||
height: 0% !important;
|
|
||||||
animation: ani-height 3s ease-in-out infinite;
|
animation: ani-height 3s ease-in-out infinite;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
}
|
}
|
||||||
.dv-decoration-4 .reverse {
|
.dv-decoration-4 .reverse {
|
||||||
width: 0% !important;
|
|
||||||
animation: ani-width 3s ease-in-out infinite;
|
animation: ani-width 3s ease-in-out infinite;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
}
|
}
|
||||||
@keyframes ani-height {
|
@keyframes ani-height {
|
||||||
|
0% {
|
||||||
|
height: 0%;
|
||||||
|
}
|
||||||
70% {
|
70% {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@ -29,6 +31,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@keyframes ani-width {
|
@keyframes ani-width {
|
||||||
|
0% {
|
||||||
|
width: 0%;
|
||||||
|
}
|
||||||
70% {
|
70% {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -106,11 +107,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-9',
|
ref: 'decoration-9',
|
||||||
|
|
||||||
polygonId: `decoration-9-polygon-${timestamp}`,
|
polygonId: `decoration-9-polygon-${id}`,
|
||||||
|
|
||||||
svgWH: [100, 100],
|
svgWH: [100, 100],
|
||||||
|
|
||||||
|
@ -53,6 +53,12 @@ export default {
|
|||||||
* @example textAlign = 'center' | 'left' | 'right'
|
* @example textAlign = 'center' | 'left' | 'right'
|
||||||
*/
|
*/
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
/**
|
||||||
|
* @description rowGap
|
||||||
|
* @type {Number}
|
||||||
|
@default rowGap = 0
|
||||||
|
*/
|
||||||
|
rowGap: 0,
|
||||||
/**
|
/**
|
||||||
* @description Text style configuration
|
* @description Text style configuration
|
||||||
* @type {Object} {CRender Class Style}
|
* @type {Object} {CRender Class Style}
|
||||||
@ -61,6 +67,11 @@ export default {
|
|||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
fill: '#3de7c9'
|
fill: '#3de7c9'
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @description Number formatter
|
||||||
|
* @type {Null|Function}
|
||||||
|
*/
|
||||||
|
formatter: undefined,
|
||||||
/**
|
/**
|
||||||
* @description CRender animationCurve
|
* @description CRender animationCurve
|
||||||
* @type {String}
|
* @type {String}
|
||||||
@ -124,7 +135,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getShape () {
|
getShape () {
|
||||||
const { number, content, toFixed, textAlign } = this.mergedConfig
|
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
|
||||||
|
|
||||||
const [w, h] = this.renderer.area
|
const [w, h] = this.renderer.area
|
||||||
|
|
||||||
@ -137,7 +148,9 @@ export default {
|
|||||||
number,
|
number,
|
||||||
content,
|
content,
|
||||||
toFixed,
|
toFixed,
|
||||||
position
|
position,
|
||||||
|
rowGap,
|
||||||
|
formatter
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getStyle () {
|
getStyle () {
|
||||||
|
@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
@ -171,14 +171,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'dv-flyline-chart',
|
ref: 'dv-flyline-chart',
|
||||||
unique: Math.random(),
|
unique: Math.random(),
|
||||||
maskId: `flyline-mask-id-${timestamp}`,
|
maskId: `flyline-mask-id-${id}`,
|
||||||
maskCircleId: `mask-circle-id-${timestamp}`,
|
maskCircleId: `mask-circle-id-${id}`,
|
||||||
gradientId: `gradient-id-${timestamp}`,
|
gradientId: `gradient-id-${id}`,
|
||||||
gradient2Id: `gradient2-id-${timestamp}`,
|
gradient2Id: `gradient2-id-${id}`,
|
||||||
|
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
@ -173,12 +173,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'dv-flyline-chart-enhanced',
|
ref: 'dv-flyline-chart-enhanced',
|
||||||
unique: Math.random(),
|
unique: Math.random(),
|
||||||
flylineGradientId: `flyline-gradient-id-${timestamp}`,
|
flylineGradientId: `flyline-gradient-id-${id}`,
|
||||||
haloGradientId: `halo-gradient-id-${timestamp}`,
|
haloGradientId: `halo-gradient-id-${id}`,
|
||||||
/**
|
/**
|
||||||
* @description Type Declaration
|
* @description Type Declaration
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
@ -57,10 +59,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
gradientId1: `percent-pond-gradientId1-${timestamp}`,
|
gradientId1: `percent-pond-gradientId1-${id}`,
|
||||||
gradientId2: `percent-pond-gradientId2-${timestamp}`,
|
gradientId2: `percent-pond-gradientId2-${id}`,
|
||||||
|
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
@ -234,10 +236,10 @@ export default {
|
|||||||
|
|
||||||
await $nextTick()
|
await $nextTick()
|
||||||
|
|
||||||
const dom = $refs['percent-pond']
|
const { clientWidth, clientHeight } = $refs['percent-pond']
|
||||||
|
|
||||||
this.width = dom.clientWidth
|
this.width = clientWidth
|
||||||
this.height = dom.clientHeight
|
this.height = clientHeight
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig () {
|
||||||
const { config, defaultConfig } = this
|
const { config, defaultConfig } = this
|
||||||
|
@ -37,7 +37,9 @@
|
|||||||
:style="`width: ${widths[ci]}px;`"
|
:style="`width: ${widths[ci]}px;`"
|
||||||
:align="aligns[ci]"
|
:align="aligns[ci]"
|
||||||
v-html="ceil"
|
v-html="ceil"
|
||||||
@click="emitEvent(ri, ci, row, ceil)"
|
@click="emitEvent('click', ri, ci, row, ceil)"
|
||||||
|
@mouseenter="handleHover(true, ri, ci, row, ceil)"
|
||||||
|
@mouseleave="handleHover(false)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -146,7 +148,14 @@ export default {
|
|||||||
* @default carousel = 'single'
|
* @default carousel = 'single'
|
||||||
* @example carousel = 'single' | 'page'
|
* @example carousel = 'single' | 'page'
|
||||||
*/
|
*/
|
||||||
carousel: 'single'
|
carousel: 'single',
|
||||||
|
/**
|
||||||
|
* @description Pause scroll when mouse hovered
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default hoverPause = true
|
||||||
|
* @example hoverPause = true | false
|
||||||
|
*/
|
||||||
|
hoverPause: true
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
@ -178,10 +187,24 @@ export default {
|
|||||||
|
|
||||||
stopAnimation()
|
stopAnimation()
|
||||||
|
|
||||||
|
this.animationIndex = 0
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleHover(enter, ri, ci, row, ceil){
|
||||||
|
const { mergedConfig, emitEvent, stopAnimation, animation } = this
|
||||||
|
|
||||||
|
if (enter) emitEvent('mouseover', ri, ci, row, ceil)
|
||||||
|
if (!mergedConfig.hoverPause) return
|
||||||
|
|
||||||
|
if (enter) {
|
||||||
|
stopAnimation()
|
||||||
|
} else {
|
||||||
|
animation(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
@ -355,10 +378,10 @@ export default {
|
|||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
},
|
},
|
||||||
emitEvent (ri, ci, row, ceil) {
|
emitEvent (type, ri, ci, row, ceil) {
|
||||||
const { ceils, rowIndex } = row
|
const { ceils, rowIndex } = row
|
||||||
|
|
||||||
this.$emit('click', {
|
this.$emit(type, {
|
||||||
row: ceils,
|
row: ceils,
|
||||||
ceil,
|
ceil,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
|
@ -152,10 +152,20 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const value = data.map(({ value }) => value)
|
const value = data.map(({ value }) => value)
|
||||||
|
|
||||||
|
const min = Math.min(...value) || 0
|
||||||
|
|
||||||
|
// abs of min
|
||||||
|
const minAbs = Math.abs(min)
|
||||||
|
|
||||||
const max = Math.max(...value) || 0
|
const max = Math.max(...value) || 0
|
||||||
|
|
||||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
|
// abs of max
|
||||||
|
const maxAbs = Math.abs(max)
|
||||||
|
|
||||||
|
const total = max + minAbs
|
||||||
|
|
||||||
|
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
|
||||||
|
|
||||||
const rowLength = data.length
|
const rowLength = data.length
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
@ -53,9 +55,9 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
gradientId: `water-level-pond-${timestamp}`,
|
gradientId: `water-level-pond-${id}`,
|
||||||
|
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
|
@ -37,3 +37,11 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||||||
|
|
||||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function uuid () {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
const r = Math.random() * 16 | 0
|
||||||
|
const v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||||
|
return v.toString(16)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jiaminghi/data-view",
|
"name": "@jiaminghi/data-view",
|
||||||
"version": "2.7.1",
|
"version": "2.9.2",
|
||||||
"author": "JiaMing <743192023@qq.com>",
|
"author": "JiaMing <743192023@qq.com>",
|
||||||
"description": "Vue Large screen data display component library",
|
"description": "Vue Large screen data display component library",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
@ -78,6 +78,11 @@ export default {
|
|||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
fill: '#fff'
|
fill: '#fff'
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @description Digital flop toFixed
|
||||||
|
* @type {Number}
|
||||||
|
*/
|
||||||
|
digitalFlopToFixed: 0,
|
||||||
/**
|
/**
|
||||||
* @description CRender animationCurve
|
* @description CRender animationCurve
|
||||||
* @type {String}
|
* @type {String}
|
||||||
@ -89,7 +94,13 @@ export default {
|
|||||||
* @type {String}
|
* @type {String}
|
||||||
* @default animationFrame = 50
|
* @default animationFrame = 50
|
||||||
*/
|
*/
|
||||||
animationFrame: 50
|
animationFrame: 50,
|
||||||
|
/**
|
||||||
|
* @description showOriginValue
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default showOriginValue = false
|
||||||
|
*/
|
||||||
|
showOriginValue: false
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
@ -102,33 +113,47 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
digitalFlop () {
|
digitalFlop() {
|
||||||
const { mergedConfig, activeIndex } = this
|
const { mergedConfig, activeIndex } = this
|
||||||
|
|
||||||
if (!mergedConfig) return {}
|
if (!mergedConfig) return {}
|
||||||
|
|
||||||
const { digitalFlopStyle, data } = mergedConfig
|
const {
|
||||||
|
digitalFlopStyle,
|
||||||
|
digitalFlopToFixed,
|
||||||
|
data,
|
||||||
|
showOriginValue
|
||||||
|
} = mergedConfig
|
||||||
|
|
||||||
const value = data.map(({ value }) => value)
|
const value = data.map(({ value }) => value)
|
||||||
|
|
||||||
const sum = value.reduce((all, v) => all + v, 0)
|
let displayValue
|
||||||
|
|
||||||
const percent = parseInt(value[activeIndex] / sum * 100) || 0
|
if (showOriginValue) {
|
||||||
|
displayValue = value[activeIndex]
|
||||||
|
} else {
|
||||||
|
const sum = value.reduce((all, v) => all + v, 0)
|
||||||
|
|
||||||
|
const percent = parseFloat((value[activeIndex] / sum) * 100) || 0
|
||||||
|
|
||||||
|
displayValue = percent
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: '{nt}%',
|
content: showOriginValue ? '{nt}' : '{nt}%',
|
||||||
number: [percent],
|
number: [displayValue],
|
||||||
style: digitalFlopStyle
|
style: digitalFlopStyle,
|
||||||
|
toFixed: digitalFlopToFixed
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ringName () {
|
ringName() {
|
||||||
const { mergedConfig, activeIndex } = this
|
const { mergedConfig, activeIndex } = this
|
||||||
|
|
||||||
if (!mergedConfig) return ''
|
if (!mergedConfig) return ''
|
||||||
|
|
||||||
return mergedConfig.data[activeIndex].name
|
return mergedConfig.data[activeIndex].name
|
||||||
},
|
},
|
||||||
fontSize () {
|
fontSize() {
|
||||||
const { mergedConfig } = this
|
const { mergedConfig } = this
|
||||||
|
|
||||||
if (!mergedConfig) return ''
|
if (!mergedConfig) return ''
|
||||||
@ -137,7 +162,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
config () {
|
config() {
|
||||||
const { animationHandler, mergeConfig, setRingOption } = this
|
const { animationHandler, mergeConfig, setRingOption } = this
|
||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
@ -150,7 +175,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init () {
|
init() {
|
||||||
const { initChart, mergeConfig, setRingOption } = this
|
const { initChart, mergeConfig, setRingOption } = this
|
||||||
|
|
||||||
initChart()
|
initChart()
|
||||||
@ -159,17 +184,20 @@ export default {
|
|||||||
|
|
||||||
setRingOption()
|
setRingOption()
|
||||||
},
|
},
|
||||||
initChart () {
|
initChart() {
|
||||||
const { $refs } = this
|
const { $refs } = this
|
||||||
|
|
||||||
this.chart = new Charts($refs['active-ring-chart'])
|
this.chart = new Charts($refs['active-ring-chart'])
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig() {
|
||||||
const { defaultConfig, config } = this
|
const { defaultConfig, config } = this
|
||||||
|
|
||||||
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
this.mergedConfig = deepMerge(
|
||||||
|
deepClone(defaultConfig, true),
|
||||||
|
config || {}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
setRingOption () {
|
setRingOption() {
|
||||||
const { getRingOption, chart, ringAnimation } = this
|
const { getRingOption, chart, ringAnimation } = this
|
||||||
|
|
||||||
const option = getRingOption()
|
const option = getRingOption()
|
||||||
@ -178,7 +206,7 @@ export default {
|
|||||||
|
|
||||||
ringAnimation()
|
ringAnimation()
|
||||||
},
|
},
|
||||||
getRingOption () {
|
getRingOption() {
|
||||||
const { mergedConfig, getRealRadius } = this
|
const { mergedConfig, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
@ -200,7 +228,7 @@ export default {
|
|||||||
color: mergedConfig.color
|
color: mergedConfig.color
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRealRadius (active = false) {
|
getRealRadius(active = false) {
|
||||||
const { mergedConfig, chart } = this
|
const { mergedConfig, chart } = this
|
||||||
|
|
||||||
const { radius, activeRadius, lineWidth } = mergedConfig
|
const { radius, activeRadius, lineWidth } = mergedConfig
|
||||||
@ -211,14 +239,15 @@ export default {
|
|||||||
|
|
||||||
let realRadius = active ? activeRadius : radius
|
let realRadius = active ? activeRadius : radius
|
||||||
|
|
||||||
if (typeof realRadius !== 'number') realRadius = parseInt(realRadius) / 100 * maxRadius
|
if (typeof realRadius !== 'number')
|
||||||
|
realRadius = (parseInt(realRadius) / 100) * maxRadius
|
||||||
|
|
||||||
const insideRadius = realRadius - halfLineWidth
|
const insideRadius = realRadius - halfLineWidth
|
||||||
const outSideRadius = realRadius + halfLineWidth
|
const outSideRadius = realRadius + halfLineWidth
|
||||||
|
|
||||||
return [insideRadius, outSideRadius]
|
return [insideRadius, outSideRadius]
|
||||||
},
|
},
|
||||||
ringAnimation () {
|
ringAnimation() {
|
||||||
let { activeIndex, getRingOption, chart, getRealRadius } = this
|
let { activeIndex, getRingOption, chart, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
@ -251,12 +280,12 @@ export default {
|
|||||||
}, activeTimeGap)
|
}, activeTimeGap)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
const { init } = this
|
const { init } = this
|
||||||
|
|
||||||
init()
|
init()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy() {
|
||||||
const { animationHandler } = this
|
const { animationHandler } = this
|
||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-1">
|
<div class="dv-border-box-1" :ref="ref">
|
||||||
|
<svg class="border" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`10, 27 10, ${height - 27} 13, ${height - 24} 13, ${height - 21} 24, ${height - 11}
|
||||||
|
38, ${height - 11} 41, ${height - 8} 73, ${height - 8} 75, ${height - 10} 81, ${height - 10}
|
||||||
|
85, ${height - 6} ${width - 85}, ${height - 6} ${width - 81}, ${height - 10} ${width - 75}, ${height - 10}
|
||||||
|
${width - 73}, ${height - 8} ${width - 41}, ${height - 8} ${width - 38}, ${height - 11}
|
||||||
|
${width - 24}, ${height - 11} ${width - 13}, ${height - 21} ${width - 13}, ${height - 24}
|
||||||
|
${width - 10}, ${height - 27} ${width - 10}, 27 ${width - 13}, 25 ${width - 13}, 21
|
||||||
|
${width - 24}, 11 ${width - 38}, 11 ${width - 41}, 8 ${width - 73}, 8 ${width - 75}, 10
|
||||||
|
${width - 81}, 10 ${width - 85}, 6 85, 6 81, 10 75, 10 73, 8 41, 8 38, 11 24, 11 13, 21 13, 24`" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="150px"
|
width="150px"
|
||||||
height="150px"
|
height="150px"
|
||||||
@ -52,20 +63,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DvBorderBox1',
|
name: 'DvBorderBox1',
|
||||||
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
ref: 'border-box-1',
|
||||||
|
|
||||||
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
||||||
|
|
||||||
defaultColor: ['#4fd2dd', '#235fa7'],
|
defaultColor: ['#4fd2dd', '#235fa7'],
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-10" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
<div class="dv-border-box-10" :ref="ref" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
||||||
|
<svg class="border" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
4, 0 ${width - 4}, 0 ${width}, 4 ${width}, ${height - 4} ${width - 4}, ${height}
|
||||||
|
4, ${height} 0, ${height - 4} 0, 4
|
||||||
|
`" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="150px"
|
width="150px"
|
||||||
height="150px"
|
height="150px"
|
||||||
@ -20,20 +27,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DvBorderBox10',
|
name: 'DvBorderBox10',
|
||||||
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
ref: 'border-box-10',
|
||||||
|
|
||||||
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
|
||||||
|
|
||||||
defaultColor: ['#1d48c4', '#d3e1f8'],
|
defaultColor: ['#1d48c4', '#d3e1f8'],
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
</filter>
|
</filter>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
20, 32 ${width * 0.5 - titleWidth / 2}, 32 ${width * 0.5 - titleWidth / 2 + 20}, 53
|
||||||
|
${width * 0.5 + titleWidth / 2 - 20}, 53 ${width * 0.5 + titleWidth / 2}, 32
|
||||||
|
${width - 20}, 32 ${width - 8}, 48 ${width - 8}, ${height - 25} ${width - 20}, ${height - 8}
|
||||||
|
20, ${height - 8} 8, ${height - 25} 8, 50
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:filter="`url(#${filterId})`"
|
:filter="`url(#${filterId})`"
|
||||||
@ -209,6 +216,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -231,13 +239,17 @@ export default {
|
|||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-11',
|
ref: 'border-box-11',
|
||||||
filterId: `borderr-box-11-filterId-${timestamp}`,
|
filterId: `border-box-11-filterId-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#8aaafb', '#1f33a2'],
|
defaultColor: ['#8aaafb', '#1f33a2'],
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<path
|
<path
|
||||||
v-if="width && height"
|
v-if="width && height"
|
||||||
fill="transparent"
|
:fill="backgroundColor"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:d="`
|
:d="`
|
||||||
@ -92,6 +92,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -106,13 +107,17 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = +new Date()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-12',
|
ref: 'border-box-12',
|
||||||
filterId: `borderr-box-12-filterId-${timestamp}`,
|
filterId: `borderr-box-12-filterId-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#2e6099', '#7ce7fd'],
|
defaultColor: ['#2e6099', '#7ce7fd'],
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="dv-border-box-13" :ref="ref">
|
<div class="dv-border-box-13" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
<path
|
<path
|
||||||
fill="transparent"
|
:fill="backgroundColor"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:d="`
|
:d="`
|
||||||
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
||||||
@ -54,10 +54,13 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = +new Date()
|
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-13',
|
ref: 'border-box-13',
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-2" :ref="ref">
|
<div class="dv-border-box-2" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
7, 7 ${width - 7}, 7 ${width - 7}, ${height - 7} 7, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`2, 2 ${width - 2} ,2 ${width - 2}, ${height - 2} 2, ${height - 2} 2, 2`"
|
:points="`2, 2 ${width - 2} ,2 ${width - 2}, ${height - 2} 2, ${height - 2} 2, 2`"
|
||||||
@ -35,6 +39,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-3" :ref="ref">
|
<div class="dv-border-box-3" :ref="ref">
|
||||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
23, 23 ${width - 24}, 23 ${width - 24}, ${height - 24} 23, ${height - 24}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline class="dv-bb3-line1"
|
<polyline class="dv-bb3-line1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`4, 4 ${width - 22} ,4 ${width - 22}, ${height - 22} 4, ${height - 22} 4, 4`"
|
:points="`4, 4 ${width - 22} ,4 ${width - 22}, ${height - 22} 4, ${height - 22} 4, 4`"
|
||||||
@ -39,6 +43,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-4" :ref="ref">
|
<div class="dv-border-box-4" :ref="ref">
|
||||||
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
${width - 15}, 22 170, 22 150, 7 40, 7 28, 21 32, 24
|
||||||
|
16, 42 16, ${height - 32} 41, ${height - 7} ${width - 15}, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline class="dv-bb4-line-1"
|
<polyline class="dv-bb4-line-1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
:points="`145, ${height - 5} 40, ${height - 5} 10, ${height - 35}
|
:points="`145, ${height - 5} 40, ${height - 5} 10, ${height - 35}
|
||||||
@ -46,6 +51,10 @@ export default {
|
|||||||
reverse: {
|
reverse: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-5" :ref="ref">
|
<div class="dv-border-box-5" :ref="ref">
|
||||||
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
10, 22 ${width - 22}, 22 ${width - 22}, ${height - 86} ${width - 84}, ${height - 24} 10, ${height - 24}
|
||||||
|
`" />
|
||||||
|
|
||||||
<polyline
|
<polyline
|
||||||
class="dv-bb5-line-1"
|
class="dv-bb5-line-1"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
@ -43,6 +47,10 @@ export default {
|
|||||||
reverse: {
|
reverse: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-6" :ref="ref">
|
<div class="dv-border-box-6" :ref="ref">
|
||||||
<svg class="dv-svg-container" :width="width" :height="height">
|
<svg class="dv-svg-container" :width="width" :height="height">
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
9, 7 ${width - 9}, 7 ${width - 9}, ${height - 7} 9, ${height - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<circle :fill="mergedColor[1]" cx="5" cy="5" r="2"/>
|
<circle :fill="mergedColor[1]" cx="5" cy="5" r="2"/>
|
||||||
<circle :fill="mergedColor[1]" :cx="width - 5" cy="5" r="2" />
|
<circle :fill="mergedColor[1]" :cx="width - 5" cy="5" r="2" />
|
||||||
<circle :fill="mergedColor[1]" :cx="width - 5" :cy="height - 5" r="2" />
|
<circle :fill="mergedColor[1]" :cx="width - 5" :cy="height - 5" r="2" />
|
||||||
@ -39,6 +43,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="dv-border-box-7"
|
class="dv-border-box-7"
|
||||||
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}`"
|
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}; background-color: ${backgroundColor}`"
|
||||||
:ref="ref"
|
:ref="ref"
|
||||||
>
|
>
|
||||||
<svg class="dv-svg-container" :width="width" :height="height">
|
<svg class="dv-svg-container" :width="width" :height="height">
|
||||||
@ -37,6 +37,10 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<defs>
|
<defs>
|
||||||
<path
|
<path
|
||||||
:id="path"
|
:id="path"
|
||||||
:d="`M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`"
|
:d="pathD"
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
/>
|
/>
|
||||||
<radialGradient
|
<radialGradient
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
|
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
|
||||||
<animateMotion
|
<animateMotion
|
||||||
:dur="`${dur}s`"
|
:dur="`${dur}s`"
|
||||||
:path="`M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`"
|
:path="pathD"
|
||||||
rotate="auto"
|
rotate="auto"
|
||||||
repeatCount="indefinite"
|
repeatCount="indefinite"
|
||||||
/>
|
/>
|
||||||
@ -33,6 +33,8 @@
|
|||||||
</mask>
|
</mask>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`5, 5 ${width - 5}, 5 ${width - 5} ${height - 5} 5, ${height - 5}`" />
|
||||||
|
|
||||||
<use
|
<use
|
||||||
:stroke="mergedColor[0]"
|
:stroke="mergedColor[0]"
|
||||||
stroke-width="1"
|
stroke-width="1"
|
||||||
@ -63,6 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -79,15 +82,23 @@ export default {
|
|||||||
dur: {
|
dur: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 3
|
default: 3
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
|
},
|
||||||
|
reverse: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-8',
|
ref: 'border-box-8',
|
||||||
path: `border-box-8-path-${timestamp}`,
|
path: `border-box-8-path-${id}`,
|
||||||
gradient: `border-box-8-gradient-${timestamp}`,
|
gradient: `border-box-8-gradient-${id}`,
|
||||||
mask: `border-box-8-mask-${timestamp}`,
|
mask: `border-box-8-mask-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#235fa7', '#4fd2dd'],
|
defaultColor: ['#235fa7', '#4fd2dd'],
|
||||||
|
|
||||||
@ -99,6 +110,13 @@ export default {
|
|||||||
const { width, height } = this
|
const { width, height } = this
|
||||||
|
|
||||||
return (width + height - 5) * 2
|
return (width + height - 5) * 2
|
||||||
|
},
|
||||||
|
pathD () {
|
||||||
|
const { reverse, width, height } = this
|
||||||
|
|
||||||
|
if (reverse) return `M 2.5, 2.5 L 2.5, ${height - 2.5} L ${width - 2.5}, ${height - 2.5} L ${width - 2.5}, 2.5 L 2.5, 2.5`
|
||||||
|
|
||||||
|
return `M2.5, 2.5 L${width - 2.5}, 2.5 L${width - 2.5}, ${height - 2.5} L2.5, ${height - 2.5} L2.5, 2.5`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -105,6 +105,15 @@
|
|||||||
</mask>
|
</mask>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
|
<polygon :fill="backgroundColor" :points="`
|
||||||
|
15, 9 ${width * 0.1 + 1}, 9 ${width * 0.1 + 4}, 6 ${width * 0.52 + 2}, 6
|
||||||
|
${width * 0.52 + 6}, 10 ${width * 0.58 - 7}, 10 ${width * 0.58 - 2}, 6
|
||||||
|
${width * 0.9 + 2}, 6 ${width * 0.9 + 6}, 10 ${width - 10}, 10 ${width - 10}, ${height * 0.1 - 6}
|
||||||
|
${width - 6}, ${height * 0.1 - 1} ${width - 6}, ${height * 0.8 + 1} ${width - 10}, ${height * 0.8 + 6}
|
||||||
|
${width - 10}, ${height - 10} ${width * 0.92 + 7}, ${height - 10} ${width * 0.92 + 2}, ${height - 6}
|
||||||
|
11, ${height - 6} 11, ${height * 0.15 - 2} 15, ${height * 0.15 - 7}
|
||||||
|
`" />
|
||||||
|
|
||||||
<rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
|
<rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
@ -116,6 +125,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -128,15 +138,19 @@ export default {
|
|||||||
color: {
|
color: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ([])
|
default: () => ([])
|
||||||
|
},
|
||||||
|
backgroundColor: {
|
||||||
|
type: String,
|
||||||
|
default: 'transparent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-9',
|
ref: 'border-box-9',
|
||||||
|
|
||||||
gradientId: `border-box-9-gradient-${timestamp}`,
|
gradientId: `border-box-9-gradient-${id}`,
|
||||||
maskId: `border-box-9-mask-${timestamp}`,
|
maskId: `border-box-9-mask-${id}`,
|
||||||
|
|
||||||
defaultColor: ['#11eefd', '#0078d2'],
|
defaultColor: ['#11eefd', '#0078d2'],
|
||||||
|
|
||||||
|
@ -7,16 +7,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="capsule-container">
|
<div class="capsule-container">
|
||||||
<div
|
<div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
|
||||||
class="capsule-item"
|
<div
|
||||||
v-for="(capsule, index) in capsuleLength"
|
class="capsule-item-column"
|
||||||
:key="index"
|
:style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
|
||||||
>
|
>
|
||||||
<div :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"></div>
|
<div
|
||||||
|
v-if="mergedConfig.showValue"
|
||||||
|
class="capsule-item-value"
|
||||||
|
>{{ capsuleValue[index] }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="unit-label">
|
<div class="unit-label">
|
||||||
<div v-for="(label, index) in labelData" :key="label + index">{{ label }}</div>
|
<div
|
||||||
|
v-for="(label, index) in labelData"
|
||||||
|
:key="label + index"
|
||||||
|
>{{ label }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -38,7 +45,7 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
@ -54,42 +61,61 @@ export default {
|
|||||||
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
|
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
|
||||||
* @example color = ['#000', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red']
|
* @example color = ['#000', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red']
|
||||||
*/
|
*/
|
||||||
colors: ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293'],
|
colors: [
|
||||||
|
'#37a2da',
|
||||||
|
'#32c5e9',
|
||||||
|
'#67e0e3',
|
||||||
|
'#9fe6b8',
|
||||||
|
'#ffdb5c',
|
||||||
|
'#ff9f7f',
|
||||||
|
'#fb7293'
|
||||||
|
],
|
||||||
/**
|
/**
|
||||||
* @description Chart unit
|
* @description Chart unit
|
||||||
* @type {String}
|
* @type {String}
|
||||||
* @default unit = ''
|
* @default unit = ''
|
||||||
*/
|
*/
|
||||||
unit: ''
|
unit: '',
|
||||||
|
/**
|
||||||
|
* @description Show item value
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default showValue = false
|
||||||
|
*/
|
||||||
|
showValue: false
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
|
|
||||||
capsuleLength: [],
|
capsuleLength: [],
|
||||||
labelData: []
|
capsuleValue: [],
|
||||||
|
labelData: [],
|
||||||
|
labelDataLength: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
config () {
|
config() {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calcData () {
|
calcData() {
|
||||||
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
|
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
|
||||||
|
|
||||||
mergeConfig()
|
mergeConfig()
|
||||||
|
|
||||||
calcCapsuleLengthAndLabelData()
|
calcCapsuleLengthAndLabelData()
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig() {
|
||||||
let { config, defaultConfig } = this
|
let { config, defaultConfig } = this
|
||||||
|
|
||||||
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
this.mergedConfig = deepMerge(
|
||||||
|
deepClone(defaultConfig, true),
|
||||||
|
config || {}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
calcCapsuleLengthAndLabelData () {
|
calcCapsuleLengthAndLabelData() {
|
||||||
const { data } = this.mergedConfig
|
const { data } = this.mergedConfig
|
||||||
|
|
||||||
if (!data.length) return
|
if (!data.length) return
|
||||||
@ -98,14 +124,24 @@ export default {
|
|||||||
|
|
||||||
const maxValue = Math.max(...capsuleValue)
|
const maxValue = Math.max(...capsuleValue)
|
||||||
|
|
||||||
this.capsuleLength = capsuleValue.map(v => maxValue ? v / maxValue : 0)
|
this.capsuleValue = capsuleValue
|
||||||
|
|
||||||
|
this.capsuleLength = capsuleValue.map(v => (maxValue ? v / maxValue : 0))
|
||||||
|
|
||||||
const oneFifth = maxValue / 5
|
const oneFifth = maxValue / 5
|
||||||
|
|
||||||
this.labelData = new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))
|
const labelData = Array.from(
|
||||||
|
new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))
|
||||||
|
)
|
||||||
|
|
||||||
|
this.labelData = labelData
|
||||||
|
|
||||||
|
this.labelDataLength = Array.from(labelData).map(v =>
|
||||||
|
maxValue ? v / maxValue : 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
@ -150,21 +186,30 @@ export default {
|
|||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
||||||
div {
|
.capsule-item-column {
|
||||||
|
position: relative;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.capsule-item-value {
|
||||||
|
font-size: 12px;
|
||||||
|
transform: translateX(100%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.unit-label {
|
.unit-label {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.unit-text {
|
.unit-text {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import Charts from '@jiaminghi/charts'
|
import Charts from '@jiaminghi/charts'
|
||||||
@ -19,10 +21,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: `charts-container-${timestamp}`,
|
ref: `charts-container-${id}`,
|
||||||
chartRef: `chart-${timestamp}`,
|
chartRef: `chart-${id}`,
|
||||||
|
|
||||||
chart: null
|
chart: null
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -162,17 +163,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-10',
|
ref: 'decoration-10',
|
||||||
|
|
||||||
animationId1: `d10ani1${timestamp}`,
|
animationId1: `d10ani1${id}`,
|
||||||
animationId2: `d10ani2${timestamp}`,
|
animationId2: `d10ani2${id}`,
|
||||||
animationId3: `d10ani3${timestamp}`,
|
animationId3: `d10ani3${id}`,
|
||||||
animationId4: `d10ani4${timestamp}`,
|
animationId4: `d10ani4${id}`,
|
||||||
animationId5: `d10ani5${timestamp}`,
|
animationId5: `d10ani5${id}`,
|
||||||
animationId6: `d10ani6${timestamp}`,
|
animationId6: `d10ani6${id}`,
|
||||||
animationId7: `d10ani7${timestamp}`,
|
animationId7: `d10ani7${id}`,
|
||||||
|
|
||||||
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-11',
|
ref: 'decoration-11',
|
||||||
|
|
||||||
|
@ -83,23 +83,26 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.normal {
|
.normal {
|
||||||
height: 0% !important;
|
|
||||||
animation: ani-height 3s ease-in-out infinite;
|
animation: ani-height 3s ease-in-out infinite;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reverse {
|
.reverse {
|
||||||
width: 0% !important;
|
|
||||||
animation: ani-width 3s ease-in-out infinite;
|
animation: ani-width 3s ease-in-out infinite;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes ani-height {
|
@keyframes ani-height {
|
||||||
|
0% {
|
||||||
|
height: 0%;
|
||||||
|
}
|
||||||
|
|
||||||
70% {
|
70% {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@ -110,6 +113,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes ani-width {
|
@keyframes ani-width {
|
||||||
|
0% {
|
||||||
|
width: 0%;
|
||||||
|
}
|
||||||
|
|
||||||
70% {
|
70% {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
@ -106,11 +107,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-9',
|
ref: 'decoration-9',
|
||||||
|
|
||||||
polygonId: `decoration-9-polygon-${timestamp}`,
|
polygonId: `decoration-9-polygon-${id}`,
|
||||||
|
|
||||||
svgWH: [100, 100],
|
svgWH: [100, 100],
|
||||||
|
|
||||||
|
@ -53,6 +53,12 @@ export default {
|
|||||||
* @example textAlign = 'center' | 'left' | 'right'
|
* @example textAlign = 'center' | 'left' | 'right'
|
||||||
*/
|
*/
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
/**
|
||||||
|
* @description rowGap
|
||||||
|
* @type {Number}
|
||||||
|
@default rowGap = 0
|
||||||
|
*/
|
||||||
|
rowGap: 0,
|
||||||
/**
|
/**
|
||||||
* @description Text style configuration
|
* @description Text style configuration
|
||||||
* @type {Object} {CRender Class Style}
|
* @type {Object} {CRender Class Style}
|
||||||
@ -61,6 +67,11 @@ export default {
|
|||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
fill: '#3de7c9'
|
fill: '#3de7c9'
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @description Number formatter
|
||||||
|
* @type {Null|Function}
|
||||||
|
*/
|
||||||
|
formatter: undefined,
|
||||||
/**
|
/**
|
||||||
* @description CRender animationCurve
|
* @description CRender animationCurve
|
||||||
* @type {String}
|
* @type {String}
|
||||||
@ -124,7 +135,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getShape () {
|
getShape () {
|
||||||
const { number, content, toFixed, textAlign } = this.mergedConfig
|
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
|
||||||
|
|
||||||
const [w, h] = this.renderer.area
|
const [w, h] = this.renderer.area
|
||||||
|
|
||||||
@ -137,7 +148,9 @@ export default {
|
|||||||
number,
|
number,
|
||||||
content,
|
content,
|
||||||
toFixed,
|
toFixed,
|
||||||
position
|
position,
|
||||||
|
rowGap,
|
||||||
|
formatter
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getStyle () {
|
getStyle () {
|
||||||
|
@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
@ -171,14 +171,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'dv-flyline-chart',
|
ref: 'dv-flyline-chart',
|
||||||
unique: Math.random(),
|
unique: Math.random(),
|
||||||
maskId: `flyline-mask-id-${timestamp}`,
|
maskId: `flyline-mask-id-${id}`,
|
||||||
maskCircleId: `mask-circle-id-${timestamp}`,
|
maskCircleId: `mask-circle-id-${id}`,
|
||||||
gradientId: `gradient-id-${timestamp}`,
|
gradientId: `gradient-id-${id}`,
|
||||||
gradient2Id: `gradient2-id-${timestamp}`,
|
gradient2Id: `gradient2-id-${id}`,
|
||||||
|
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../../mixin/autoResize'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
@ -173,12 +173,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
ref: 'dv-flyline-chart-enhanced',
|
ref: 'dv-flyline-chart-enhanced',
|
||||||
unique: Math.random(),
|
unique: Math.random(),
|
||||||
flylineGradientId: `flyline-gradient-id-${timestamp}`,
|
flylineGradientId: `flyline-gradient-id-${id}`,
|
||||||
haloGradientId: `halo-gradient-id-${timestamp}`,
|
haloGradientId: `halo-gradient-id-${id}`,
|
||||||
/**
|
/**
|
||||||
* @description Type Declaration
|
* @description Type Declaration
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
@ -57,10 +59,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
gradientId1: `percent-pond-gradientId1-${timestamp}`,
|
gradientId1: `percent-pond-gradientId1-${id}`,
|
||||||
gradientId2: `percent-pond-gradientId2-${timestamp}`,
|
gradientId2: `percent-pond-gradientId2-${id}`,
|
||||||
|
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
@ -234,10 +236,10 @@ export default {
|
|||||||
|
|
||||||
await $nextTick()
|
await $nextTick()
|
||||||
|
|
||||||
const dom = $refs['percent-pond']
|
const { clientWidth, clientHeight } = $refs['percent-pond']
|
||||||
|
|
||||||
this.width = dom.clientWidth
|
this.width = clientWidth
|
||||||
this.height = dom.clientHeight
|
this.height = clientHeight
|
||||||
},
|
},
|
||||||
mergeConfig () {
|
mergeConfig () {
|
||||||
const { config, defaultConfig } = this
|
const { config, defaultConfig } = this
|
||||||
|
@ -37,7 +37,9 @@
|
|||||||
:style="`width: ${widths[ci]}px;`"
|
:style="`width: ${widths[ci]}px;`"
|
||||||
:align="aligns[ci]"
|
:align="aligns[ci]"
|
||||||
v-html="ceil"
|
v-html="ceil"
|
||||||
@click="emitEvent(ri, ci, row, ceil)"
|
@click="emitEvent('click', ri, ci, row, ceil)"
|
||||||
|
@mouseenter="handleHover(true, ri, ci, row, ceil)"
|
||||||
|
@mouseleave="handleHover(false)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -146,7 +148,14 @@ export default {
|
|||||||
* @default carousel = 'single'
|
* @default carousel = 'single'
|
||||||
* @example carousel = 'single' | 'page'
|
* @example carousel = 'single' | 'page'
|
||||||
*/
|
*/
|
||||||
carousel: 'single'
|
carousel: 'single',
|
||||||
|
/**
|
||||||
|
* @description Pause scroll when mouse hovered
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default hoverPause = true
|
||||||
|
* @example hoverPause = true | false
|
||||||
|
*/
|
||||||
|
hoverPause: true
|
||||||
},
|
},
|
||||||
|
|
||||||
mergedConfig: null,
|
mergedConfig: null,
|
||||||
@ -178,10 +187,24 @@ export default {
|
|||||||
|
|
||||||
stopAnimation()
|
stopAnimation()
|
||||||
|
|
||||||
|
this.animationIndex = 0
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleHover(enter, ri, ci, row, ceil){
|
||||||
|
const { mergedConfig, emitEvent, stopAnimation, animation } = this
|
||||||
|
|
||||||
|
if (enter) emitEvent('mouseover', ri, ci, row, ceil)
|
||||||
|
if (!mergedConfig.hoverPause) return
|
||||||
|
|
||||||
|
if (enter) {
|
||||||
|
stopAnimation()
|
||||||
|
} else {
|
||||||
|
animation(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
@ -355,10 +378,10 @@ export default {
|
|||||||
|
|
||||||
clearTimeout(animationHandler)
|
clearTimeout(animationHandler)
|
||||||
},
|
},
|
||||||
emitEvent (ri, ci, row, ceil) {
|
emitEvent (type, ri, ci, row, ceil) {
|
||||||
const { ceils, rowIndex } = row
|
const { ceils, rowIndex } = row
|
||||||
|
|
||||||
this.$emit('click', {
|
this.$emit(type, {
|
||||||
row: ceils,
|
row: ceils,
|
||||||
ceil,
|
ceil,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
|
@ -152,10 +152,20 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const value = data.map(({ value }) => value)
|
const value = data.map(({ value }) => value)
|
||||||
|
|
||||||
|
const min = Math.min(...value) || 0
|
||||||
|
|
||||||
|
// abs of min
|
||||||
|
const minAbs = Math.abs(min)
|
||||||
|
|
||||||
const max = Math.max(...value) || 0
|
const max = Math.max(...value) || 0
|
||||||
|
|
||||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
|
// abs of max
|
||||||
|
const maxAbs = Math.abs(max)
|
||||||
|
|
||||||
|
const total = max + minAbs
|
||||||
|
|
||||||
|
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
|
||||||
|
|
||||||
const rowLength = data.length
|
const rowLength = data.length
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { uuid } from '../../../util/index'
|
||||||
|
|
||||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
@ -53,9 +55,9 @@ export default {
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const timestamp = Date.now()
|
const id = uuid()
|
||||||
return {
|
return {
|
||||||
gradientId: `water-level-pond-${timestamp}`,
|
gradientId: `water-level-pond-${id}`,
|
||||||
|
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
/**
|
/**
|
||||||
|
@ -37,3 +37,11 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||||||
|
|
||||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function uuid () {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
const r = Math.random() * 16 | 0
|
||||||
|
const v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||||
|
return v.toString(16)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user