orca icon indicating copy to clipboard operation
orca copied to clipboard

Ampersands don't render in annotations of .emf files if " " is used in other text elements

Open michaelbabyn opened this issue 4 years ago • 1 comments

If I input a json that uses   in title text using the below command, the & doesn't appear in annotations in .emf files (all other image types seem to work)

docker run -it -d -p 9091:9091 quay.io/plotly/image-exporter:4.1.0b642
curl -d @minimal-no-ampersand.json -H "accept: image/emf" localhost:9091 -o minimal-no-ampersand.emf

where minimal-no-ampersand.json looks like this

{
	"layout": {
		"yaxis": {
			"title": {
				"font": {
					"size": 11
				},
				"text": "%{meta[1]} "
			}
		},
		"meta": [
			"Stacked Bar Chart Title",
			"A&W Hamburgers",
			"Y-axis label",
			"X-axis label",
			"A&W Hamburgers"
		],
		"annotations": [
			{
				"text": "%{meta[4]} ",
				"align": "left",
				"xanchor": "left",
				"xref": "paper",
				"yref": "paper"
			}
		]
	}
}

Screenshot from 2021-05-17 12-21-07

but this works (I just removed the   from the yaxis title text):

{
	"layout": {
		"yaxis": {
			"title": {
				"font": {
					"size": 11
				},
				"text": "%{meta[1]}"
			}
		},
		"meta": [
			"Stacked Bar Chart Title",
			"A&W Hamburgers",
			"Y-axis label",
			"X-axis label",
			"A&W Hamburgers"
		],
		"annotations": [
			{
				"text": "%{meta[4]} ",
				"align": "left",
				"xanchor": "left",
				"xref": "paper",
				"yref": "paper"
			}
		]
	}
}

cc @plotly/techops

michaelbabyn avatar May 17 '21 16:05 michaelbabyn

Looks like a bug to me. @wbrgss can you please assign someone to investigate?

nicolaskruchten avatar May 18 '21 15:05 nicolaskruchten