Skip to content

Commit bd999a0

Browse files
committed
feat: add empty fill circle
1 parent 4bf31e9 commit bd999a0

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

src/App.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@
3838
<input type="checkbox" v-model="circles[3].loading" />
3939
</div>-->
4040
<div style="border: 1px solid red; display: inline-block">
41-
<ve-progress :size="600" line-position="out 80" :color-fill="emptyColorFill" :progress="progress">
41+
<ve-progress
42+
:size="600"
43+
line-position="out "
44+
empty-line-position="out"
45+
:empty-color-fill="emptyColorFill"
46+
empty-color="transparent"
47+
:progress="progress"
48+
:no-data="noData"
49+
>
4250
</ve-progress>
4351
</div>
4452
<ve-progress

src/components/Circle/Circle.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@
77
transform: `rotate(${angle}deg)`,
88
}"
99
>
10+
<circle
11+
class="ep-circle--empty__fill"
12+
:r="emptyFillRadius"
13+
:cx="position"
14+
:cy="position"
15+
:fill="computedEmptyColorFill"
16+
:class="{ 'ep-circle--nodata': !dataIsAvailable }"
17+
:style="{
18+
transitionDuration: animationDuration,
19+
transitionTimingFunction: styles.transitionTimingFunction,
20+
}"
21+
>
22+
</circle>
1023
<circle
1124
class="ep-circle--empty"
1225
:r="emptyRadius"
1326
:cx="position"
1427
:cy="position"
1528
:stroke="computedEmptyColor"
1629
:stroke-dasharray="emptyDasharray"
17-
:fill="computedEmptyColorFill"
30+
fill="transparent"
1831
:class="{ 'ep-circle--nodata': !dataIsAvailable }"
1932
:style="{
2033
transitionDuration: animationDuration,
@@ -30,11 +43,11 @@
3043
</fade-in-transition>
3144
<circle
3245
class="ep-circle--progress__fill"
33-
:class="animationClass"
3446
:r="fillRadius"
3547
:cx="position"
3648
:cy="position"
3749
:fill="computedColorFill"
50+
:class="{ 'ep-circle--nodata': !dataIsAvailable }"
3851
:style="{ transition: styles.transition }"
3952
>
4053
</circle>

src/components/Circle/circleMixin.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ export default {
4242
emptyRadius() {
4343
return emptyRadius(this.options);
4444
},
45+
emptyFillRadius() {
46+
const { offset, position } = this.options.emptyLinePosition;
47+
if (position === "center") {
48+
return this.emptyRadius;
49+
}
50+
return position === "out"
51+
? this.emptyRadius - offset - this.emptyThickness / 2
52+
: this.emptyRadius + this.emptyThickness / 2;
53+
},
4554

4655
dataIsAvailable() {
4756
return isValidNumber(this.computedProgress) && !this.options.noData;

0 commit comments

Comments
 (0)