From 2fbfb13871f9ec82a300da27f9348e49990b92cc Mon Sep 17 00:00:00 2001 From: Alexey Velikiy Date: Sun, 26 Feb 2017 18:03:56 +0100 Subject: [PATCH] pie chart --- src/components/index.vue | 2 +- src/d3-components/bars-style-basic.vue | 2 - .../pie-chart-local-component/index.vue | 61 ++++++++++++ .../pie-chart-local-component/pie.vue | 92 +++++++++++++++++++ src/router/demos.js | 13 ++- 5 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 src/d3-components/pie-chart-local-component/index.vue create mode 100644 src/d3-components/pie-chart-local-component/pie.vue diff --git a/src/components/index.vue b/src/components/index.vue index 1a2743e..6e00c43 100644 --- a/src/components/index.vue +++ b/src/components/index.vue @@ -29,7 +29,7 @@ ul { /*list-style-type: none;*/ padding: 0; margin: auto; - width: 150px; + width: 300px; } li { diff --git a/src/d3-components/bars-style-basic.vue b/src/d3-components/bars-style-basic.vue index 7d352ae..7a5d9d2 100644 --- a/src/d3-components/bars-style-basic.vue +++ b/src/d3-components/bars-style-basic.vue @@ -26,8 +26,6 @@ export default { {name: 'three', val: 200} ] - console.log(this.$styles); - var x = d3.scaleBand() .rangeRound([0, width]).padding(0.1) .domain(data.map(d => d.name)); diff --git a/src/d3-components/pie-chart-local-component/index.vue b/src/d3-components/pie-chart-local-component/index.vue new file mode 100644 index 0000000..9987812 --- /dev/null +++ b/src/d3-components/pie-chart-local-component/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/d3-components/pie-chart-local-component/pie.vue b/src/d3-components/pie-chart-local-component/pie.vue new file mode 100644 index 0000000..8094d03 --- /dev/null +++ b/src/d3-components/pie-chart-local-component/pie.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/router/demos.js b/src/router/demos.js index ef3b1ec..cd492c2 100644 --- a/src/router/demos.js +++ b/src/router/demos.js @@ -2,12 +2,12 @@ const config = require('config.json'); export const routes = [ { - name: 'Circle mount', + name: 'Circle: mount', path: '/circle-mount', component: require('d3-components/circle-mount') }, { - name: 'Size controller', + name: 'Circle: size controller', path: '/size-controller', component: require('d3-components/size-controller') }, @@ -20,12 +20,19 @@ export const routes = [ name: 'Bars: styles scoped', path: '/bars-style-scoped', component: require('d3-components/bars-style-scoped') + }, + { + name: 'Pie chart: local component & props', + path: '/pie-chart-local-component', + folder: true, + component: require('d3-components/pie-chart-local-component/index') } ].map(r => { var res = r; res.href = "#" + r.path; res.source = config.githubLink + config.d3ComponentsPath + - r.path + '.vue' + r.path + + (r.folder ? '' : '.vue') return res; })