目标:
本篇文章是介绍使用Echarts时设置X轴上的刻度只显示最大值和最小值,不显示其他的刻度。这个我在做项目的过程中遇到的一个需求,我花费了很长的时间才找到的一种解决办法,希望对后面遇到此坑的朋友有些许帮助,废话不多说,下面介绍实现过程。
Step 1:显示Echarts图
在页面上引入Echarts插件,并将Echarts图显示在页面上,代码如下:
<script type="text/javascript" src="__JS__/echarts.min.js"></script>
<script>
var myChart0100 = echarts.init(document.getElementById('index_main0100'));
option0100 = {
backgroundColor: '#fff',
title: {
show:true,
text: name,
textStyle: {
fontWeight: 'normal',
fontSize: 15,
color: '#666666'
},
top:'13',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
color: '#cfd8dc',