no message
Former-commit-id: 759d9fc30b3577fa407465d9bce11b1894cd1827 Former-commit-id: c01f76e995b3a94ebed8c6485978f04f1f312b24 Former-commit-id: ddcd4da77f33fb0330afebe837e3fadd15f44595
This commit is contained in:
@@ -16,13 +16,21 @@ export default {
|
|||||||
this.creatChart()
|
this.creatChart()
|
||||||
// 本组件的特殊设置
|
// 本组件的特殊设置
|
||||||
this.chart.source(this.data)
|
this.chart.source(this.data)
|
||||||
this.chart.axis('x', {
|
this.chart.scale({
|
||||||
label: {
|
y: {
|
||||||
offset: 12
|
min: 0
|
||||||
|
},
|
||||||
|
x: {
|
||||||
|
range: [0, 1]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.chart.coord().transpose()
|
this.chart.tooltip({
|
||||||
this.chart.interval().position('x*y')
|
crosshairs: {
|
||||||
|
type: 'line'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.chart.area().position('x*y')
|
||||||
|
this.chart.line().position('x*y').size(2)
|
||||||
// 渲染图表
|
// 渲染图表
|
||||||
this.chart.render()
|
this.chart.render()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,7 +6,17 @@ Mock.mock('/api/chart/G2Area', 'post', ({body, type, url}) => {
|
|||||||
switch (_body.type) {
|
switch (_body.type) {
|
||||||
// 基础折线图
|
// 基础折线图
|
||||||
case 'base': {
|
case 'base': {
|
||||||
return fn.returnMaker(['3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月'].map(x => ({x, y: fn.r()})))
|
let last = 0
|
||||||
|
const data = ['3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月'].map(x => ({
|
||||||
|
x,
|
||||||
|
y: 0
|
||||||
|
})).map(e => {
|
||||||
|
e.y = last + fn.r()
|
||||||
|
last = e.y
|
||||||
|
return e
|
||||||
|
})
|
||||||
|
last = 0
|
||||||
|
return fn.returnMaker(data)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -111,8 +111,7 @@ export default {
|
|||||||
{
|
{
|
||||||
api: {url: '/api/chart/G2Area', data: {type: 'base'}},
|
api: {url: '/api/chart/G2Area', data: {type: 'base'}},
|
||||||
refName: 'G2AreaBase',
|
refName: 'G2AreaBase',
|
||||||
data: [],
|
data: []
|
||||||
padding: [30, 30, 30, 30]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
layout: {
|
layout: {
|
||||||
|
|||||||
Reference in New Issue
Block a user