Skip to content

Commit

Permalink
feat: bump version and upgrade all deps
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan-maulana-tkp committed Sep 30, 2019
1 parent b7dc4d4 commit e5ec0e4
Show file tree
Hide file tree
Showing 3 changed files with 3,606 additions and 3,189 deletions.
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-doughnut-chart",
"description": "Doughnut chart component for Vue.js, originally created by Greg Willson",
"version": "0.0.5",
"version": "0.1.0",
"license": "MIT",
"author": "Irfan Maulana (https://github.com/mazipan/)",
"homepage": "https://mazipan.github.io/vue-doughnut-chart/",
Expand Down Expand Up @@ -34,37 +34,37 @@
"publish-demo": "node ./publish-demo.js"
},
"devDependencies": {
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"@vue/test-utils": "^1.0.0-beta.25",
"autoprefixer": "^9.3.1",
"@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"@vue/test-utils": "^1.0.0-beta.29",
"autoprefixer": "^9.6.1",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "23.6.0",
"babel-loader": "^8.0.4",
"compression-webpack-plugin": "^2.0.0",
"copy-webpack-plugin": "4.6.0",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"eslint": "^5.9.0",
"eslint-plugin-html": "^5.0.0",
"eslint-plugin-vue": "4.7.1",
"gh-pages": "^2.0.1",
"babel-jest": "24.9.0",
"babel-loader": "^8.0.6",
"compression-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "5.0.4",
"cross-env": "^6.0.0",
"css-loader": "^3.2.0",
"eslint": "^6.5.0",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-vue": "5.2.3",
"gh-pages": "^2.1.1",
"html-webpack-plugin": "^3.2.0",
"jest": "^23.6.0",
"jest": "^24.9.0",
"jest-serializer-vue": "^2.0.2",
"node-sass": "^4.10.0",
"sass-loader": "^7.1.0",
"vue": "^2.5.17",
"vue-jest": "^3.0.0",
"vue-loader": "^15.4.2",
"vue-script2": "^2.0.3",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue": "^2.6.10",
"vue-jest": "^3.0.5",
"vue-loader": "^15.7.1",
"vue-script2": "^2.1.0",
"vue-style-loader": "4.1.2",
"vue-template-compiler": "^2.5.17",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"webpack-serve": "^2.0.2",
"workbox-webpack-plugin": "^3.6.3"
"vue-template-compiler": "^2.6.10",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.1",
"webpack-serve": "^3.2.0",
"workbox-webpack-plugin": "^4.3.1"
},
"dependencies": {}
}
99 changes: 46 additions & 53 deletions src/DoughnutChart.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<template>
<div class="doughnut_chart" style="position:relative;">
<svg
:width="width"
:height="height"
viewBox="0 0 200 200">
<svg :width="width" :height="height" viewBox="0 0 200 200">
<!-- Background circle -->
<path :d="dBg"
fill="transparent"
:stroke="backgroundColor"
:stroke-width="strokeWidth"/>
<path :d="dBg" fill="transparent" :stroke="backgroundColor" :stroke-width="strokeWidth" />
<!-- Move to start position, start drawing arc -->
<path :d="d"
fill="transparent"
:stroke="foregroundColor"
:stroke-width="strokeWidth"/>
<path :d="d" fill="transparent" :stroke="foregroundColor" :stroke-width="strokeWidth" />
</svg>
<div v-if="visibleValue">
<template v-if="passTextAsHtml">
<div v-if="customText.length" :style="customTextStyle" v-html="customText"></div>
</template>
<template v-else>
<div v-if="customText.length" v-html="customText" :class="classValue" :style="customTextStyle"></div>
<div
v-if="customText.length"
v-html="customText"
:class="classValue"
:style="customTextStyle"
></div>
<span v-else-if="visibleEmptyText" :class="classValue" :style="valueStyle">{{ emptyText }}</span>
<span v-else :class="classValue" :style="valueStyle">{{ percent }}%</span>
</template>
Expand All @@ -30,54 +26,54 @@

