我需要在一个页面中合并某些Google Chart。我该如何控制间距?

时间:2013-09-04 13:59:53

标签: charts

以下是Google Chart的Javascript。我已经在我的html中添加了以下内容然后使用表格编写了html的代码我已经合并了每个id。但是在每张图表之间,sapaces从上到下,从左到右变得过多。即使我没有为表格提供任何css属性,我怎么能控制它呢。

  google.load("visualization", "1", {packages:["corechart"]});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data1 = google.visualization.arrayToDataTable([
      ['Task', 'Question1'],
      ['I don’t know',     11],
      ['No',  49],
      ['Yes',      40]

    ]);

    var options1 = {
      title: 'Question1',
      pieHole: 0.4,
      chartArea:{left:8},
      'width': 400,
       'height': 400,
     colors: [ '#9bbb59', '#c0504d', '#4f81bd']
    };

    var data2 = google.visualization.arrayToDataTable([
      ['Task', 'Question2],
      ['Significant',     32],
      ['Moderate',      60],
      ['Minor', 8]

    ]);

    var options2 = {
      title: 'Question2'
      pieHole: 0.4,
      chartArea:{left:8},
      'width': 400,
       'height': 400,
      colors: ['#c0504d', '#9bbb59', '#4f81bd']
    };

    var data3 = google.visualization.arrayToDataTable([
      ['Task', 'Question3'],
      ['I don’t know',     24],
      ['From another platform',     11],
      ['Within the current team', 65]

    ]);

    var options3 = {
      title: 'Question3',
      pieHole: 0.4,
      chartArea:{left:8},
      'width': 400,
       'height': 400,
      colors: [ '#9bbb59', '#c0504d', '#4f81bd']
    };

    var data4 = google.visualization.arrayToDataTable([
      ['Task', 'Question4'],
      ['I don’t know',     16],
      ['No',  19],
      ['Yes',      65]

    ]);

    var options4 = {
      title: '4. Question4',
      pieHole: 0.4,
     chartArea:{left:8},
      'width': 400,
       'height': 400,

      colors: [ '#9bbb59', '#c0504d', '#4f81bd']
    };


    var data5 = google.visualization.arrayToDataTable([
      ['Task', 'Question5'],
      ['A clear, formalized and well distributed carried interest program',      38],
      ['The availability of equity in the GP', 24],
      ['Annual cash compensation that keeps up with the market',  22],
      ['Other (please specify)',     16]

    ]);

    var options5 = {
      title: 'Question5',
      position: 'left',
      legend : { position:"right"},
      pieHole: 0.4,
      chartArea:{left:0, width:"100%",height:"45%"},

      colors: ['#4f81bd', '#c0504d', '#9bbb59', '#8064a2']
    };


    var chart1 = new google.visualization.PieChart(document.getElementById('donutchart1'));
    chart1.draw(data1, options1);
    var chart2 = new google.visualization.PieChart(document.getElementById('donutchart2'));
    chart2.draw(data2, options2);
     var chart3 = new google.visualization.PieChart(document.getElementById('donutchart3'));
    chart3.draw(data3, options3);
     var chart4 = new google.visualization.PieChart(document.getElementById('donutchart4'));
    chart4.draw(data4, options4);
     var chart5 = new google.visualization.PieChart(document.getElementById('donutchart5'));
    chart5.draw(data5, options5);
  }

0 个答案:

没有答案