update dist and lib

This commit is contained in:
jiaming743 2020-05-06 14:15:15 +08:00
parent 8e5f279b6e
commit 6ce83e1fd8
5 changed files with 937 additions and 960 deletions

1837
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

@ -96,11 +96,11 @@ export default {
*/ */
animationFrame: 50, animationFrame: 50,
/** /**
* @description CRender showOriginalValue * @description showOriginValue
* @type {Boolean} * @type {Boolean}
* @default showOriginalValue = false * @default showOriginValue = false
*/ */
showOriginalValue: false showOriginValue: false
}, },
mergedConfig: null, mergedConfig: null,
@ -122,14 +122,14 @@ export default {
digitalFlopStyle, digitalFlopStyle,
digitalFlopToFixed, digitalFlopToFixed,
data, data,
showOriginalValue showOriginValue
} = mergedConfig } = mergedConfig
const value = data.map(({ value }) => value) const value = data.map(({ value }) => value)
let displayValue let displayValue
if (showOriginalValue) { if (showOriginValue) {
displayValue = value[activeIndex] displayValue = value[activeIndex]
} else { } else {
const sum = value.reduce((all, v) => all + v, 0) const sum = value.reduce((all, v) => all + v, 0)
@ -140,7 +140,7 @@ export default {
} }
return { return {
content: showOriginalValue ? '{nt}' : '{nt}%', content: showOriginValue ? '{nt}' : '{nt}%',
number: [displayValue], number: [displayValue],
style: digitalFlopStyle, style: digitalFlopStyle,
toFixed: digitalFlopToFixed toFixed: digitalFlopToFixed

View File

@ -31,28 +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; 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 div .capsule-item-val { .dv-capsule-chart .capsule-item .capsule-item-column .capsule-item-value {
position: absolute;
top: -5px;
font-size: 12px; 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; position: relative;
} display: flex;
.dv-capsule-chart .unit-label:not(:first-child) { justify-content: space-between;
text-align: right; align-items: center;
}
.dv-capsule-chart .unit-label div {
position: absolute;
} }
.dv-capsule-chart .unit-text { .dv-capsule-chart .unit-text {
text-align: right; text-align: right;

View File

@ -9,13 +9,13 @@
<div class="capsule-container"> <div class="capsule-container">
<div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index"> <div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
<div <div
class="capsule-item-column"
:style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`" :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
> >
<span <div
v-if="mergedConfig.showVal" v-if="mergedConfig.showValue"
class="capsule-item-val" class="capsule-item-value"
:style="`right:-${`${capsuleValue[index]}`.length * 7}px`" >{{ capsuleValue[index] }}</div>
>{{ capsuleValue[index] }}</span>
</div> </div>
</div> </div>
@ -23,7 +23,6 @@
<div <div
v-for="(label, index) in labelData" v-for="(label, index) in labelData"
:key="label + index" :key="label + index"
:style="calcUnitLabelStyle(index)"
>{{ label }}</div> >{{ label }}</div>
</div> </div>
</div> </div>
@ -77,7 +76,12 @@ export default {
* @default unit = '' * @default unit = ''
*/ */
unit: '', unit: '',
showVal: false /**
* @description Show item value
* @type {Boolean}
* @default showValue = false
*/
showValue: false
}, },
mergedConfig: null, mergedConfig: null,
@ -135,15 +139,6 @@ export default {
this.labelDataLength = Array.from(labelData).map(v => this.labelDataLength = Array.from(labelData).map(v =>
maxValue ? v / maxValue : 0 maxValue ? v / maxValue : 0
) )
},
/**
* 计算x轴label位置
*/
calcUnitLabelStyle(index) {
if (this.labelData.length - 1 === index) {
return `right: 0;`
}
return `left: ${this.labelDataLength[index] * 100}%;`
} }
}, },
mounted() { mounted() {