forked from Gitlink/forgeplus-react
pull
This commit is contained in:
commit
c48d8510ae
|
@ -8,6 +8,7 @@ import NoneData from '../Nodata';
|
||||||
import IssueLine from './issueLine';
|
import IssueLine from './issueLine';
|
||||||
import BranchLine from './branchLine';
|
import BranchLine from './branchLine';
|
||||||
import SmoothLine from './smoothLine';
|
import SmoothLine from './smoothLine';
|
||||||
|
import SmoothLineTwo from './smoothLineTwo';
|
||||||
import ProjectScale from './ProjectScale';
|
import ProjectScale from './ProjectScale';
|
||||||
import Pie from './pie';
|
import Pie from './pie';
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ class Activity extends Component{
|
||||||
|
|
||||||
ai_shang_v1_url:undefined,
|
ai_shang_v1_url:undefined,
|
||||||
ai_shang_v2_url:undefined,
|
ai_shang_v2_url:undefined,
|
||||||
ai_shang_v3_url:undefined
|
ai_shang_v3_url:undefined,
|
||||||
|
ai_shang_v4_url:undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidMount=()=>{
|
componentDidMount=()=>{
|
||||||
|
@ -120,7 +122,8 @@ class Activity extends Component{
|
||||||
issues_count:result.data.issues_count,
|
issues_count:result.data.issues_count,
|
||||||
ai_shang_v1_url:result.data.ai_shang_v1_url,
|
ai_shang_v1_url:result.data.ai_shang_v1_url,
|
||||||
ai_shang_v2_url:result.data.ai_shang_v2_url,
|
ai_shang_v2_url:result.data.ai_shang_v2_url,
|
||||||
ai_shang_v3_url:result.data.ai_shang_v3_url
|
ai_shang_v3_url:result.data.ai_shang_v3_url,
|
||||||
|
ai_shang_v4_url:result.data.ai_shang_v4_url
|
||||||
})
|
})
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +171,7 @@ class Activity extends Component{
|
||||||
render(){
|
render(){
|
||||||
const { time , data , page , project_trends , isSpin ,
|
const { time , data , page , project_trends , isSpin ,
|
||||||
pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count,
|
pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count,
|
||||||
type,status , codeStatus ,
|
type,status , codeStatus , ai_shang_v4_url,
|
||||||
ai_shang_v1_url ,ai_shang_v2_url, ai_shang_v3_url } = this.state;
|
ai_shang_v1_url ,ai_shang_v2_url, ai_shang_v3_url } = this.state;
|
||||||
let name = time ? ARRAY.filter(item=>item.id === parseInt(time,0)) :[{name:"全部"}];
|
let name = time ? ARRAY.filter(item=>item.id === parseInt(time,0)) :[{name:"全部"}];
|
||||||
|
|
||||||
|
@ -259,6 +262,9 @@ class Activity extends Component{
|
||||||
<span className="echartTitle">项目演化图</span>
|
<span className="echartTitle">项目演化图</span>
|
||||||
{/* <ProjectScale data={undefined} url={ai_shang_v2_url}/> */}
|
{/* <ProjectScale data={undefined} url={ai_shang_v2_url}/> */}
|
||||||
<SmoothLine url={ai_shang_v2_url}/>
|
<SmoothLine url={ai_shang_v2_url}/>
|
||||||
|
<div style={{marginTop:"40px"}}>
|
||||||
|
<SmoothLineTwo url={ai_shang_v4_url}/>
|
||||||
|
</div>
|
||||||
<span className="echartTitle">分支演化图</span>
|
<span className="echartTitle">分支演化图</span>
|
||||||
<BranchLine url={ai_shang_v1_url}/>
|
<BranchLine url={ai_shang_v1_url}/>
|
||||||
<span className="echartTitle">Issue演化图</span>
|
<span className="echartTitle">Issue演化图</span>
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
import React ,{ useEffect } from 'react';
|
||||||
|
import echarts from 'echarts/lib/echarts';
|
||||||
|
import 'echarts/lib/chart/line';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
function SmoothLineTwo({url}) {
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(url){
|
||||||
|
getInit(url);
|
||||||
|
}
|
||||||
|
},[url])
|
||||||
|
|
||||||
|
function getInit(url){
|
||||||
|
axios.get(url).then(result=>{
|
||||||
|
if(result && result.data){
|
||||||
|
Init(result.data);
|
||||||
|
}
|
||||||
|
}).catch(error=>{})
|
||||||
|
}
|
||||||
|
function Init(data) {
|
||||||
|
var huan_val = document.getElementById("smoothlinetwo");
|
||||||
|
var myEcharts = echarts.init(huan_val);
|
||||||
|
let date = [];
|
||||||
|
let array = [];
|
||||||
|
let array1 = [];
|
||||||
|
let array2 = [];
|
||||||
|
let array3 = [];
|
||||||
|
for(var i= 0;i<data.length;i++){
|
||||||
|
date.push(data[i][0]);
|
||||||
|
array.push(data[i][1]);
|
||||||
|
array1.push(data[i][2]);
|
||||||
|
array2.push(data[i][3]);
|
||||||
|
array3.push(data[i][4]);
|
||||||
|
}
|
||||||
|
let option = {
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: date
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '5%',
|
||||||
|
right: '1%',
|
||||||
|
bottom: '18%'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['index_split', 'index_shrink' ,'index_merge', 'index_expand']
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
color: ['#ff6868','#1684fc',"#02cafd",'#a491d7','#e840f7',"#36bba6","#7b32b2"],
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
dataZoom: [
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
start: 0,
|
||||||
|
end: 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: 0,
|
||||||
|
end: 10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: array,
|
||||||
|
type: 'line',
|
||||||
|
name:"index_split",
|
||||||
|
smooth: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: array1,
|
||||||
|
type: 'line',
|
||||||
|
name:"index_shrink",
|
||||||
|
smooth: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: array2,
|
||||||
|
type: 'line',
|
||||||
|
name:"index_merge",
|
||||||
|
smooth: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: array3,
|
||||||
|
type: 'line',
|
||||||
|
name:"index_expand",
|
||||||
|
smooth: true
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
||||||
|
myEcharts.setOption(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div id="smoothlinetwo" style={{height:"400px"}}></div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default SmoothLineTwo;
|
Loading…
Reference in New Issue