echarts--dataのデータを動的にバインド
2762 ワード
echartsにおけるdataのデータは一般的にJSON配列であり,すべてのデータフォーマットがJSONまたはJSON配列であるバックグラウンドのデータを得た後に自己接合して提示するデータとすることができる.したがって、
forceOption = {
title : {
text : 'title',
x : 'center',
y : '0',
textStyle : {
fontWeight : 'normal',
}
},
tooltip : {},
animationDurationUpdate : 1500,
animationEasingUpdate : 'quinticInOut',
textStyle : {
color : '#000'
},
series : [ {
type : 'graph',
tooltip : {
backgroundColor : 'skyblue',
// formatter: "{b}
{a} : {c} h "
},
layout : 'none',
symbolSize : 10,
roam : true,
label : {
normal : {
show : true
}
},
edgeSymbol : [ 'circle', 'arrow' ],
edgeSymbolSize : [ 4, 10 ],
edgeLabel : {
normal : {
textStyle : {
fontSize : 12
},
}
},
// Data, JSON、JSON ,
data : getDataToFoce(),
links : getLinkToFoce(),
lineStyle : {
normal : {
opacity : 0.9,
width : 2,
curveness : 0.2
}
}
} ]
};
var forceChart = echarts.init(document.getElementById('forchart'));
forceChart.setOption(forceOption);