菜鸟教程.可运行.(2020-1-31 0:17:53)
<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
开始以为.?这个.?不是.改成本地也可以.
<script src="node_modules\echarts\dist\echarts.min.js"></script>
研究了.半天.除了已解决.的导包.问题.需要删除.多余代码.
// var echarts = require('echarts');
这样才有用.(2020-1-31 0:23:50).
已解决.开始学习Echarts.入门.填坑.完成.
成功代码.(2020-1-31 0:38:26)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>myProject</title>
<style>
#main,
#main2 {
width: 600px;
height: 400px;
/* 要设置宽高.才行.? */
border: 2px solid black;
/* background-color: burlywood; */
}
</style>
</head>
<body>
<div id="main"></div>
<div id="main2"></div>
<!-- 错误文件。 -->
<!-- <script src="./node_modules/echarts/echarts.all.js"></script> -->
<script src="node_modules\echarts\dist\echarts.min.js"></script>
<!-- 引入。这个。文件。?即可。?懂吗。? -->
<script type="text/javascript">
var option1 = {
series: {
type: 'pie',
data: [{
name: 'a',
value: '112'
}, {
name: 'b',
value: '223'
}]
}
};
var option2 = {
title: {
text: '第一个 ECharts 实例'
},
tooltip: {},
legend: {
data: ['销量']
},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
echarts.init(document.getElementById('main2')).setOption(option1);
echarts.init(document.getElementById('main')).setOption(option2);
</script>
</body>
over入门成功.明天再开始.学习.(2020-1-31 0:39:04)