Echarts:放大时线条消失

问题描述 投票:4回答:1

我尝试在echarts 4.1.0版中对折线图进行编程。我正在使用其他浏览器,例如Chrome版本69.0.3497.100或Firefox 63.0.1(64位)。我的问题是,如果缩放x轴,如果这些点不在焦点内,则连接线会消失:

Line disappears

这是本示例的代码:

<html>
<head>

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.1.0-release/echarts-en.min.js"></script>


</head>
<body>
<div id="main_chart" style="width: 1200px;height:600px;"></div>

<script type="text/javascript">

    // based on prepared DOM, initialize echarts instance
    var myChart = echarts.init(document.getElementById('main_chart'));

    var app = {};
    option = null;
    option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross'
            }
        },

        xAxis: {
            type: 'time',



            axisLabel: {
                                formatter: function (value) {
                                    return echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', value);
                                }
                            }

        },
        yAxis: {
            type: 'value',
            min: 'dataMin'
        },
        dataZoom: [
            {
                type: 'slider',
                xAxisIndex: 0,
                filterMode: 'filter'
            },
            {
                type: 'slider',
                yAxisIndex: 0,
                filterMode: 'empty'
            },
            {
                type: 'inside',
                xAxisIndex: 0,
                filterMode: 'filter'
            },
            {
                type: 'inside',
                yAxisIndex: 0,
                filterMode: 'empty'
            }
        ],
        series: [{

            data:  [["2018-11-06 11:27:54",37.2],["2018-11-06 11:29:33",37.2],["2018-11-06 11:29:34",37.3],["2018-11-06 13:09:33",37.3],["2018-11-06 13:09:34",37.2],["2018-11-06 13:09:34",37.2],["2018-11-06 13:09:35",37.3],["2018-11-06 13:09:49",37.3],["2018-11-06 13:09:50",37]],


            type: 'line',
        //    step: 'end',
            //  smooth: true,
            sampling: 'average'
        }]
    };
    ;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
</script>


</body>
</html>

当我缩放时,连接线还应该连接显示区域之外的点。在下面,您可以看到预期的行为,这是我使用绘画程序完成的。

Expected behaviour

我可以在选项中进行哪些更改以更改该行为,或者这是Echarts库中的问题?

javascript html echarts
1个回答
0
投票

请参阅https://echarts.apache.org/en/option.html#dataZoom-inside.filterMode的官方文档。

问题与放大时ECharts如何过滤数据有关。在filterMode: 'none'对象上设置dataZoom将防止数据被忽略。线条将根据网格视图外部的值延伸到图形的边缘。

© www.soinside.com 2019 - 2024. All rights reserved.