{"action":"created","issue":{"url":"https://api.github.com/repos/ecomfe/echarts/issues/5548","repository_url":"https://api.github.com/repos/ecomfe/echarts","labels_url":"https://api.github.com/repos/ecomfe/echarts/issues/5548/labels{/name}","comments_url":"https://api.github.com/repos/ecomfe/echarts/issues/5548/comments","events_url":"https://api.github.com/repos/ecomfe/echarts/issues/5548/events","html_url":"https://github.com/ecomfe/echarts/issues/5548","id":222962541,"number":5548,"title":"请问如何去掉没有数据的 bar，现在占了位置。","user":{"login":"emitle","id":4422941,"avatar_url":"https://avatars2.githubusercontent.com/u/4422941?v=3","gravatar_id":"","url":"https://api.github.com/users/emitle","html_url":"https://github.com/emitle","followers_url":"https://api.github.com/users/emitle/followers","following_url":"https://api.github.com/users/emitle/following{/other_user}","gists_url":"https://api.github.com/users/emitle/gists{/gist_id}","starred_url":"https://api.github.com/users/emitle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emitle/subscriptions","organizations_url":"https://api.github.com/users/emitle/orgs","repos_url":"https://api.github.com/users/emitle/repos","events_url":"https://api.github.com/users/emitle/events{/privacy}","received_events_url":"https://api.github.com/users/emitle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-04-20T06:31:34Z","updated_at":"2017-04-25T02:54:20Z","closed_at":null,"body":"### One-line summary [问题简述]\r\n\r\n如下图，一年级没有数学数据，但是占用了空间，可以不占用空间吗？\r\n![aaa](https://cloud.githubusercontent.com/assets/4422941/25216627/fad2d37a-25d5-11e7-956b-b4f525808706.png)\r\n\r\n### Version & Environment [版本及环境]\r\n+ ECharts version [ECharts 版本]: 3.4.0\r\n+ Browser version [浏览器类型和版本]: `User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36`\r\n+ OS Version [操作系统类型和版本]: macOS 10.12.3\r\n\r\n\r\n\r\n\r\n\r\n### Expected behaviour [期望结果]\r\n\r\n一年级语文跟英语之间没有间距\r\n\r\n\r\n\r\n### ECharts option [ECharts配置项]\r\n<!-- Copy and paste your 'echarts option' here. -->\r\n<!-- [下方贴你的option，注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->\r\n```javascript\r\n\r\noption = {\r\n    legend: {\r\n        data: [],\r\n        // left:110,\r\n    },\r\n    tooltip: {\r\n        trigger: 'axis',\r\n        axisPointer: { // 坐标轴指示器，坐标轴触发有效\r\n            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'\r\n        },\r\n        formatter: function(params) {\r\n            var html = [];\r\n\r\n            var category = {};\r\n            echarts.util.each(params, function(param) {\r\n                // console.log(param)\r\n                var serie = option.series[param.seriesIndex];\r\n                var subject_name = serie.name,\r\n                    status = serie.status == '未完成' ? 1 : 2;\r\n\r\n                if (!category[subject_name]) {\r\n                    category[subject_name] = {};\r\n                }\r\n                category[subject_name][status] = param.value;\r\n            });\r\n            // console.log(category);\r\n            echarts.util.each(category, function(cate, key) {\r\n                html.push(\r\n                    '<tr>',\r\n                    '<td>', key, '</td>',\r\n                    '<td>', cate[1], '</td>',\r\n                    '<td>', cate[2], '</td>',\r\n                    '</tr>'\r\n                );\r\n            })\r\n\r\n            return '<table style=\"\" class=\"tooltip-table\"><tbody>' +\r\n                '<tr><td></td><td>未完成</td><td>已完成</td></tr>' +\r\n                html.join('') +\r\n                '</tbody></table>';\r\n        }\r\n    },\r\n    yAxis: {\r\n        axisLine: {\r\n            lineStyle: {\r\n                color: '#ccc'\r\n            }\r\n        },\r\n        axisLabel: {\r\n            textStyle: {\r\n                color: '#777'\r\n            }\r\n        }\r\n    },\r\n    xAxis: [{\r\n            name: '                     年级',\r\n            nameLocation: 'start',\r\n            nameTextStyle: {\r\n                fontWeight: 'bold'\r\n            },\r\n            // position: 'bottom',\r\n            offset: 50,\r\n            axisLine: {\r\n                onZero: false,\r\n                show: false\r\n            },\r\n            axisTick: {\r\n                length: 70,\r\n                inside: true,\r\n                lineStyle: {\r\n                    color: '#ccc'\r\n                }\r\n            },\r\n            axisLabel: {\r\n                inside: true,\r\n            },\r\n            // inverse: true,      \r\n            data: ['一年级', '二年级', '三年级', '四年级', '五年级']\r\n        }\r\n    ],\r\n    series: [{\r\n        name: '语文',\r\n        status: '已完成',\r\n        type: 'bar',\r\n        stack: 'B',\r\n        data: [220, 182, 191, 234, 290],\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#87b87f',\r\n            }\r\n        },\r\n        label: {\r\n            normal: {\r\n                show: true,\r\n                position: 'bottom',\r\n                textStyle: {\r\n                    color: '#000'\r\n                },\r\n                formatter: '语文',\r\n            }\r\n        }\r\n    }, {\r\n        name: '语文',\r\n        status: '未完成',\r\n        type: 'bar',\r\n        stack: 'B',\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#fff',\r\n                borderColor: '#87b87f',\r\n            }\r\n        },\r\n        data: [120, 82, 91, 34, 90]\r\n    }, {\r\n        name: '数学',\r\n        status: '已完成',\r\n        type: 'bar',\r\n        stack: 'C',\r\n        data: ['-', 182, 191, 234, 290],\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#87b87f',\r\n            }\r\n        },\r\n        label: {\r\n            normal: {\r\n                show: true,\r\n                position: 'bottom',\r\n                textStyle: {\r\n                    color: '#000'\r\n                },\r\n                formatter: '数学',\r\n            }\r\n        }\r\n    }, {\r\n        name: '数学',\r\n        status: '未完成',\r\n        type: 'bar',\r\n        stack: 'C',\r\n        data: ['-', 132, 91, 204, 220],\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#fff',\r\n                borderColor: '#87b87f',\r\n            }\r\n        },\r\n    }, {\r\n        name: '英语',\r\n        status: '已完成',\r\n        type: 'bar',\r\n        stack: 'D',\r\n        data: [220, 182, 191, 234, 290],\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#87b87f',\r\n            }\r\n        },\r\n        label: {\r\n            normal: {\r\n                show: true,\r\n                position: 'bottom',\r\n                textStyle: {\r\n                    color: '#000'\r\n                },\r\n                formatter: '英语',\r\n            }\r\n        }\r\n    }, {\r\n        name: '英语',\r\n        status: '未完成',\r\n        type: 'bar',\r\n        stack: 'D',\r\n        data: [120, 132, 131, 254, 278],\r\n        itemStyle: {\r\n            normal: {\r\n                color: '#fff',\r\n                borderColor: '#87b87f',\r\n            }\r\n        },\r\n    }, ]\r\n}\r\n\r\n```\r\n\r\n\r\n\r\n\r\n### Other comments [其他信息]\r\n<!-- For example: Screenshot or Online demo -->\r\n<!-- [例如，截图或线上实例 (JSFiddle/JSBin/Codepen)] -->\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ecomfe/echarts/issues/comments/296878831","html_url":"https://github.com/ecomfe/echarts/issues/5548#issuecomment-296878831","issue_url":"https://api.github.com/repos/ecomfe/echarts/issues/5548","id":296878831,"user":{"login":"pissang","id":841551,"avatar_url":"https://avatars2.githubusercontent.com/u/841551?v=3","gravatar_id":"","url":"https://api.github.com/users/pissang","html_url":"https://github.com/pissang","followers_url":"https://api.github.com/users/pissang/followers","following_url":"https://api.github.com/users/pissang/following{/other_user}","gists_url":"https://api.github.com/users/pissang/gists{/gist_id}","starred_url":"https://api.github.com/users/pissang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pissang/subscriptions","organizations_url":"https://api.github.com/users/pissang/orgs","repos_url":"https://api.github.com/users/pissang/repos","events_url":"https://api.github.com/users/pissang/events{/privacy}","received_events_url":"https://api.github.com/users/pissang/received_events","type":"User","site_admin":false},"created_at":"2017-04-25T02:54:20Z","updated_at":"2017-04-25T02:54:20Z","body":"没法去掉，只能你把横轴的相应类目也去掉"}}
{"actor":{"display_login":"pissang"}}