网站首页
百度ECharts
ECharts实例
ECharts入门
地图大全
ECharts官网
源代码:
点击运行 》
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ECharts 实例</title> <script src="/js/jquery-1.9.0.min.js"></script> <!-- 引入 echarts.js --> <script src="/js/echarts.min.js"></script> </head> <body> <div id="main" style="width: 100%;height:450px;"></div> <script type="text/javascript"> option = { grid: { bottom: 50, left: 80, top: 80, right: 50, }, xAxis: [{ type: 'category', data: ['html', 'css', 'jquery', 'vue', 'node'], axisLine: { show: false }, axisTick: { show: false }, axisLabel: { color: '#999999', fontSize: 12 } }], yAxis: [{ type: 'value', axisLine: { show: false }, axisTick: { show: false }, splitLine: { lineStyle: { color: '#f1f1f2' } }, axisLabel: { color: '#999999', fontSize: 12 } }], series: [{ name: '访问量', type: 'bar', data: [98, 128, 245, 378, 488], barWidth: 18, itemStyle: { normal: { barBorderRadius: [5, 5, 0, 0], color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: "rgb(255,154,22)" }, { offset: 1, color: "rgb(234,130,113)" } ]) } }, label: { normal: { show: true, lineHeight: 30, width: 80, height: 30, backgroundColor: '#ec6c3f', borderRadius: 200, position: ['-31', '-65'], formatter: [ '{a|{c}}\n', '{b|}\n', '{d|}', ].join(''), rich: { d: { color: '#ec6c3f', align: 'center', width: 10, height: 10, backgroundColor: '#ec6c3f', borderWidth: 3, borderColor: 'rgba(255,255,255,.8)', borderRadius: 100 }, a: { color: '#fff', align: 'center', }, b: { width: 1, height: 50, borderWidth: 1, borderColor: '#ec6c3f', align: 'center' }, } } } }] }; var myChart = echarts.init(document.getElementById('main')); myChart.setOption(option); </script> </body> </html>
运行结果: