Is it possible to set a border around the main area of a pie chart ?

165 views
Skip to first unread message

P-A

unread,
Jan 5, 2017, 10:44:36 AM1/5/17
to Google Visualization API
The title said it all, i am using the google pie chart and i would like to add a border arround the main area background. For the moment my idea is to ditch the pie chart pis adding a black box with css behind the pie chart div.

To be clear, i have a background image on the html page, on this page i have the pie chart. I want a border around the pie chart to make a split between the pie chart main area background and the page background.
}}
I google this question a lot but nothing seem good for my situation, maybe its just my way that dosent work. I found these potential solution so far :

Use the mainArea.backgroundcolor.strock and .....color.strockwidth to set color and width (didnt work when i tried to add it to the var option = {..... code... }

My code is the following :
<!DOCTYPE html>
<html>
  <head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<meta charset="utf-8">
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
          // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);
      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
// get the php result
var countra1=parseInt(<?php echo json_encode($num_ra1); ?>) || 0;
var countrf2=parseInt(<?php echo json_encode($num_rf2); ?>) || 0;
var countni3=parseInt(<?php echo json_encode($num_ni3); ?>) || 0;
      function drawChart() {
      // Create the data table.
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Réponse');
      data.addColumn('number', 'Choix');
      data.addRows([
        ['reduire affecter', countra1],
        ['reduire façon', countrf2],
        ['non important', countni3],
      ]);
// Set chart options
      var options = {backgroundColor: '#bfbfbf',
      'title':'votre opinion',
                     'width':660,
                     'height':495};
      // Instantiate and draw our chart, passing in some options.
      var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    }
    </script>
  </head>

Reply all
Reply to author
Forward
0 new messages