Compare commits

...

44 Commits

Author SHA1 Message Date
a2875684ce update dist and lib 2020-06-16 14:34:36 +08:00
f581aee5c3 update changelog 2020-06-16 14:34:30 +08:00
3f5148cea3 update version to 2.9.1 2020-06-16 14:27:11 +08:00
e270fadcd2 update change log 2020-06-16 14:26:55 +08:00
beaef5c59a optmization 2020-06-16 14:24:02 +08:00
b17399416a Merge branch 'pr/101' 2020-06-16 14:19:34 +08:00
5f3fdfc798 add number formatter 2020-06-16 14:06:12 +08:00
e7c237cbac ativeRingChart: optimize method calcRowsData 2020-06-12 15:08:00 +08:00
3d3de766e3 update dist and lib 2020-06-10 09:50:30 +08:00
330815d90a update version to 2.9.0 2020-06-10 09:50:24 +08:00
4f6fc240d2 update change log 2020-06-10 09:50:10 +08:00
1d0f369509 optmization 2020-06-10 09:45:21 +08:00
ea058a90c3 feature / 新增轮播表的鼠标悬停配置 hoverPause 2020-06-09 11:15:23 +08:00
934e3f314a Merge branch 'master' of https://github.com/DataV-Team/Datav 2020-05-25 17:03:44 +08:00
eea32d7e39 merge branch pr/83 2020-05-25 17:02:57 +08:00
7dd7baebba merge branch pr/83 2020-05-25 17:02:05 +08:00
4a7fdf0c1c Merge branch 'pr/83' 2020-05-25 17:01:06 +08:00
53991795a0 update dist and lib 2020-05-25 16:42:14 +08:00
dde29fa61a update version to 2.8.4 2020-05-25 15:59:20 +08:00
c82b979432 update change log 2020-05-25 15:59:10 +08:00
e938b66dc0 update dist and lib 2020-05-25 15:57:26 +08:00
71a9be2a13 Use uuid to produce unique id 2020-05-25 15:57:19 +08:00
f0432e4c42 update uuid 2020-05-16 15:20:06 +08:00
65f5b529bf fix id errors 2020-05-15 13:22:05 +08:00
054854480a update dist 2020-05-06 15:07:19 +08:00
6ce83e1fd8 update dist and lib 2020-05-06 14:15:15 +08:00
8e5f279b6e update version to 2.8.3 2020-05-06 14:15:02 +08:00
22afc8e787 update change log 2020-05-06 14:14:52 +08:00
eb78915c93 add showValue configuration 2020-05-06 14:13:49 +08:00
22c88c4ea5 add showOriginValue configuration 2020-05-06 14:13:34 +08:00
c98ca00179 Merge branch 'pr/76' into dev 2020-05-06 13:47:47 +08:00
c257ca6d9c update dist and lib 2020-05-06 13:20:20 +08:00
ce4cf0d342 add reverse configuration 2020-05-06 13:20:15 +08:00
7df0c0247a update version to 2.8.2 2020-05-06 13:20:04 +08:00
df2369dfe4 update change log 2020-05-06 13:19:55 +08:00
db52e8cdc0 update change log 2020-05-03 20:26:37 +08:00
f8e438b0c4 update version to 2.8.1 2020-05-03 20:26:33 +08:00
1a13bc08c5 update dist and lib 2020-05-03 20:15:35 +08:00
ba90fb2faa add rowGap configuration 2020-05-03 20:15:28 +08:00
7799ef3dae capsule-item > div add position prop 2020-04-30 13:38:11 +08:00
33456176f7 update dist 2020-04-28 18:41:09 +08:00
dd37ba167a format code 2020-04-28 16:43:44 +08:00
fdd1e243a7 active-ring-chart add showOriginalValue 2020-04-28 16:15:12 +08:00
57b6c726eb 1.add showVal prop;
2.optimize unit-label child style;
2020-04-27 18:19:20 +08:00
45 changed files with 1257 additions and 607 deletions

View File

