CodePudding user response:
<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "/& gt;_ & lt;/title>
<script SRC="https://cdn.bootcss.com/echarts/4.2.1/echarts.js" & gt; </script>
<body>Var chart=echarts. Init (document. GetElementById (" chart "));
Var target=[120, 120, 120, 120, 120, 120, 120].
Var data=https://bbs.csdn.net/topics/[120, 200, 150, 80, 70, 110, 130].
For (var I=0; iData [I]={
Value: data [I],
ItemStyle: {
Color: data [I] & gt;=target [I]? '# 0 a0' : '# c00'
}
}
}
Var option={
XAxis: {
Type: 'category',
Data: [' Mon, Tue, Wed, Thu, Fri, Sat, 'Sun']
},
YAxis: {
Type: 'value'
},
Series: [{
Data: data,
Type: 'bar'
}]
};
Chart. SetOption (option);
</script>