echart左右滑动

var mychart = echarts.init(document.getElementById('echarts1'));
			
			option = {
			    color: ['#FED14A'],
				title:{
					show:true,
					text: 'xxxx食堂', 
					x:'center',
					padding: 10,
					textStyle: { //主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"} 
						fontSize: 15, 
						fontWeight: 'normal', 
					}, 
				},
				dataZoom: [{ // 控制图表左右滑动
				    width: '15',
				    type: 'slider',
				    show: false, //flase直接隐藏图形
				    xAxisIndex: [0],
				    left: 33, //滚动条靠左侧的百分比
				    bottom: 40,
				    height: 20,//组件高度  
				    start: 0,//滚动条的起始位置
				    showDataShadow: false,//是否显示数据阴影
				    showDetail: false,//是否显示想洗数值信息
				    end: 50 //滚动条的截止位置(按比例分割你的柱状图x轴长度)
				}, { 
				    type: 'inside',
				    show: true,
				    xAxisIndex: [0],
				    start: 0,//滚动条的起始位置
				    end: 0.25 //滚动条的截止位置(按比例分割你的柱状图x轴长度)
				}],
			    tooltip: {
			        trigger: 'axis',
			        axisPointer: {            // 坐标轴指示器,坐标轴触发有效
			            type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
			        }
			    },
			    grid: {
			        left: '3%',
			        right: '4%',
			        bottom: '3%',
			        containLabel: true
			    },
			    xAxis: [
			        {
			            type: 'category',
						
			            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
			            axisTick: {
							show: false,//隐藏x坐标轴刻度
			                alignWithLabel: true
			            },
						axisLabel: {
							show: true,
							textStyle: {
								color: '#8B8B8B',
								fontSize:'12',
			
							}
						},
						axisLine: {
							lineStyle: {
								color: "#8B8B8B",
							}
						},
			        }
			    ],
			    yAxis: [
			        {
			            type: 'value',
						name:'数量',
						splitLine: {
							show: false
						},
						axisTick: {
							show: false,//隐藏x坐标轴刻度
						    alignWithLabel: true
						},
						axisLabel: {
							show: true,
							textStyle: {
								color: '#8B8B8B',
								fontSize:'12',
									
							}
						},
						axisLine: {
							lineStyle: {
								color: "#8B8B8B",
							}
						},
			        }
			    ],
			    series: [
			        {
			            name: '',
			            type: 'bar',
						barWidth: '15',
						showBackground: true,
						backgroundStyle: {
							color: 'rgba(239, 243, 247, 1)'
						},
			            data: [100, 52, 208, 334, 390, 330, 220, 334, 390, 330, 220, 220]
			        }
			    ]
			};
			
			mychart.setOption(option)
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值