@ -1,9 +1,45 @@
# 2.8.0-alpha (2020-04-25)
# 2.9.1-alpha (2020-06-16)
### BugFixes
- **scrollRankingBoard:** Calculation optimization of negative values. [(#101)](https://github.com/DataV-Team/DataV/pull/101).
### Perfect
- **borderBox:** Add backgroundColor configuration.
- **capsuleChart:** Improve compatibility.
- **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)

1117
dist/datav.map.vue.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@ export default {
default: () => ({})
}
},
data () {
data() {
return {
defaultConfig: {
/**
@ -94,7 +94,13 @@ export default {
* @type {String}
* @default animationFrame = 50
*/
animationFrame: 50
animationFrame: 50,
/**
* @description showOriginValue
* @type {Boolean}
* @default showOriginValue = false
*/
showOriginValue: false
},
mergedConfig: null,
@ -107,34 +113,47 @@ export default {
}
},
computed: {
digitalFlop () {
digitalFlop() {
const { mergedConfig, activeIndex } = this
if (!mergedConfig) return {}
const { digitalFlopStyle, digitalFlopToFixed, data } = mergedConfig
const {
digitalFlopStyle,
digitalFlopToFixed,
data,
showOriginValue
} = mergedConfig
const value = data.map(({ value }) => value)
const sum = value.reduce((all, v) => all + v, 0)
let displayValue
const percent = parseFloat(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 {
content: '{nt}%',
number: [percent],
content: showOriginValue ? '{nt}' : '{nt}%',
number: [displayValue],
style: digitalFlopStyle,
toFixed: digitalFlopToFixed
}
},
ringName () {
ringName() {
const { mergedConfig, activeIndex } = this
if (!mergedConfig) return ''
return mergedConfig.data[activeIndex].name
},
fontSize () {
fontSize() {
const { mergedConfig } = this
if (!mergedConfig) return ''
@ -143,7 +162,7 @@ export default {
}
},
watch: {
config () {
config() {
const { animationHandler, mergeConfig, setRingOption } = this
clearTimeout(animationHandler)
@ -156,7 +175,7 @@ export default {
}
},
methods: {
init () {
init() {
const { initChart, mergeConfig, setRingOption } = this
initChart()
@ -165,17 +184,20 @@ export default {
setRingOption()
},
initChart () {
initChart() {
const { $refs } = this
this.chart = new Charts($refs['active-ring-chart'])
},
mergeConfig () {
mergeConfig() {
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 option = getRingOption()
@ -184,7 +206,7 @@ export default {
ringAnimation()
},
getRingOption () {
getRingOption() {
const { mergedConfig, getRealRadius } = this
const radius = getRealRadius()
@ -206,7 +228,7 @@ export default {
color: mergedConfig.color
}
},
getRealRadius (active = false) {
getRealRadius(active = false) {
const { mergedConfig, chart } = this
const { radius, activeRadius, lineWidth } = mergedConfig
@ -217,14 +239,15 @@ export default {
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 outSideRadius = realRadius + halfLineWidth
return [insideRadius, outSideRadius]
},
ringAnimation () {
ringAnimation() {
let { activeIndex, getRingOption, chart, getRealRadius } = this
const radius = getRealRadius()
@ -257,12 +280,12 @@ export default {
}, activeTimeGap)
}
},
mounted () {
mounted() {
const { init } = this
init()
},
beforeDestroy () {
beforeDestroy() {
const { animationHandler } = this
clearTimeout(animationHandler)

View File

@ -216,6 +216,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -245,10 +246,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-11',
filterId: `border-box-11-filterId-${timestamp}`,
filterId: `border-box-11-filterId-${id}`,
defaultColor: ['#8aaafb', '#1f33a2'],

View File

@ -92,6 +92,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -113,10 +114,10 @@ export default {
}
},
data () {
const timestamp = +new Date()
const id = uuid()
return {
ref: 'border-box-12',
filterId: `borderr-box-12-filterId-${timestamp}`,
filterId: `borderr-box-12-filterId-${id}`,
defaultColor: ['#2e6099', '#7ce7fd'],

View File

@ -61,7 +61,6 @@ export default {
}
},
data () {
const timestamp = +new Date()
return {
ref: 'border-box-13',

View File

@ -4,7 +4,7 @@
<defs>
<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"
/>
<radialGradient
@ -25,7 +25,7 @@
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
<animateMotion
: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"
repeatCount="indefinite"
/>
@ -65,6 +65,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -85,15 +86,19 @@ export default {
backgroundColor: {
type: String,
default: 'transparent'
},
reverse: {
type: Boolean,
default: false
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-8',
path: `border-box-8-path-${timestamp}`,
gradient: `border-box-8-gradient-${timestamp}`,
mask: `border-box-8-mask-${timestamp}`,
path: `border-box-8-path-${id}`,
gradient: `border-box-8-gradient-${id}`,
mask: `border-box-8-mask-${id}`,
defaultColor: ['#235fa7', '#4fd2dd'],
@ -105,6 +110,13 @@ export default {
const { width, height } = this
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: {

View File

@ -125,6 +125,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -144,12 +145,12 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-9',
gradientId: `border-box-9-gradient-${timestamp}`,
maskId: `border-box-9-mask-${timestamp}`,
gradientId: `border-box-9-gradient-${id}`,
maskId: `border-box-9-mask-${id}`,
defaultColor: ['#11eefd', '#0078d2'],

View File

@ -31,19 +31,27 @@
margin: 5px 0px;
border-radius: 5px;
}
.dv-capsule-chart .capsule-item div {
.dv-capsule-chart .capsule-item .capsule-item-column {
position: relative;
height: 8px;
margin-top: 1px;
border-radius: 5px;
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 {
height: 20px;
font-size: 12px;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
align-items: center;
}
.dv-capsule-chart .unit-text {
text-align: right;

View File

@ -7,16 +7,23 @@
</div>
<div class="capsule-container">
<div
class="capsule-item"
v-for="(capsule, index) in capsuleLength"
:key="index"
>
<div :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"></div>
<div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
<div
class="capsule-item-column"
:style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
>
<div
v-if="mergedConfig.showValue"
class="capsule-item-value"
>{{ capsuleValue[index] }}</div>
</div>
</div>
<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>
@ -38,7 +45,7 @@ export default {
default: () => ({})
}
},
data () {
data() {
return {
defaultConfig: {
/**
@ -54,42 +61,61 @@ export default {
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
* @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
* @type {String}
* @default unit = ''
*/
unit: ''
unit: '',
/**
* @description Show item value
* @type {Boolean}
* @default showValue = false
*/
showValue: false
},
mergedConfig: null,
capsuleLength: [],
labelData: []
capsuleValue: [],
labelData: [],
labelDataLength: []
}
},
watch: {
config () {
config() {
const { calcData } = this
calcData()
}
},
methods: {
calcData () {
calcData() {
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
mergeConfig()
calcCapsuleLengthAndLabelData()
},
mergeConfig () {
mergeConfig() {
let { config, defaultConfig } = this
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
this.mergedConfig = deepMerge(
deepClone(defaultConfig, true),
config || {}
)
},
calcCapsuleLengthAndLabelData () {
calcCapsuleLengthAndLabelData() {
const { data } = this.mergedConfig
if (!data.length) return
@ -98,14 +124,24 @@ export default {
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
this.labelData = Array.from(new Set(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
calcData()

View File

@ -5,6 +5,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import autoResize from '../../../mixin/autoResize'
import Charts from '@jiaminghi/charts'
@ -19,10 +21,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: `charts-container-${timestamp}`,
chartRef: `chart-${timestamp}`,
ref: `charts-container-${id}`,
chartRef: `chart-${id}`,
chart: null
}

View File

@ -147,6 +147,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -162,17 +163,17 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'decoration-10',
animationId1: `d10ani1${timestamp}`,
animationId2: `d10ani2${timestamp}`,
animationId3: `d10ani3${timestamp}`,
animationId4: `d10ani4${timestamp}`,
animationId5: `d10ani5${timestamp}`,
animationId6: `d10ani6${timestamp}`,
animationId7: `d10ani7${timestamp}`,
animationId1: `d10ani1${id}`,
animationId2: `d10ani2${id}`,
animationId3: `d10ani3${id}`,
animationId4: `d10ani4${id}`,
animationId5: `d10ani5${id}`,
animationId6: `d10ani6${id}`,
animationId7: `d10ani7${id}`,
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],

View File

@ -72,7 +72,6 @@ export default {
}
},
data () {
const timestamp = Date.now()
return {
ref: 'decoration-11',

View File

@ -7,20 +7,22 @@
display: flex;
overflow: hidden;
position: absolute;
flex: 1;
}
.dv-decoration-4 .normal {
height: 0% !important;
animation: ani-height 3s ease-in-out infinite;
left: 50%;
margin-left: -2px;
}
.dv-decoration-4 .reverse {
width: 0% !important;
animation: ani-width 3s ease-in-out infinite;
top: 50%;
margin-top: -2px;
}
@keyframes ani-height {
0% {
height: 0%;
}
70% {
height: 100%;
}
@ -29,6 +31,9 @@
}
}
@keyframes ani-width {
0% {
width: 0%;
}
70% {
width: 100%;
}

View File

@ -85,6 +85,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -106,11 +107,11 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'decoration-9',
polygonId: `decoration-9-polygon-${timestamp}`,
polygonId: `decoration-9-polygon-${id}`,
svgWH: [100, 100],

View File

@ -53,6 +53,12 @@ export default {
* @example textAlign = 'center' | 'left' | 'right'
*/
textAlign: 'center',
/**
* @description rowGap
* @type {Number}
@default rowGap = 0
*/
rowGap: 0,
/**
* @description Text style configuration
* @type {Object} {CRender Class Style}
@ -61,6 +67,11 @@ export default {
fontSize: 30,
fill: '#3de7c9'
},
/**
* @description Number formatter
* @type {Null|Function}
*/
formatter: undefined,
/**
* @description CRender animationCurve
* @type {String}
@ -124,7 +135,7 @@ export default {
})
},
getShape () {
const { number, content, toFixed, textAlign } = this.mergedConfig
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
const [w, h] = this.renderer.area
@ -137,7 +148,9 @@ export default {
number,
content,
toFixed,
position
position,
rowGap,
formatter
}
},
getStyle () {

View File

@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
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'
@ -171,14 +171,14 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'dv-flyline-chart',
unique: Math.random(),
maskId: `flyline-mask-id-${timestamp}`,
maskCircleId: `mask-circle-id-${timestamp}`,
gradientId: `gradient-id-${timestamp}`,
gradient2Id: `gradient2-id-${timestamp}`,
maskId: `flyline-mask-id-${id}`,
maskCircleId: `mask-circle-id-${id}`,
gradientId: `gradient-id-${id}`,
gradient2Id: `gradient2-id-${id}`,
defaultConfig: {
/**

View File

@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
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'
@ -173,12 +173,12 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'dv-flyline-chart-enhanced',
unique: Math.random(),
flylineGradientId: `flyline-gradient-id-${timestamp}`,
haloGradientId: `halo-gradient-id-${timestamp}`,
flylineGradientId: `flyline-gradient-id-${id}`,
haloGradientId: `halo-gradient-id-${id}`,
/**
* @description Type Declaration
*

View File

@ -44,6 +44,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
@ -57,10 +59,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
gradientId1: `percent-pond-gradientId1-${timestamp}`,
gradientId2: `percent-pond-gradientId2-${timestamp}`,
gradientId1: `percent-pond-gradientId1-${id}`,
gradientId2: `percent-pond-gradientId2-${id}`,
width: 0,
height: 0,
@ -234,10 +236,10 @@ export default {
await $nextTick()
const dom = $refs['percent-pond']
const { clientWidth, clientHeight } = $refs['percent-pond']
this.width = dom.clientWidth
this.height = dom.clientHeight
this.width = clientWidth
this.height = clientHeight
},
mergeConfig () {
const { config, defaultConfig } = this

View File

@ -37,7 +37,9 @@
:style="`width: ${widths[ci]}px;`"
:align="aligns[ci]"
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>
@ -146,7 +148,14 @@ export default {
* @default carousel = 'single'
* @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,
@ -182,6 +191,18 @@ export default {
}
},
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 () {
const { calcData } = this
@ -355,10 +376,10 @@ export default {
clearTimeout(animationHandler)
},
emitEvent (ri, ci, row, ceil) {
emitEvent (type, ri, ci, row, ceil) {
const { ceils, rowIndex } = row
this.$emit('click', {
this.$emit(type, {
row: ceils,
ceil,
rowIndex,

View File

@ -153,9 +153,19 @@ export default {
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
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

View File

@ -40,6 +40,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
@ -53,9 +55,9 @@ export default {
default: () => ({})
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
gradientId: `water-level-pond-${timestamp}`,
gradientId: `water-level-pond-${id}`,
defaultConfig: {
/**

View File

@ -37,3 +37,11 @@ export function getPointDistance (pointOne, pointTwo) {
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)
})
}

View File

@ -1,6 +1,6 @@
{
"name": "@jiaminghi/data-view",
"version": "2.8.0",
"version": "2.9.1",
"author": "JiaMing <743192023@qq.com>",
"description": "Vue Large screen data display component library",
"main": "lib/index.js",

View File

@ -28,7 +28,7 @@ export default {
default: () => ({})
}
},
data () {
data() {
return {
defaultConfig: {
/**
@ -94,7 +94,13 @@ export default {
* @type {String}
* @default animationFrame = 50
*/
animationFrame: 50
animationFrame: 50,
/**
* @description showOriginValue
* @type {Boolean}
* @default showOriginValue = false
*/
showOriginValue: false
},
mergedConfig: null,
@ -107,34 +113,47 @@ export default {
}
},
computed: {
digitalFlop () {
digitalFlop() {
const { mergedConfig, activeIndex } = this
if (!mergedConfig) return {}
const { digitalFlopStyle, digitalFlopToFixed, data } = mergedConfig
const {
digitalFlopStyle,
digitalFlopToFixed,
data,
showOriginValue
} = mergedConfig
const value = data.map(({ value }) => value)
const sum = value.reduce((all, v) => all + v, 0)
let displayValue
const percent = parseFloat(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 {
content: '{nt}%',
number: [percent],
content: showOriginValue ? '{nt}' : '{nt}%',
number: [displayValue],
style: digitalFlopStyle,
toFixed: digitalFlopToFixed
}
},
ringName () {
ringName() {
const { mergedConfig, activeIndex } = this
if (!mergedConfig) return ''
return mergedConfig.data[activeIndex].name
},
fontSize () {
fontSize() {
const { mergedConfig } = this
if (!mergedConfig) return ''
@ -143,7 +162,7 @@ export default {
}
},
watch: {
config () {
config() {
const { animationHandler, mergeConfig, setRingOption } = this
clearTimeout(animationHandler)
@ -156,7 +175,7 @@ export default {
}
},
methods: {
init () {
init() {
const { initChart, mergeConfig, setRingOption } = this
initChart()
@ -165,17 +184,20 @@ export default {
setRingOption()
},
initChart () {
initChart() {
const { $refs } = this
this.chart = new Charts($refs['active-ring-chart'])
},
mergeConfig () {
mergeConfig() {
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 option = getRingOption()
@ -184,7 +206,7 @@ export default {
ringAnimation()
},
getRingOption () {
getRingOption() {
const { mergedConfig, getRealRadius } = this
const radius = getRealRadius()
@ -206,7 +228,7 @@ export default {
color: mergedConfig.color
}
},
getRealRadius (active = false) {
getRealRadius(active = false) {
const { mergedConfig, chart } = this
const { radius, activeRadius, lineWidth } = mergedConfig
@ -217,14 +239,15 @@ export default {
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 outSideRadius = realRadius + halfLineWidth
return [insideRadius, outSideRadius]
},
ringAnimation () {
ringAnimation() {
let { activeIndex, getRingOption, chart, getRealRadius } = this
const radius = getRealRadius()
@ -257,12 +280,12 @@ export default {
}, activeTimeGap)
}
},
mounted () {
mounted() {
const { init } = this
init()
},
beforeDestroy () {
beforeDestroy() {
const { animationHandler } = this
clearTimeout(animationHandler)

View File

@ -216,6 +216,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -245,10 +246,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-11',
filterId: `border-box-11-filterId-${timestamp}`,
filterId: `border-box-11-filterId-${id}`,
defaultColor: ['#8aaafb', '#1f33a2'],

View File

@ -92,6 +92,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -113,10 +114,10 @@ export default {
}
},
data () {
const timestamp = +new Date()
const id = uuid()
return {
ref: 'border-box-12',
filterId: `borderr-box-12-filterId-${timestamp}`,
filterId: `borderr-box-12-filterId-${id}`,
defaultColor: ['#2e6099', '#7ce7fd'],

View File

@ -61,7 +61,6 @@ export default {
}
},
data () {
const timestamp = +new Date()
return {
ref: 'border-box-13',

View File

@ -4,7 +4,7 @@
<defs>
<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"
/>
<radialGradient
@ -25,7 +25,7 @@
<circle cx="0" cy="0" r="150" :fill="`url(#${gradient})`">
<animateMotion
: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"
repeatCount="indefinite"
/>
@ -65,6 +65,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -85,15 +86,19 @@ export default {
backgroundColor: {
type: String,
default: 'transparent'
},
reverse: {
type: Boolean,
default: false
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-8',
path: `border-box-8-path-${timestamp}`,
gradient: `border-box-8-gradient-${timestamp}`,
mask: `border-box-8-mask-${timestamp}`,
path: `border-box-8-path-${id}`,
gradient: `border-box-8-gradient-${id}`,
mask: `border-box-8-mask-${id}`,
defaultColor: ['#235fa7', '#4fd2dd'],
@ -105,6 +110,13 @@ export default {
const { width, height } = this
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: {

View File

@ -125,6 +125,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -144,12 +145,12 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'border-box-9',
gradientId: `border-box-9-gradient-${timestamp}`,
maskId: `border-box-9-mask-${timestamp}`,
gradientId: `border-box-9-gradient-${id}`,
maskId: `border-box-9-mask-${id}`,
defaultColor: ['#11eefd', '#0078d2'],

View File

@ -7,16 +7,23 @@
</div>
<div class="capsule-container">
<div
class="capsule-item"
v-for="(capsule, index) in capsuleLength"
:key="index"
>
<div :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"></div>
<div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
<div
class="capsule-item-column"
:style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
>
<div
v-if="mergedConfig.showValue"
class="capsule-item-value"
>{{ capsuleValue[index] }}</div>
</div>
</div>
<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>
@ -38,7 +45,7 @@ export default {
default: () => ({})
}
},
data () {
data() {
return {
defaultConfig: {
/**
@ -54,42 +61,61 @@ export default {
* @default color = ['#37a2da', '#32c5e9', '#67e0e3', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293']
* @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
* @type {String}
* @default unit = ''
*/
unit: ''
unit: '',
/**
* @description Show item value
* @type {Boolean}
* @default showValue = false
*/
showValue: false
},
mergedConfig: null,
capsuleLength: [],
labelData: []
capsuleValue: [],
labelData: [],
labelDataLength: []
}
},
watch: {
config () {
config() {
const { calcData } = this
calcData()
}
},
methods: {
calcData () {
calcData() {
const { mergeConfig, calcCapsuleLengthAndLabelData } = this
mergeConfig()
calcCapsuleLengthAndLabelData()
},
mergeConfig () {
mergeConfig() {
let { config, defaultConfig } = this
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
this.mergedConfig = deepMerge(
deepClone(defaultConfig, true),
config || {}
)
},
calcCapsuleLengthAndLabelData () {
calcCapsuleLengthAndLabelData() {
const { data } = this.mergedConfig
if (!data.length) return
@ -98,14 +124,24 @@ export default {
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
this.labelData = Array.from(new Set(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
calcData()
@ -150,21 +186,30 @@ export default {
margin: 5px 0px;
border-radius: 5px;
div {
.capsule-item-column {
position: relative;
height: 8px;
margin-top: 1px;
border-radius: 5px;
transition: all 0.3s;
display: flex;
justify-content: flex-end;
align-items: center;
.capsule-item-value {
font-size: 12px;
transform: translateX(100%);
}
}
}
.unit-label {
height: 20px;
font-size: 12px;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
align-items: center;
}
.unit-text {

View File

@ -5,6 +5,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import autoResize from '../../../mixin/autoResize'
import Charts from '@jiaminghi/charts'
@ -19,10 +21,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: `charts-container-${timestamp}`,
chartRef: `chart-${timestamp}`,
ref: `charts-container-${id}`,
chartRef: `chart-${id}`,
chart: null
}

View File

@ -147,6 +147,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -162,17 +163,17 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'decoration-10',
animationId1: `d10ani1${timestamp}`,
animationId2: `d10ani2${timestamp}`,
animationId3: `d10ani3${timestamp}`,
animationId4: `d10ani4${timestamp}`,
animationId5: `d10ani5${timestamp}`,
animationId6: `d10ani6${timestamp}`,
animationId7: `d10ani7${timestamp}`,
animationId1: `d10ani1${id}`,
animationId2: `d10ani2${id}`,
animationId3: `d10ani3${id}`,
animationId4: `d10ani4${id}`,
animationId5: `d10ani5${id}`,
animationId6: `d10ani6${id}`,
animationId7: `d10ani7${id}`,
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],

View File

@ -72,7 +72,6 @@ export default {
}
},
data () {
const timestamp = Date.now()
return {
ref: 'decoration-11',

View File

@ -83,23 +83,26 @@ export default {
display: flex;
overflow: hidden;
position: absolute;
flex: 1;
}
.normal {
height: 0% !important;
animation: ani-height 3s ease-in-out infinite;
left: 50%;
margin-left: -2px;
}
.reverse {
width: 0% !important;
animation: ani-width 3s ease-in-out infinite;
top: 50%;
margin-top: -2px;
}
@keyframes ani-height {
0% {
height: 0%;
}
70% {
height: 100%;
}
@ -110,6 +113,10 @@ export default {
}
@keyframes ani-width {
0% {
width: 0%;
}
70% {
width: 100%;
}

View File

@ -85,6 +85,7 @@
<script>
import autoResize from '../../../mixin/autoResize'
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
@ -106,11 +107,11 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'decoration-9',
polygonId: `decoration-9-polygon-${timestamp}`,
polygonId: `decoration-9-polygon-${id}`,
svgWH: [100, 100],

View File

@ -53,6 +53,12 @@ export default {
* @example textAlign = 'center' | 'left' | 'right'
*/
textAlign: 'center',
/**
* @description rowGap
* @type {Number}
@default rowGap = 0
*/
rowGap: 0,
/**
* @description Text style configuration
* @type {Object} {CRender Class Style}
@ -61,6 +67,11 @@ export default {
fontSize: 30,
fill: '#3de7c9'
},
/**
* @description Number formatter
* @type {Null|Function}
*/
formatter: undefined,
/**
* @description CRender animationCurve
* @type {String}
@ -124,7 +135,7 @@ export default {
})
},
getShape () {
const { number, content, toFixed, textAlign } = this.mergedConfig
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
const [w, h] = this.renderer.area
@ -137,7 +148,9 @@ export default {
number,
content,
toFixed,
position
position,
rowGap,
formatter
}
},
getStyle () {

View File

@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
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'
@ -171,14 +171,14 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'dv-flyline-chart',
unique: Math.random(),
maskId: `flyline-mask-id-${timestamp}`,
maskCircleId: `mask-circle-id-${timestamp}`,
gradientId: `gradient-id-${timestamp}`,
gradient2Id: `gradient2-id-${timestamp}`,
maskId: `flyline-mask-id-${id}`,
maskCircleId: `mask-circle-id-${id}`,
gradientId: `gradient-id-${id}`,
gradient2Id: `gradient2-id-${id}`,
defaultConfig: {
/**

View File

@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
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'
@ -173,12 +173,12 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
ref: 'dv-flyline-chart-enhanced',
unique: Math.random(),
flylineGradientId: `flyline-gradient-id-${timestamp}`,
haloGradientId: `halo-gradient-id-${timestamp}`,
flylineGradientId: `flyline-gradient-id-${id}`,
haloGradientId: `halo-gradient-id-${id}`,
/**
* @description Type Declaration
*

View File

@ -44,6 +44,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
@ -57,10 +59,10 @@ export default {
}
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
gradientId1: `percent-pond-gradientId1-${timestamp}`,
gradientId2: `percent-pond-gradientId2-${timestamp}`,
gradientId1: `percent-pond-gradientId1-${id}`,
gradientId2: `percent-pond-gradientId2-${id}`,
width: 0,
height: 0,
@ -234,10 +236,10 @@ export default {
await $nextTick()
const dom = $refs['percent-pond']
const { clientWidth, clientHeight } = $refs['percent-pond']
this.width = dom.clientWidth
this.height = dom.clientHeight
this.width = clientWidth
this.height = clientHeight
},
mergeConfig () {
const { config, defaultConfig } = this

View File

@ -37,7 +37,9 @@
:style="`width: ${widths[ci]}px;`"
:align="aligns[ci]"
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>
@ -146,7 +148,14 @@ export default {
* @default carousel = 'single'
* @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,
@ -182,6 +191,18 @@ export default {
}
},
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 () {
const { calcData } = this
@ -355,10 +376,10 @@ export default {
clearTimeout(animationHandler)
},
emitEvent (ri, ci, row, ceil) {
emitEvent (type, ri, ci, row, ceil) {
const { ceils, rowIndex } = row
this.$emit('click', {
this.$emit(type, {
row: ceils,
ceil,
rowIndex,

View File

@ -153,9 +153,19 @@ export default {
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
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

View File

@ -40,6 +40,8 @@
</template>
<script>
import { uuid } from '../../../util/index'
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
@ -53,9 +55,9 @@ export default {
default: () => ({})
},
data () {
const timestamp = Date.now()
const id = uuid()
return {
gradientId: `water-level-pond-${timestamp}`,
gradientId: `water-level-pond-${id}`,
defaultConfig: {
/**

View File

@ -37,3 +37,11 @@ export function getPointDistance (pointOne, pointTwo) {
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)
})
}