SOURCE

console 命令行工具 X clear

                    
>
console
// 步骤3:初始化echarts实例对象
const myCharts = echarts.init(document.getElementById('container'))

// 步骤4:准备配置项
const option = {
    animation: true,
    // animationDuration: 4000, // 固定动画时间
    animationDuration: arg => {
        return (arg + 1) * 1000
    },
    animationEasing: 'bounceOut', // 动画效果
    animationThreshold: 3, // 开启动画的阈值,大于则关闭动画
    xAxis: {
        type: 'category',
        data: ['小明', '小红', '小王']
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name: '语文',
            type: 'bar',
            data: [70, 92, 87]
        }
    ]
}
// 步骤5:将配置项设置给echarts实例对象
myCharts.setOption(option)
  <!-- 
  步骤1:引入echarts.js文件
  步骤2:准备一个呈现图表的盒子
  步骤3:初始化echarts实例对象
  步骤4:准备配置项
  步骤5:将配置项设置给echarts实例对象
   -->

   <!-- 步骤2:准备一个呈现图表的盒子 -->
   <div id="container"></div>
#container {
    width: 600px;
    height: 400px;
    background: linear-gradient(135deg,#fce38a,#f38181);
}

本项目引用的自定义外部资源