Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ Follwing `props` are used while initialization
| start-angle | Number | Initial angle (for `0` value) <br> Default: `-Math.PI` |
| insert-mode | String | Canvas insertion mode: append or prepend it into the parent element <br> Default: `"prepend"` |
| thickness | Number | Width of the arc. By default it's automatically calculated as 1/14 of `size` but you may set your own number <br> Default: `"auto"` |
| show-percent | Boolean | Show loaded percentage inside circle. If `inner-text` property is set then percentage will not be shown. <br> Default : `true`|
| show-percent | Boolean | Show loaded percentage inside circle. If `inner-text` property is set then percentage will not be shown. <br> Default : `true`
| show-negative-percent | Boolean | Show loaded percentage inside circle as a negative number. When used with `reverse` set to `true` and a positive number for `progress` the progress will fill in reverse and show as a negative percentage. <br> Default : `false`|
---

## Events
Expand Down
18 changes: 9 additions & 9 deletions dev/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/bundle.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vue-circle-progress.js

Large diffs are not rendered by default.

28 changes: 21 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@
<p style="margin-top:0;font-size:12px;">Slot!</p>
</vue-circle>
<button @click="redraw">Redraw</button>

<p>
Negative Percentage Example!
</p>
<vue-circle
ref="myprogressNegative"
:progress="p"
:size="100"
:reverse="true"
line-cap="round"
:fill="fill"
empty-fill="rgba(0, 0, 0, .1)"
:animation-start-value="0.0"
:start-angle="0"
insert-mode="append"
:animation="{ duration: 1200, easing: 'easeOutBounce' }"
:thickness="5"
:show-percent="true"
:show-negative-percent="true"
@vue-circle-progress="progress"
@vue-circle-end="progress_end"
>
<p style="margin-top:0;font-size:12px;">Slot!</p>
</vue-circle>
<button @click="redrawNegative">Redraw</button>
</div>
</template>

Expand Down Expand Up @@ -50,6 +75,9 @@
},
redraw(){
this.$refs.myprogress.updateProgress(60);
},
redrawNegative(){
this.$refs.myprogressNegative.updateProgress(60);
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export default {
showLegend:{
type : Boolean,
default : true
},
showNegativePercent:{
type : Boolean,
default : false
},
},
mounted(){
Expand Down Expand Up @@ -113,7 +117,9 @@ export default {
function renderCircleBody(self, value){
value = !!value ? value : vm.progress;
if (!vm.showLegend){ return }
else if (vm.showLegend && vm.showPercent) {
else if (vm.showLegend && vm.showPercent && vm.showNegativePercent) {
$(self).find('span.legend-text').html("-"+Math.floor(value*vm.scale)+"%");
} else if (vm.showLegend && vm.showPercent) {
$(self).find('span.legend-text').html(Math.floor(value*vm.scale)+"%");
} else if (vm.showLegend && !vm.showPercent) {
$(self).find('span.legend-text').html((value*vm.scale).toFixed(vm.precision));
Expand Down