I'm working on a web portal which contains several portlets. These portlets contain various Google Charts graphs, mainly pie charts. For some reason, these charts are not all the same size when they are drawn.
I feel like the problem may be connected to the way that I handle data where all data points are equal to zero. My pie charts do not draw properly in this situation, so I instead draw a table, which could become a pie chart later on if the user changes the options they have selected for the chart. JS function to draw charts (pie charts are the ones with the problem): function drawPieChart(_portletIndex) { var portlet = portlets[_portletIndex]; var targetElName = "#portlet_" + portlet.portletID.toString() + " .graphics"; var targetEl = $(targetElName).get(0); //Google requires the data to be in a "DataTable" class, so create one var data = new google.visualization.DataTable(); //Add columns to data table data.addColumn('string', 'Data'); data.addColumn('number', 'Value'); /* Add the data to the DataTable row by row, reference: https://developers.google.com/chart/interactive/docs/basic_preparing_data */ for( var i = 0; i < portlet.chartData.length; i++ ) { var tempArr = []; tempArr.push(portlet.chartKeys[i]); tempArr.push(portlet.chartData[i]); data.addRow(tempArr); } //Chart options var options = { width: '100%', height: '100%', pieSliceText: 'percent', pieSliceTextStyle: {color: 'white', fontName: 'Arial Black', fontSize: 15}, sliceVisibilityThreshold: 0, is3d: true, legend: {position: 'labeled', labeledValueText: 'value', maxLines: 6}, chartArea: {width: '80%', height: '95%'} }; var chart = new google.visualization.PieChart(targetEl); chart.draw(data, options); } -- You received this message because you are subscribed to the Google Groups "Google Chart API" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-chart-api+unsubscr...@googlegroups.com. To post to this group, send email to google-chart-api@googlegroups.com. Visit this group at https://groups.google.com/group/google-chart-api. For more options, visit https://groups.google.com/d/optout.