Commit 28d9ed5f by chenshu

feat:数据面板完成

parent 66140de6
...@@ -56,8 +56,8 @@ class Home extends React.Component { ...@@ -56,8 +56,8 @@ class Home extends React.Component {
if (res.success) { if (res.success) {
const dataList = res.result.map(item => ({ const dataList = res.result.map(item => ({
time: moment(item.dateline).format('MM-DD'), time: moment(item.dateline).format('MM-DD'),
commentCount: item.studyNum, studyNum: item.studyNum,
commentRate: item.studyTime, studyTime: Math.round(item.studyTime / 6) / 10,
})) }))
this.createChart(dataList); this.createChart(dataList);
} }
...@@ -104,11 +104,11 @@ class Home extends React.Component { ...@@ -104,11 +104,11 @@ class Home extends React.Component {
} }
this._chart.clear(); this._chart.clear();
this._chart.source(data, { this._chart.source(data, {
commentRate: { studyTime: {
formatter: (val) => { formatter: (val) => {
return val return val
}, },
// tickCount: 5, tickCount: 5,
}, },
time: { time: {
formatter: (val) => { formatter: (val) => {
...@@ -119,11 +119,11 @@ class Home extends React.Component { ...@@ -119,11 +119,11 @@ class Home extends React.Component {
}, },
range: [0.06, 0.94] range: [0.06, 0.94]
}, },
commentCount: { studyNum: {
formatter: (val) => { formatter: (val) => {
return val return val
}, },
// tickCount: 5 tickCount: 5
} }
}); });
this._chart.axis('time', { this._chart.axis('time', {
...@@ -149,7 +149,7 @@ class Home extends React.Component { ...@@ -149,7 +149,7 @@ class Home extends React.Component {
} }
} }
}) })
this._chart.axis('commentRate', { this._chart.axis('studyTime', {
label: { label: {
textStyle: { textStyle: {
fill: '#666666', fill: '#666666',
...@@ -157,16 +157,16 @@ class Home extends React.Component { ...@@ -157,16 +157,16 @@ class Home extends React.Component {
} }
} }
}) })
this._chart.line().position('time*commentCount').color('#5289FA').tooltip('time*commentCount', function( time, commentCount){ this._chart.line().position('time*studyNum').color('#5289FA').tooltip('time*studyNum', function( time, studyNum){
return { return {
name: '学习人数', name: '学习人数',
value: commentCount value: studyNum
} }
}); });
this._chart.line().position('time*commentRate').color('#FFB714').tooltip('time*commentRate', function( time, commentRate){ this._chart.line().position('time*studyTime').color('#FFB714').tooltip('time*studyTime', function( time, studyTime){
return { return {
name: '人均学习时长', name: '人均学习时长',
value: commentRate value: studyTime
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment