javascript - echarts legend.itemGap 仅适用于 gulp browser-sync

标签 javascript browser-sync gulp-browser-sync echarts

我想减少图例中元素之间的差距。我正在使用 browser-sync 并且在我使用它的时候它可以工作但是然后我关闭 browser-sync 并打开同一个 webapp 但它似乎不起作用。 这是我使用浏览器同步的图表 my graph using browser-sync

这是关闭browrser-sync后的图

my graph without browser-sync

这是我的 Echart 选项:

option ={
            title: {
                text: 'Ejercicios realizados por el paciente',
                left: 'center'
            },
            tooltip : {
                trigger: 'item'
            },
            toolbox: {
                show : true,
                /*orient: 'vertical',*/
                showTitle: true,
                feature : {
                    mark : {show: true},
                    /*magicType: {
                        show: true, 
                        type: ['line', 'bar', 'stack'],
                        title: {
                        line: 'linea',
                        bar: 'barras',
                        stack: 'barras apiladas'
                        }
                        },
                        restore : {
                        show: true,
                        title: 'restaurar'
                    },*/
                    saveAsImage : {
                        show: true,
                        title: 'captura'
                    }
                }
            },
            calculable : true,
            legend: {
                orient: 'vertical',
                align: 'left',
                top: '7%',
                right: '1%',
                left: /*'right'*/'80%',
                width: '27%',
                data:[],
                itemGap: 4,
                itemHeight: 7,
                itemWidth: 15,
                padding: 1,
                //backgroundColor: 'rgba(0, 0, 0, 0.1)'
            },
            xAxis: [
                {
                    type : 'category',
                    data: timeData,
                    //boundaryGap: ['20%', '40%']
                }
            ],
            yAxis: {
                type: 'value',
                name: 'N. veces',
                offset: 0,
                nameRotate: 0,
                fontSize: 12,
            },
            dataZoom: [{
                type: 'inside',
                start: 85,
                end: 100
                }, {
                start: 0,
                end: 10,
                handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                handleSize: '100%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.8)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                },
                bottom: '1%'
            }],
            grid: {
                //top: 110,
                left: '4%',
                right: '19%',
                //height: 160,
                width: '76%',
                containLabel: false,
            },
            series: [],
            color: ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3', '#ff0065', '#71167a', '#fbe562', '#08331d', '#ADFF2F', '#cb6c00', '#421c25', '#25365c', '#8FBC8F', '#4169E1', '#FF4500']
        }

我错过了什么吗?请帮忙

最佳答案

会尝试更改图例选项的值,itemGap: 4, itemHeight: 7, itemWidth: 15。通过这些设置,您将能够使其适应您想要运行它的环境

关于javascript - echarts legend.itemGap 仅适用于 gulp browser-sync,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43652504/

相关文章:

javascript - 具有两个固定导航的 anchor 链接 - 复杂

node.js - 排除 BrowserSync 不起作用的文件

javascript - 如何在浏览器同步等移动设备中查看本地 Meteor Web 应用程序

css - Browsersync 代理站点注入(inject) CSS

gulp - 如何以编程方式调用 Browsersync init 横幅?

c# - 如何以编程方式登录网站并下载文件

javascript - jquery 对话框暂停像 alert() 这样的脚本

javascript - Backbone.js model.get() 返回 'undefined' 即使我可以在 console.log 中看到属性

gulp - 通过带有 DDEV-local 的 Gulp 任务使用 Browsersync