Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]The name of the series in the option contains label characters such as "<",">", which causes the generated svg to render incorrectly #17399

Closed
kimutaku001 opened this issue Jul 19, 2022 · 2 comments · Fixed by ecomfe/zrender#935 or #17406

Comments

@kimutaku001
Copy link

kimutaku001 commented Jul 19, 2022

Version

5.3.0

Link to Minimal Reproduction

No response

Steps to Reproduce

option:

{
	"backgroundColor": "rgb(255,255,255)",
	"color": ["#007dff", "#06bfc9", "#9f51e7", "#e72d90"],
	"legend": {
		"backgroundColor": "transparent",
		"orient": "vertical",
		"x": "right",
		"y": "center"
	},
	"series": [{
		"data": [{
			"name": "<5分钟   0",
			"smooth": false,
			"value": 0
		}, {
			"name": "5~30分钟   2",
			"smooth": false,
			"value": 2
		}, {
			"name": "30~60分钟   0",
			"smooth": false,
			"value": 0
		}, {
			"name": ">60分钟   5",
			"smooth": false,
			"value": 5
		}],
		"center": ["45%", "50%"],
		"itemStyle": {
			"borderColor": "#fff",
			"borderRadius": 10.0,
			"borderWidth": 2.0
		},
		"label": {
			"show": false,
			"position": "center"
		},
		"type": "pie",
		"radius": ["50%", "70%"]
	}],
	"title": {
		"backgroundColor": "transparent",
		"top": "48%",
		"left": "45%",
		"textAlign": "center",
		"text": "sumFormatEchartsn7",
		"textStyle": {
			"lineHeight": 15.0
		}
	}
}

生成svg

<svg width="500" height="300"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" viewBox="0 0 500 300">
    <rect width="500" height="300" x="0" y="0" id="0" fill="rgb(255,255,255)" fill-opacity="1"></rect>
    <path d="M225 55.5A10 10 0 0 1 236.1 45.6A105 105 0 0 1 318.7 102.6A10 10 0 0 1 313.3 116.5L303.9 120.1A10 10 0 0 1 291.5 115.3A75 75 0 0 0 233.8 75.5A10 10 0 0 1 225 65.6Z" fill="#007dff" stroke="#fff" stroke-width="2" stroke-linejoin="round"></path>
    <path d="M313.3 116.5A10 10 0 0 1 326.6 123.3A105 105 0 0 1 327.3 126.4A10 10 0 0 1 318.8 138.6L308.8 139.8A10 10 0 0 1 297.9 132.3A75 75 0 0 0 297.8 131.8A10 10 0 0 1 303.9 120.1Z" fill="#06bfc9" stroke="#fff" stroke-width="2" stroke-linejoin="round"></path>
    <path d="M318.8 138.6A10 10 0 0 1 330 148.4A105 105 0 0 1 330 151.6A10 10 0 0 1 318.8 161.4L308.8 160.2A10 10 0 0 1 300 150.2A75 75 0 0 0 300 149.8A10 10 0 0 1 308.8 139.8Z" fill="#9f51e7" stroke="#fff" stroke-width="2" stroke-linejoin="round"></path>
    <path d="M318.8 161.4A10 10 0 0 1 327.3 173.6A105 105 0 1 1 213.9 45.6A10 10 0 0 1 225 55.5L225 65.6A10 10 0 0 1 216.2 75.5A75 75 0 1 0 297.9 167.7A10 10 0 0 1 308.8 160.2Z" fill="#e72d90" stroke="#fff" stroke-width="2" stroke-linejoin="round"></path>
    <path d="M-5 -5l115.6 0l0 104l-115.6 0Z" transform="translate(389.36 103)" fill="none" stroke="#ccc" stroke-width="0"></path>
    <path d="M3.5 0L21.5 0A3.5 3.5 0 0 1 25 3.5L25 10.5A3.5 3.5 0 0 1 21.5 14L3.5 14A3.5 3.5 0 0 1 0 10.5L0 3.5A3.5 3.5 0 0 1 3.5 0" transform="translate(469 104)" fill="#007dff" stroke="#fff" stroke-width="2" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="round"></path>
    <text dominant-baseline="central" text-anchor="end" style="font-size:12px;font-family:sans-serif;" xml:space="preserve" x="-5" y="7" transform="translate(469 104)" fill="#333">
        <5分钟   5
        </text>
        <path d="M3.5 0L21.5 0A3.5 3.5 0 0 1 25 3.5L25 10.5A3.5 3.5 0 0 1 21.5 14L3.5 14A3.5 3.5 0 0 1 0 10.5L0 3.5A3.5 3.5 0 0 1 3.5 0" transform="translate(469 130)" fill="#06bfc9" stroke="#fff" stroke-width="2" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="round"></path>
        <text dominant-baseline="central" text-anchor="end" style="font-size:12px;font-family:sans-serif;" xml:space="preserve" x="-5" y="7" transform="translate(469 130)" fill="#333">5~30分钟   1</text>
        <path d="M3.5 0L21.5 0A3.5 3.5 0 0 1 25 3.5L25 10.5A3.5 3.5 0 0 1 21.5 14L3.5 14A3.5 3.5 0 0 1 0 10.5L0 3.5A3.5 3.5 0 0 1 3.5 0" transform="translate(469 156)" fill="#9f51e7" stroke="#fff" stroke-width="2" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="round"></path>
        <text dominant-baseline="central" text-anchor="end" style="font-size:12px;font-family:sans-serif;" xml:space="preserve" x="-5" y="7" transform="translate(469 156)" fill="#333">30~60分钟   1</text>
        <path d="M3.5 0L21.5 0A3.5 3.5 0 0 1 25 3.5L25 10.5A3.5 3.5 0 0 1 21.5 14L3.5 14A3.5 3.5 0 0 1 0 10.5L0 3.5A3.5 3.5 0 0 1 3.5 0" transform="translate(469 182)" fill="#e72d90" stroke="#fff" stroke-width="2" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="round"></path>
        <text dominant-baseline="central" text-anchor="end" style="font-size:12px;font-family:sans-serif;" xml:space="preserve" x="-5" y="7" transform="translate(469 182)" fill="#333">>60分钟   19</text>
        <path d="M-17 -5l34 0l0 70l-34 0Z" transform="translate(230 140)" fill="none" stroke="#ccc" stroke-width="0"></path>
        <path d="M-12 0l24 0l0 60l-24 0Z" transform="translate(230 140)" fill="none"></path>
        <text dominant-baseline="central" text-anchor="middle" style="font-size:18px;font-family:sans-serif;font-weight:bold;" y="15" transform="translate(230 140)" fill="#464646">总数</text>
        <text dominant-baseline="central" text-anchor="middle" style="font-size:18px;font-family:sans-serif;font-weight:bold;" y="45" transform="translate(230 140)" fill="#464646">26</text>
    </svg>