<script>
export default {
name: 'DoughnutChart',
name: "DoughnutChart",
props: {
percent: {
default: 0,
default: 0
},
foregroundColor: {
type: String,
default: '#1993ff',
default: "#1993ff"
},
backgroundColor: {
type: String,
default: '#ecf6ff',
default: "#ecf6ff"
},
strokeWidth: {
type: Number,
default: 10,
default: 10
},
radius: {
type: Number,
default: 85,
default: 85
},
width: {
type: Number,
default: 200,
default: 200
},
height: {
type: Number,
default: 200,
default: 200
},
visibleValue: {
type: Boolean,
default: false,
default: false
},
emptyText: {
type: String,
default: '',
default: ""
},
classValue: {
type: String,
default: '',
default: ""
},
customText: {
type: String,
default: '',
default: ""
},
passTextAsHtml: {
type: Boolean,
default: false,
default: false
}
},
data() {
Expand Down Expand Up @@ -114,59 +110,56 @@ export default {
},
// If we reach full circle we need to complete the circle, this ties into the rounding error in X coordinate above
z() {
return parseInt(this.percent) === 100 ? 'z' : '';
return parseInt(this.percent) === 100 ? "z" : "";
},
dBg() {
return `M ${this.x} ${this.y} A ${this.radius} ${this.radius} 0 1 1 ${this
.x - 0.0001} ${this.y} z`;
},
d() {
return `M ${this.x} ${this.y} A ${this.radius} ${this.radius} 0 ${
this.largeArc
} 1 ${this.endX} ${this.endY} ${this.z}`;
return `M ${this.x} ${this.y} A ${this.radius} ${this.radius} 0 ${this.largeArc} 1 ${this.endX} ${this.endY} ${this.z}`;
},
valueFromBottom() {
if (this.strokeWidth < 15) {
return (this.height / 2) - this.strokeWidth/1.5;
return this.height / 2 - this.strokeWidth / 1.5;
} else {
return (this.height / 2) - this.strokeWidth/3;
return this.height / 2 - this.strokeWidth / 3;
}
},
valueFromLeft() {
if (this.strokeWidth < 15) {
return (this.width / 2) - this.strokeWidth;
return this.width / 2 - this.strokeWidth;
} else {
return (this.width / 2) - this.strokeWidth;
return this.width / 2 - this.strokeWidth;
}
},
valueStyle() {
return {
color: this.foregroundColor,
bottom: `${this.valueFromBottom}px`,
left: `${this.valueFromLeft}px`,
position: 'absolute',
'font-size': '18px'
position: "absolute",
"font-size": "18px"
};
},
visibleEmptyText() {
return ( parseInt(this.percent) === 0 && this.emptyText !== '')
},
customTextStyle(){
return {
color: this.foregroundColor,
width: `${this.width - 6 * this.strokeWidth}px`,
height: `${this.height/3}px`,
bottom: `${this.height/2 - this.strokeWidth * 3}px`,
left: `${this.valueFromLeft/3}px`,
position: 'absolute',
verticalAlign: 'middle',
wordBreak: 'break-all',
wordWrap: 'break-word',
fontSize: '14px',
textAlign: 'center',
return parseInt(this.percent) === 0 && this.emptyText !== "";
},
customTextStyle() {
return {
color: this.foregroundColor,
width: `${this.width - 6 * this.strokeWidth}px`,
height: `${this.height / 3}px`,
bottom: `${this.height / 2 - this.strokeWidth * 3}px`,
left: `${this.valueFromLeft / 3}px`,
position: "absolute",
verticalAlign: "middle",
wordBreak: "break-all",
wordWrap: "break-word",
fontSize: "14px",
textAlign: "center"
};
}
},
}
};
</script>
Expand Down
Loading

0 comments on commit e5ec0e4

Please sign in to comment.