| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- //var datax=['1号店','2号店','3号店','4号店','5号店','6号店','7号店','8号店'];
- //var datay1=[3709, 2417, 755, 2610, 1719, 433, 2544, 4285];
- //var datay2=[386,386, 386, 122, 261, 171, 386, 40];
- //var datay3= [220, 376, 1727, 220, 220, 220, 220, 220];
- function setBar_ln(datax,datay1,datay2,datay3){
- var option = {
- "title": {
- "text": "人流环比图",
- "subtext": "昨天 vs 前天",
- "x": "center",
- show:false
- },
- "tooltip": {
- "trigger": "axis",
- "axisPointer": {
- "type": "shadow"
- },
- },
- "grid": {
- "borderWidth": 0,
- "y2": 40,
- "y":10
- },
- "legend": {
- "x": "right",
- "data": [ ]
- },
- "toolbox": {
- "show": false,
- "feature": {
- "restore": { },
- "saveAsImage": { }
- }
- },
- "calculable": true,
- "xAxis": [
- {
- "type": "category",
- "splitLine": {
- "show": false
- },
- "axisTick": {
- "show": false
- },
- "splitArea": {
- "show": false
- },
- "axisLabel": {
- "interval": 0,
- "rotate": -45,
- "show": true,
- "splitNumber": 15,
- "textStyle": {
- "fontFamily": "微软雅黑",
- "fontSize": 14,
- "color":'#00b2ff'
- }
- },
- "data": datax,
- }
- ],
- "yAxis": [
- {
- "type": "value",
- "splitLine": {
- "show": true,
- "lineStyle":{
- "color":'#2D68D0'
- }
- },
- "axisLine": {
- "show": false
- },
- "axisTick": {
- "show": false
- },
- "splitArea": {
- "show": false
- },
- "axisLabel": {
- "interval": 0,
- // "rotate": 45,
- "show": true,
- "splitNumber": 15,
- "textStyle": {
- "fontFamily": "微软雅黑",
- "fontSize": 16,
- "color":'#00b2ff'
- }
- },
- }
- ],
- // "dataZoom": [
- // {
- // "show": false,
- // "height": 30,
- // "xAxisIndex": [
- // 0
- // ],
- // bottom:40,
- // "start": 0,
- // "end": 80
- // },
- // {
- // "type": "inside",
- // "show": true,
- // "height": 15,
- // "xAxisIndex": [
- // 0
- // ],
- // "start": 1,
- // "end": 35
- // }
- // ],
- "series": [
- {
- "name": "昨日",
- "type": "bar",
- "stack": "总量",
- "barMaxWidth": 30,
- "barGap": "10%",
- "itemStyle": {
- "normal": {
- "barBorderRadius": 0,
- "color": new echarts.graphic.LinearGradient(0,0,0,1,[{
- offset:0,
- color:'rgba(15,108,193,.8)'
-
- },{
- offset:0.8,
- color:'rgba(3,70,118,1)'
- }
- ]),
- "label": {
- "show": true,
- "textStyle": {
- "color": "white"
- },
- "position": "insideTop",
- formatter : function(p) {
- return p.value > 0 ? (p.value ): '';
- }
- }
- }
- },
- "data": datay1,
- },
- {
- "name": "人流减少",
- "type": "bar",
- "stack": "总量",
- "itemStyle": {
- "normal": {
- "color": new echarts.graphic.LinearGradient(0,0,0,1,[{
- offset:0,
- color:'rgba(51,204,112,.5)'
-
- },{
- offset:0.8,
- color:'rgba(51,204,112,1)'
- }
- ]),
- "barBorderRadius": 0,
- "label": {
- "show": true,
- "textStyle": {
- "color": "white"
- },
- "position": "insideTop",
- formatter : function(p) {
- return p.value > 0 ? (
- p.value + '')
- : '';
- }
- }
- }
- },
- "data": datay2
- },
- {
- "name": "人流增长",
- "type": "bar",
- "stack": "总量",
- "itemStyle": {
- "normal": {
- "color": new echarts.graphic.LinearGradient(0,0,0,1,[{
- offset:0,
- color:'rgba(15,108,193,.8)'
-
- },{
- offset:0.8,
- color:'rgba(3,70,118,1)'
- }
- ]),
- "barBorderRadius": 0,
- "label": {
- "show": true,
- "textStyle": {
- "color": "white"
- },
- "position": "insideTop",
- formatter : function(p) {
- return p.value > 0 ? (
- p.value + '')
- : '';
- }
- }
- }
- },
- "data":datay3
- }
- ],
- animationDuration:7000,
- animationEasing:'elasticOut',
- animationDelayupdate:function(idx){
- return idx * 15;
- }
- }
- return option;
- }
|