apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.48k stars 19.62k forks source link

各位大佬们,请教一个问题,我用type: 'custom', 画置信椭圆的时候,坐标轴变了,api.coord方法传入一样的参数,出来的结果不一样,椭圆超出画布了 #19760

Open LBJDJW opened 7 months ago

LBJDJW commented 7 months ago

Version

5.0

Link to Minimal Reproduction

各位大佬们,请教一个问题,我用type: 'custom', 画置信椭圆的时候,坐标轴变了,api.coord方法传入一样的参数,出来的结果不一样,椭圆超出画布了

Steps to Reproduce

各位大佬们,请教一个问题,我用type: 'custom', 画置信椭圆的时候,坐标轴变了,api.coord方法传入一样的参数,出来的结果不一样,椭圆超出画布了

Current Behavior

把坐标轴的min max 改小 ,导致椭圆直接超出画布外面

Expected Behavior

椭圆和之前改变坐标轴比例一样 `return { type: 'custom', groupId: groupId, name: name, data: [[xmean, ymean, majorAxis / 2, minorAxis / 2, color]], encode: { x: [0, 2], y: [1, 3], seriesName: [4], }, silent: true, useData: [xmean, ymean, majorAxis],

    // clip: true,
    renderItem: function(params, api) {

//问题出现在这里 改变坐标轴大小 p1 和 p2 一样的参数和传入进去,返回的p1和p2和之前不一样 var p1 = api.coord([api.value(0), api.value(1)]); var p2 = api.coord([api.value(2) + api.value(0), api.value(3) + api.value(1)]);

        return {
            type: 'ellipse',
            shape: {
                cx: p1[0],
                cy: p1[1],
                rx: p2[0] - p1[0],
                ry: p1[1] - p2[1],
            },
            style: {
                fill: api.value(4),
                opacity: 0.4,
                lineWidth:
                    configData?.lineWidth === 0 || configData?.lineWidth === '0'
                        ? 0
                        : configData?.lineWidth || 2,
                stroke: color,
                lineDash: configData?.lineDash || [1, 0],
            },
            rotation: (angle * 180) / Math.PI,
            originX: p1[0],
            originY: p1[1],
        };
    },`

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

echarts-bot[bot] commented 7 months ago

@LBJDJW It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** Dear friends, I have a question. When I used type: 'custom' to draw the confidence ellipse, the coordinate axis changed. The api.coord method passed in the same parameters, but the result was different. The ellipse exceeded the canvas.