echart

12173 단어 프런트 엔드
var option=null,doc=null,mychart=null;
doc=document;
mychart=echarts.init(doc.getElementById("CPUBox"));
$(".chartsBox").height($(".chartsBox").width());
window.addEventListener('resize',function () {
    $(".chartsBox").height($(".chartsBox").width());
},false);

option= {
    tooltip : {
        formatter: "{a} 
{b} : {c}%"
}, toolbox: { show:false, feature: { restore: {}, saveAsImage: {} } }, series: [ { name: 'CPU ', type: 'gauge', axisLine : { show : true, lineStyle : { // lineStyle color : [ // [ 0.5, "#0A69A3" ],//0-50% [ 0.7, "#0A69A3" ],//51%-70% [ 0.9, "#0A69A3" ],//70%-90% [ 1,"#0A69A3" ]//90%-100% ], width : 15// } }, splitLine : { //1020 length : 20, lineStyle : { // lineStyle width : 1 } }, axisTick : { // ( ) length : 15 }, axisLabel : { //“10”“20” color : "black", distance : 5 // }, detail: { // formatter : "{score|{value}%}", offsetCenter: [0, "40%"], backgroundColor: '#FFEC45', height:30, rich : { score : { color : "white", fontFamily : " ", fontSize : 32 } } }, data: [{ value: 50, name:"", label: { textStyle: { fontSize: 10 } } }] } ] }; option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; mychart.setOption(option, true);

좋은 웹페이지 즐겨찾기