maxLines in piechart

1,092 views
Skip to first unread message

Germán Kuchen

unread,
Jan 28, 2016, 10:42:14 AM1/28/16
to Google Visualization API
Hello. When I put the next code:
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <!--Load the AJAX API-->
    <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      google.load('visualization', '1.0', {'packages':['corechart']});
      google.setOnLoadCallback(drawChart);
function drawChart() {
        var data = google.visualization.arrayToDataTable([
    ['Tipo', 'Cantidad'],
        ['SECUNDARIO: 25939', 25939],
    ['PRIMARIO: 14304', 14304]
    ]);

  var options = {'colors': ['#F58426','#DFD378','#63544A','#B4D8DD','#FBC49C','#E0DDDB','#F58426','#DFD378','#63544A','#B4D8DD','#FBC49C','#E0DDDB'],
        'chartArea':{left:0, top: '30%', width:'100%', height:'70%'},
        'tooltip': {text:'percentage', showColorCode:true, ignoreBounds:true},
        'legend':{position: 'top',maxLines: 2},
     'width':236
    };
                
        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
}
    </script>
  </head>

  <body>
    <div id="chart_div"></div>
  </body>
</html>

The graph don't show the legend with 2 rows, what is the problem?

Sergey Grabkovsky

unread,
Jan 28, 2016, 11:19:50 AM1/28/16
to Google Visualization API
Hi Germán,

The 'maxLines' option specifies the maximum number of lines that would be used, it does not guarantee that 2 lines will always be used. If some text needs to be wrapped, then it will be wrapped up to two lines; if the text never needs to be wrapped, then the option will effectively be ignored.

Moreso, the 'maxLines' option is disabled for legend: position: 'top'.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/d50b89bc-e50c-4671-b1b0-f58706b49e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

unnamed.gif

Sergey Grabkovsky

Software Engineer

Google, Inc

gra...@google.com


chitroju sai hari Krishna

unread,
Sep 4, 2017, 9:04:16 AM9/4/17
to Google Visualization API

I have 50 labels I want to show all the labels without Pagination. can you please help me. How can I remove the Pagination to the legend labels in Google PIE chart.
Reply all
Reply to author
Forward
0 new messages