From 1e06ffe151f585d48494959de7bf92b14f41e0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8?= <1711467488@qq.com> Date: Mon, 19 Feb 2018 10:15:00 +0800 Subject: [PATCH] no message Former-commit-id: a93fca08c3279a8a135e52ddad8dd3d42626fb17 Former-commit-id: 265098e111bf7be16c22c23b8b22beff40df2726 Former-commit-id: aa78e1a82a4c3f45882e646defe3f59c29bb97d3 --- .../G2/components/NightingaleRose/base.vue | 18 ++++++++++++------ src/mock/chart/G2NightingaleRose.js | 14 ++++++++++++++ src/mock/chart/G2Pie.js | 2 +- src/mock/chart/register.js | 1 + 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 src/mock/chart/G2NightingaleRose.js diff --git a/src/components/charts/G2/components/NightingaleRose/base.vue b/src/components/charts/G2/components/NightingaleRose/base.vue index c7b08880..e3c8d1b2 100644 --- a/src/components/charts/G2/components/NightingaleRose/base.vue +++ b/src/components/charts/G2/components/NightingaleRose/base.vue @@ -16,13 +16,19 @@ export default { this.creatChart() // 本组件的特殊设置 this.chart.source(this.data) - this.chart.axis('x', { - label: { - offset: 12 - } + this.chart.coord('polar') + this.chart.legend({ + position: 'right', + offsetY: 0, + offsetX: -140 }) - this.chart.coord().transpose() - this.chart.interval().position('x*y') + this.chart.axis(false) + this.chart.interval().position('item*count') + .color('item', this.G2.Global.colors_pie_16) + .style({ + lineWidth: 1, + stroke: '#fff' + }) // 渲染图表 this.chart.render() }, diff --git a/src/mock/chart/G2NightingaleRose.js b/src/mock/chart/G2NightingaleRose.js new file mode 100644 index 00000000..3baa5802 --- /dev/null +++ b/src/mock/chart/G2NightingaleRose.js @@ -0,0 +1,14 @@ +import Mock from 'mockjs' +import * as fn from './_fn' + +Mock.mock('/api/chart/G2NightingaleRose', 'post', ({body, type, url}) => { + const _body = JSON.parse(body) + switch (_body.type) { + // 基础南丁格尔玫瑰图 + case 'base': { + return fn.returnMaker(['中国', '日本', '美国', '法国', '英国'].map(e => ({item: e, count: 100 + fn.r()}))) + } + default: + return {} + } +}) diff --git a/src/mock/chart/G2Pie.js b/src/mock/chart/G2Pie.js index b11f442f..b2a26347 100644 --- a/src/mock/chart/G2Pie.js +++ b/src/mock/chart/G2Pie.js @@ -4,7 +4,7 @@ import * as fn from './_fn' Mock.mock('/api/chart/G2Pie', 'post', ({body, type, url}) => { const _body = JSON.parse(body) switch (_body.type) { - // 基础折线图 + // 基础饼图 case 'base': { return fn.returnMaker(['中国', '日本', '美国', '法国', '英国'].map(e => ({item: e, count: fn.r()}))) } diff --git a/src/mock/chart/register.js b/src/mock/chart/register.js index e2907dde..094c2edc 100644 --- a/src/mock/chart/register.js +++ b/src/mock/chart/register.js @@ -1,4 +1,5 @@ import './G2Bar' import './G2Column' import './G2Line' +import './G2NightingaleRose' import './G2Pie'