no message
Former-commit-id: 3f4e59a3f2158c33f186f61e983ed9d44250f4f5 Former-commit-id: 3e0685df0095c20d6aa1b98adf60151c2612139c Former-commit-id: 8cfa58bc02611e2f9683e342323222a0a547dfaf
This commit is contained in:
@@ -16,10 +16,10 @@ export default {
|
|||||||
this.creatChart()
|
this.creatChart()
|
||||||
// 本组件的特殊设置
|
// 本组件的特殊设置
|
||||||
this.chart.source(this.data)
|
this.chart.source(this.data)
|
||||||
this.chart.scale('value', {
|
this.chart.scale('y', {
|
||||||
min: 0
|
min: 0
|
||||||
})
|
})
|
||||||
this.chart.scale('year', {
|
this.chart.scale('x', {
|
||||||
range: [0, 1]
|
range: [0, 1]
|
||||||
})
|
})
|
||||||
this.chart.tooltip({
|
this.chart.tooltip({
|
||||||
@@ -27,8 +27,8 @@ export default {
|
|||||||
type: 'line'
|
type: 'line'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.chart.line().position('year*value')
|
this.chart.line().position('x*y')
|
||||||
this.chart.point().position('year*value').size(4).shape('circle').style({
|
this.chart.point().position('x*y').size(4).shape('circle').style({
|
||||||
stroke: '#fff',
|
stroke: '#fff',
|
||||||
lineWidth: 1
|
lineWidth: 1
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ export default {
|
|||||||
this.creatChart()
|
this.creatChart()
|
||||||
// 本组件的特殊设置
|
// 本组件的特殊设置
|
||||||
this.chart.source(this.data, {
|
this.chart.source(this.data, {
|
||||||
month: {
|
x: {
|
||||||
range: [0, 1]
|
range: [0, 1]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.chart.line().position('month*value').shape('hv')
|
this.chart.line().position('x*y').shape('hv')
|
||||||
// 渲染图表
|
// 渲染图表
|
||||||
this.chart.render()
|
this.chart.render()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,17 +16,20 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
|
|||||||
const _body = JSON.parse(body)
|
const _body = JSON.parse(body)
|
||||||
switch (_body.type) {
|
switch (_body.type) {
|
||||||
case 'base': {
|
case 'base': {
|
||||||
let lastValue = 0
|
let last = 0
|
||||||
const year = ['1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999']
|
const year = ['1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999']
|
||||||
const data = year.map(e => ({
|
const data = year.map(e => ({
|
||||||
year: e,
|
year: e,
|
||||||
value: 0
|
value: 0
|
||||||
})).map(e => {
|
})).map(e => {
|
||||||
e.value = lastValue + r()
|
e.value = last + r()
|
||||||
lastValue = e.value
|
last = e.value
|
||||||
return e
|
return e
|
||||||
})
|
}).map(e => ({
|
||||||
lastValue = 0
|
x: e.year,
|
||||||
|
y: e.value
|
||||||
|
}))
|
||||||
|
last = 0
|
||||||
return returnMaker(data)
|
return returnMaker(data)
|
||||||
}
|
}
|
||||||
case 'step': {
|
case 'step': {
|
||||||
@@ -37,7 +40,10 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
|
|||||||
})).map(e => {
|
})).map(e => {
|
||||||
e.value = r()
|
e.value = r()
|
||||||
return e
|
return e
|
||||||
})
|
}).map(e => ({
|
||||||
|
x: e.month,
|
||||||
|
y: e.value
|
||||||
|
}))
|
||||||
return returnMaker(data)
|
return returnMaker(data)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user