1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>02.配置项的讲解和使用</title>
- <!-- 步骤1:引入echarts.js文件 -->
- <script src="lib/echarts.min.js"></script>
- </head>
- <body>
- <!-- 步骤2:准备一个呈现图表的盒子 -->
- <div style="width: 600px;height: 400px"></div>
- <script>
- //步骤3:初始化echar实例对象
- //参数:dom,决定图表最终呈现的位置
- var mCharts = echarts.init(document.querySelector('div'))
- //步骤4:准备配置项
- var option = {
- title:{
- text:'成绩',
- link:'https://www.baidu.com',
- textStyle:{
- color:'red'
- }
- },
- xAxis:{
- type:'category',//类目轴
- data:['小明','小红','小强']
- },
- yAxis:{
- type:'value'//数值轴
- },
- series:[
- {
- name:'语文',
- type:'bar',
- data:[70,90,80]
- }
- ]
- }
- //步骤5:将配置项设置给echarts实例对象
- mCharts.setOption(option)
- </script>
- </body>
- </html>
|