微信扫一扫看面试题

关注面试题库

Echart 使用

查看前端面试题小程序 大量面试题和答案,请微信查看

在这里插入图片描述

// var list = [1,1,54,5,5,85,8,8,5,5,8,8,85,8,8,5,5,85,88,85,8,88,8,8,8,8,88,]; //x轴的 时间
// var list1= [];  //温度数据
// var list2=[]    //湿度数据

// function initChart(canvas, width, height) {
//   const chart = echarts.init(canvas, null, {width: width,height: height});
//   canvas.setChart(chart);
//   var option = {
//     tooltip: {trigger: 'axis'},
//     color: ['#F8DF64', '#76FB4C'], //icon颜色
//     legend: {
//       data: [{name:'温度(℃)',textStyle: {color: '#333'},color:'#000'}, 
//         { name: '湿度(%RH)', textStyle: { color: '#333' }}],  y: 'bottom',
//     },
//     grid: {left: '1%',right: '1%',top: '10%',containLabel: true}, //图形的位置
//     // x坐标
//     xAxis: {type: 'category',boundaryGap: false,data: list,name: '',nameGap: 2,axisLabel: {interval: 0}},
    
//     // y坐标
//     yAxis: {type: 'value',min: -30,max: 120},
//     series: [
//       {
//         name: '温度(℃)',
//         type: 'line',
//         stack: '总量',
//         smooth: true,
//         itemStyle: {normal: {lineStyle: {color: '#F8DF64'}}},  
//         data: list1
//       }, {
//         name: '湿度(%RH)',
//         type: 'line',
//         smooth: true,
//         stack: '总量',
//         itemStyle: {normal: {lineStyle: {color: '#76FB4C'}}},  
//         data: list2
//       }
//     ]
//   };
//   chart.setOption(option);
//   return chart;
// }

在小程序中体验

在这里插入图片描述

posted @ 2022-07-23 10:04  web前端面试小助手  阅读(147)  评论(0)    收藏  举报