no message
Former-commit-id: 873a2afd2881efe54dbdc525de801e5062d4fa36 Former-commit-id: dbe6c982d002cc37d1a90ff15773390f1202d058 Former-commit-id: 868b1fd3d94060ac719b84be9a4f1c2e5087a959
This commit is contained in:
@@ -19,12 +19,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 初始化图表
|
// 初始化图表
|
||||||
initHandler () {
|
initHandler () {
|
||||||
this.chart = new this.G2.Chart({
|
this.creatChart()
|
||||||
container: this.$refs.chart,
|
|
||||||
forceFit: this.forceFit,
|
|
||||||
height: this.G2.DomUtil.getHeight(this.$refs.chart),
|
|
||||||
padding: this.padding
|
|
||||||
})
|
|
||||||
this.chart.source(this.data)
|
this.chart.source(this.data)
|
||||||
this.chart.scale('sales', {
|
this.chart.scale('sales', {
|
||||||
tickInterval: 20
|
tickInterval: 20
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 初始化图表
|
// 初始化图表
|
||||||
initHandler () {
|
initHandler () {
|
||||||
this.chart = new this.G2.Chart({
|
this.creatChart()
|
||||||
container: this.$refs.chart,
|
|
||||||
forceFit: this.forceFit,
|
|
||||||
height: this.G2.DomUtil.getHeight(this.$refs.chart),
|
|
||||||
padding: this.padding
|
|
||||||
})
|
|
||||||
this.chart.source(this.data)
|
this.chart.source(this.data)
|
||||||
this.chart.scale('value', {
|
this.chart.scale('value', {
|
||||||
min: 0
|
min: 0
|
||||||
|
|||||||
@@ -29,12 +29,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 初始化图表
|
// 初始化图表
|
||||||
initHandler () {
|
initHandler () {
|
||||||
this.chart = new this.G2.Chart({
|
this.creatChart()
|
||||||
container: this.$refs.chart,
|
|
||||||
forceFit: this.forceFit,
|
|
||||||
height: this.G2.DomUtil.getHeight(this.$refs.chart),
|
|
||||||
padding: this.padding
|
|
||||||
})
|
|
||||||
this.chart.source(this.dvMaker(), {
|
this.chart.source(this.dvMaker(), {
|
||||||
percent: {
|
percent: {
|
||||||
formatter: val => {
|
formatter: val => {
|
||||||
|
|||||||
@@ -59,6 +59,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 创建图表对象
|
||||||
|
creatChart () {
|
||||||
|
this.chart = new this.G2.Chart({
|
||||||
|
container: this.$refs.chart,
|
||||||
|
forceFit: this.forceFit,
|
||||||
|
height: this.G2.DomUtil.getHeight(this.$refs.chart),
|
||||||
|
padding: this.padding
|
||||||
|
})
|
||||||
|
},
|
||||||
// 重绘大小
|
// 重绘大小
|
||||||
resize (width, height) {
|
resize (width, height) {
|
||||||
if (this.chart) {
|
if (this.chart) {
|
||||||
|
|||||||
@@ -8,14 +8,12 @@ Mock.mock('/api/chart/G2Column', 'post', ({body, type, url}) => {
|
|||||||
code: 0,
|
code: 0,
|
||||||
msg: '请求成功',
|
msg: '请求成功',
|
||||||
data: [
|
data: [
|
||||||
{ year: '1951 年', sales: 38 },
|
{ year: '1951', sales: 38 },
|
||||||
{ year: '1952 年', sales: 52 },
|
{ year: '1952', sales: 52 },
|
||||||
{ year: '1956 年', sales: 61 },
|
{ year: '1956', sales: 61 },
|
||||||
{ year: '1957 年', sales: 145 },
|
{ year: '1957', sales: 145 },
|
||||||
{ year: '1958 年', sales: 48 },
|
{ year: '1958', sales: 48 },
|
||||||
{ year: '1959 年', sales: 38 },
|
{ year: '1959', sales: 38 }
|
||||||
{ year: '1960 年', sales: 38 },
|
|
||||||
{ year: '1962 年', sales: 38 }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default {
|
|||||||
layout: [
|
layout: [
|
||||||
{'x': 0, 'y': 0, 'w': 8, 'h': 9, 'i': '0'},
|
{'x': 0, 'y': 0, 'w': 8, 'h': 9, 'i': '0'},
|
||||||
{'x': 8, 'y': 0, 'w': 4, 'h': 9, 'i': '1'},
|
{'x': 8, 'y': 0, 'w': 4, 'h': 9, 'i': '1'},
|
||||||
{'x': 0, 'y': 9, 'w': 5, 'h': 7, 'i': '2'}
|
{'x': 0, 'y': 9, 'w': 4, 'h': 7, 'i': '2'}
|
||||||
],
|
],
|
||||||
colNum: 12,
|
colNum: 12,
|
||||||
rowHeight: 30,
|
rowHeight: 30,
|
||||||
|
|||||||
Reference in New Issue
Block a user