Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何限制散点序列上显示的点数?_Javascript_Performance_Jupyter Notebook_Jupyter_Echarts - Fatal编程技术网

Javascript 如何限制散点序列上显示的点数?

Javascript 如何限制散点序列上显示的点数?,javascript,performance,jupyter-notebook,jupyter,echarts,Javascript,Performance,Jupyter Notebook,Jupyter,Echarts,我在散点图上绘制了一大组数据点(大约2000个点),但其中许多点集中在图形的一个小区域,这会损害图形的性能,开始变慢并冻结。有没有办法限制一次渲染的数据点的数量 我正在使用Jupyter和javascript与echart进行绘图 这是我的代码: myChart.setOption({ animation: false, backgroundColor: new echarts.graphic.RadialGradient(0.3, 0.3, 0.

我在散点图上绘制了一大组数据点(大约2000个点),但其中许多点集中在图形的一个小区域,这会损害图形的性能,开始变慢并冻结。有没有办法限制一次渲染的数据点的数量

我正在使用Jupyter和javascript与echart进行绘图

这是我的代码:

myChart.setOption({
            animation: false,
            backgroundColor: new echarts.graphic.RadialGradient(0.3, 0.3, 0.8, [{
                offset: 0,
                color: '#f7f8fa'
            }, {
                offset: 1,
                color: '#cdd0d5'
            }]),
            title: {
                text: 'Receita e Patrimonio de Clientes',
                left: 'center'
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                type: 'value',
                name: 'ROA',
                nameLocation: 'center',
                nameTextStyle: {
                  lineHeight: 25
                },
                scale: true,
                axisLabel: {
                    formatter: '{value}%'
                },
                //min: 0,
                //max: 1.2
                
            },
            yAxis: {
                type: 'value',
                name:'Patrimonio',
                nameLocation: 'center',
                scale: true,
                nameTextStyle: {
                  lineHeight: 130
                },
                axisLabel: {
                    formatter: 'R${value}'
                },
                //min:0,
                //max:600000
            },
            dataZoom: [
                {
                    type: 'slider',
                    show: true,
                    xAxisIndex: [0],
                    start: 0,
                    end: 35
                },
                {
                    type: 'slider',
                    show: true,
                    yAxisIndex: [0],
                    left: '93%',
                    start: 0,
                    end: 35000000
                },
                /*{
                    type: 'inside',
                    xAxisIndex: [0],
                    start: 1,
                    end: 35
                },
                {
                    type: 'inside',
                    yAxisIndex: [0],
                    start: 29,
                    end: 36
                }*/
            ],
            series: [{
                data: data_points,
                type: 'scatter',
                symbolSize: 20,
                emphasis: {
                    label: {
                        show: true,
                        formatter: function (param) {
                            return param.data[2];
                        },
                        position: 'top'
                    }
                },
                itemStyle: {
                    shadowBlur: 10,
                    shadowColor: 'rgba(120, 36, 50, 0.5)',
                    shadowOffsetY: 5,
                    color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
                        offset: 0,
                        color: 'rgb(251, 118, 123)'
                    }, {
                        offset: 1,
                        color: 'rgb(204, 46, 72)'
                    }])
                },
                markLine: {
                    lineStyle: {
                        type: 'solid'
                    },
                    data: [
                        {yAxis: 300000},
                        { xAxis: 0.6 }
                    ]
                },
                large: true,
                largeThreshold: 100
            }] // We just need to create this
        })


最有可能的情况是,您需要采样之类的东西。我还没有在Echarts上看到这一点,但我通过数据截断解决了这个问题:只需插入数组中的每一秒、第三或第四个数据点。它基于精确的划分和数据索引

请查看此解决方案: