Open cooper1x opened 1 year ago
<!DOCTYPE html> <html> <head> <title>echarts demo</title> <script src="https://cdn.jsdelivr.net/npm/echarts@5.2.1/dist/echarts.min.js"></script> </head> <body> <div id="barChart" style="width: 50%; height: 400px;"></div> <div id="lineChart" style="width: 50%; height: 400px;"></div> <script> var barChart = echarts.init(document.getElementById('barChart')); var barOption = { title: { text: 'Sales' }, tooltip: {}, xAxis: { data: ['January', 'February', 'March', 'April', 'May', 'June', 'July'] }, yAxis: {}, series: [{ name: 'Sales', type: 'bar', data: [12, 19, 3, 5, 2, 3, 7], itemStyle: { color: 'rgba(255, 99, 132, 0.2)', borderColor: 'rgba(255, 99, 132, 1)', borderWidth: 1 } }] }; barChart.setOption(barOption); var lineChart = echarts.init(document.getElementById('lineChart')); var lineOption = { title: { text: 'Sales' }, tooltip: {}, xAxis: { data: ['January', 'February', 'March', 'April', 'May', 'June', 'July'] }, yAxis: {}, series: [{ name: 'Sales', type: 'line', data: [12, 19, 3, 5, 2, 3, 7], itemStyle: { color: 'rgba(54, 162, 235, 0.2)', borderColor: 'rgba(54, 162, 235, 1)', borderWidth: 1 } }] }; lineChart.setOption(lineOption); </script> </body> </html>