google / google-visualization-issues

288 stars 35 forks source link

Pie chart getImageURI does not render correctly #2855

Open es01998 opened 4 years ago

es01998 commented 4 years ago

I have an issue in Google Chart Pie when I transform the chart into an image following the code in the page https://developers.google.com/chart/interactive/docs/printing

var my_div = document.getElementById('chart_div');
var my_chart = new google.visualization.ChartType(chart_div);

google.visualization.events.addListener(my_chart, 'ready', function () {
  **my_div.innerHTML = '<img src="' + my_chart.getImageURI() + '">';**
});

my_chart.draw(data);

This bug occurs when the pie chart has only one value (100%). A white extra line appears in the chart if the chart is not selected. If the chart is selected when getImageURI() is called, the line is blue.

Yout can reproduce this bug in https://jsfiddle.net/nginportal/hbjk7ox4/

es01998 commented 4 years ago

Attended _ Unattended Calls (7) Attended _ Unattended Calls (6)

dlaliberte commented 4 years ago

Definitely looks like a bug. Thanks for your report. I can't think of any workaround.

I expect we will be reimplementing the PieChart relatively soon, using VegaChart, since the PieChart code is one of the oldest and crustiest of the corecharts.