echarts
1、基础搭建
在---- head---- 里引入echart文件
<body>
<div id="main" style="width: 500px;height: 500px;"></div>
</body>
<script>
var myChart = echarts.init(document.getElementById('main'));
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
}
}]
};
myChart.setOption(option);
</script>
2、设置边框
itemStyle: {
normal:{
//设置渐变
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,[
{
offset: 0, color: '#000'},
{
offset: 0.5, color: '#00GG00'},
{
offset: 1, color: '#FFF'}