echarts [Bug] The line with animation will jitter during rendering.

rn0zuynd  于 3个月前  发布在  Echarts
关注(0)|答案(6)|浏览(66)

Version

5.4.3

Current Behavior

jitter.line.mov

The init echarts config:

export const initEchartsOption: EChartsOption = {
    xAxis: {
        show: false,
    },
    yAxis: {
        show: false,
    },
    series: {
        type: "line",
        showSymbol: false,
        smooth: true,
        data: [],
        lineStyle: {
            color: "#000",
            width: 3,
        },
        sampling: "none",
    },
    grid: {
        right: 0,
        top: 20,
        bottom: 20,
        left: 0,
    },
    animationDuration: 0,
    animationDurationUpdate: 500,
    animationEasing: "linear",
    animationEasingUpdate: "linear",
};

and evert 500ms I will set new options:

chartRef.current!.setOption<EChartsOption>({
    yAxis: {
        min: renderData?.minYAxis || 0,
        max: renderData?.maxYAxis || 1,
    },
    xAxis: {
        min: latestData.timestamp - liveLineHistoriesConfig.time_offset,
        max: latestData.timestamp,
    },
    series: {
        data: newData,
    },
    grid: {
        right: 100
    },
});

As can be seen, when a new point appears on the right, there are two issues:

  1. The line is drawn from thick to thin.


2. After the line is drawn, it jitters and changes into a smooth curve.

Expected Behavior

looks ok

xe55xuns

xe55xuns1#

usually animation: false fixes such issues.
If you really want animation, then you need to experiment with the duration settings. Also smooth: true slows down animation.

gk7wooem

gk7wooem2#

@helgasoft thx
Indeed, I do need animations and I indeed need to enable the smooth function.
Is there any way to fix this problem?

ogsagwnx

ogsagwnx3#

Add on:

There is a phenomenon, even with out animation, there is a problem (see video):
After enabling smooth, once the new line is drawn, it will be redrawn (or called jittering).
error-line.movshake.mov

j8ag8udp

j8ag8udp4#

video clips do not help that much, a working Minimal Reproduction code does.
see similar #18742

ddarikpa

ddarikpa5#

I think what he is trying to express is that the curve jitters a bit when a new point emerges, and I have encountered the same issue. If the curve during the emergence of the point and happening after the jitter are consistent, the sensation of segmentation should not be as intense. @helgasoft

pw9qyyiw

pw9qyyiw6#

yeah @happyjosh , you got me

相关问题