Current Behavior

image

Expected Behavior

image

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

label中的</>字符作为标签解析, 引发渲染错误

@echarts-bot echarts-bot bot added the missing-title This issue is missing a descriptive title. label Jul 19, 2022
@echarts-bot echarts-bot bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2022
@echarts-bot

This comment has been minimized.

@kimutaku001 kimutaku001 changed the title [Bug] [Bug] option中series的name包含"<",">"等标签字符, 导致生成的svg渲染错误 Jul 19, 2022
@echarts-bot echarts-bot bot added the pending We are not sure about whether this is a bug/new feature. label Jul 19, 2022
@echarts-bot echarts-bot bot reopened this Jul 19, 2022
@echarts-bot echarts-bot bot removed the missing-title This issue is missing a descriptive title. label Jul 19, 2022
@echarts-bot
Copy link

echarts-bot bot commented Jul 19, 2022

@kimutaku001 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

[Bug] The name of the series in the option contains label characters such as "<",">", which causes the generated svg to render incorrectly

@kimutaku001 kimutaku001 changed the title [Bug] option中series的name包含"<",">"等标签字符, 导致生成的svg渲染错误 [Bug]The name of the series in the option contains label characters such as "<",">", which causes the generated svg to render incorrectly Jul 19, 2022
@plainheart plainheart added SVG and removed pending We are not sure about whether this is a bug/new feature. labels Jul 19, 2022
@plainheart plainheart added this to the 5.4 milestone Jul 19, 2022
plainheart added a commit to ecomfe/zrender that referenced this issue Jul 19, 2022
…arts#17399.

- move the `encodeHTML` function from `echarts` to `zrender`.
@plainheart plainheart removed this from the 5.4 milestone Jul 19, 2022
@plainheart plainheart linked a pull request Jul 20, 2022 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants