Google visualization 如何在谷歌图表api中垂直对齐柱形图表的图例?

Google visualization 如何在谷歌图表api中垂直对齐柱形图表的图例?,google-visualization,Google Visualization,我正在使用谷歌图表api在我的应用程序中开发图形,一切都很好,我能够生成图形。我正在使用柱状图,图例在图形上水平排列。柱状图中有20列,因此图例相互重叠。如何将它们垂直对齐。 请在这方面帮助我 <script type="text/javascript" src="http://10.211.30.24/assetinv/js/jsapi.js"></script> <script type="text/javascript"> googl

我正在使用谷歌图表api在我的应用程序中开发图形,一切都很好,我能够生成图形。我正在使用柱状图,图例在图形上水平排列。柱状图中有20列,因此图例相互重叠。如何将它们垂直对齐。 请在这方面帮助我

<script type="text/javascript" src="http://10.211.30.24/assetinv/js/jsapi.js"></script>   
 <script type="text/javascript">     
 google.load("visualization", "1", {packages:["corechart"]}); 

 google.setOnLoadCallback(drawChart);  

<?php

    /* Your Database Name */
    $dbname = 'finalCMS';

    /* Your Database User Name and Passowrd */
    $username = 'assetuser';
    $password = 'password1!';

    try {
      /* Establish the database connection */
      $conn = new PDO("mysql:host=localhost;dbname=$dbname", $username, $password);
      $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

      /* select all the weekly tasks from the table googlechart */
$result = $conn->query("SELECT `EquipmentMainCatagory`,count(`EquipmentMainCatagory`) as CountofAssets from asset a join assetinfo ai on a.assetid=ai.assetid and upper(ai.EquipmentStatus) like upper('%Active%') group by EquipmentMainCatagory");

      $rows = array();
      $table = array();
      $table['cols'] = array(

        // Labels for your chart, these represent the column titles.
        /* 
            note that one column is in "string" format and another one is in "number" format 
            as pie chart only required "numbers" for calculating percentage 
            and string will be used for Slice title
        */


        array('label' => 'EquipmentMainCatagory', 'type' => 'string'),
        array('label' => 'CountofAssets', 'type' => 'number')

    );
        /* Extract the information from $result */
        foreach($result as $r) {

          $temp = array();

          // the following line will be used to slice the Pie chart


          // Values of each slice
          $temp[] = array('v' => (string) $r['EquipmentMainCatagory']);
          $temp[] = array('v' => (float) $r['CountofAssets']); 
          $rows[] = array('c' => $temp);
        }

    $table['rows'] = $rows;

    // convert data into JSON format
    $jsonTable = json_encode($table);

    } catch(PDOException $e) {
        echo 'ERROR: ' . $e->getMessage();
    }
    //mysql_close($conn);

     $conn=null;

    ?>







    function drawChart() 
     {   

      var data = new google.visualization.DataTable(<?php echo $jsonTable?>);

       //data.setColumns([0, 1,
    //                       { calc: "stringify",
    //                         sourceColumn: 1,
    //                         type: "string",
    //                         role: "annotation" }
    //                       ]);
          var options = {
               title: 'Overall Equipment Categorization Statistics',

              width: 1000,
             height: 500,
              colors: ['#6495ED','#00FF00'],
              vAxis: {title: '# of Assets',titleTextStyle:{bold : true,italic:false}},
              hAxis: {title: 'EquipmentMainCategory', titleTextStyle: {color: 'red'}},
        //hAxis: {title: "Month"},


              series: {5: {type: "line"}
              }

            };


        //options.chd=t:data;
        //options.chds=a;

          // Instantiate and draw our chart, passing in some options.
          // Do not forget to check your div ID

                var chart1 = new google.visualization.ColumnChart(document.getElementById('piechart_3dmo1'));





         chart1.draw(data, options);


     }
     </script> 



      <div id="piechart_3dmo1" style="width: 1000px; height: 500px; position: relative;left: 221px;"></div> 
      'function drawChart() 
 {   

  var data = new google.visualization.DataTable({"cols":[{"label":"EquipmentMainCatagory","type":"string"},{"label":"count(`EquipmentMainCatagory`)","type":"number"}],"rows":[{"c":[{"v":""},{"v":1}]},{"c":[{"v":"Applications"},{"v":47}]},{"c":[{"v":"Backup Server"},{"v":11}]},{"c":[{"v":"Basic Infra (AD, SCCM, NAV,etc...)"},{"v":48}]},{"c":[{"v":"BMS, PBX and Others"},{"v":7}]},{"c":[{"v":"Database"},{"v":16}]},{"c":[{"v":"DMZ (External)"},{"v":13}]},{"c":[{"v":"EIS Applications"},{"v":7}]},{"c":[{"v":"File and Print"},{"v":27}]},{"c":[{"v":"Mail and Messaging"},{"v":17}]},{"c":[{"v":"Non Server"},{"v":8}]},{"c":[{"v":"SAP or ERP"},{"v":26}]},{"c":[{"v":"Storage"},{"v":2}]},{"c":[{"v":"VM Host"},{"v":1}]}]});

   //data.setColumns([0, 1,
//                       { calc: "stringify",
//                         sourceColumn: 1,
//                         type: "string",
//                         role: "annotation" }
//                       ]);
      var options = {
           title: 'Equipment Categorization Statistics of SEA',

         width: 1000,
         height: 500,
          colors: ['#6495ED','#00FF00'],
          vAxis: {title: '# of Assets',titleTextStyle:{bold : true,italic:false}},
          hAxis: {title: 'EquipmentMainCategory', titleTextStyle: {color: 'red'}},


          series: {5: {type: "line"}
          }

        };


    //options.chd=t:data;
    //options.chds=a;

      // Instantiate and draw our chart, passing in some options.
      // Do not forget to check your div ID

            var chart1 = new google.visualization.ColumnChart(document.getElementById('piechart_3dmsea'));





     chart1.draw(data, options);


 }
 </script> 



  <div id="piechart_3dmsea" style="width: 1000px; height: 500px; position: relative;left: 221px;"></div> 



</div>
'

load(“可视化”、“1”、{packages:[“corechart”]});
setOnLoadCallback(drawChart);
函数绘图图()
{   
var data=new google.visualization.DataTable();
//data.setColumns([0,1,
//{calc:“字符串化”,
//资料来源专栏:1,
//键入:“字符串”,
//角色:“注释”}
//                       ]);
变量选项={
标题:“总体设备分类统计”,
宽度:1000,
身高:500,
颜色:['#6495ED','#00FF00'],
vAxis:{title:'#of Assets',titleTextStyle:{bold:true,italic:false},
hAxis:{title:'EquipmentMainCategory',titleTextStyle:{color:'red'}},
//哈克斯:{标题:“月”},
系列:{5:{type:“line”}
}
};
//options.chd=t:数据;
//chds=a;
//实例化并绘制图表,传入一些选项。
//别忘了检查你的部门ID
var chart1=新的google.visualization.ColumnChart(document.getElementById('piechart_3dmo1');
图表1.绘制(数据、选项);
}
'函数绘图图()
{   
var data=new google.visualization.DataTable({“cols”:[{“label”:“EquipmentMainCatagory”,“type”:“count(`EquipmentMainCatagory`)”,“type”:“number”}],“rows”:[{“c”:[{“v”:“},{“v”:1}],{“c”:[{“v”:“Applications”},{“v”:47},{“c”:[{“v”:“v”:“v”:“备份服务器”},{“v”:“v”:“11}],{“c”:“{“v”:“v”:“v”:“基本的,infrancad,infrancad”},{{“c”c:[c:{“v”:“v”:16},,,{“c”:16},,,,{“c”c:“{“v”:16},,,,,{“c”c“““““:“DMZ(外部)和其他方面”以及PBX和其他方面的,”纽约州,PBX和PBX和其他一些,,{,,,,,,,{“c”c:::{“c”:““““““““下列下列下列下列下列下列下列下列”数据库”数据库”数据库,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,{“v”:26}]},{“c”:[{“v”:“存储”},{“v”:2}]},{“c”:[{“v”:”虚拟机主机“},{“v”:1}]}];
//data.setColumns([0,1,
//{calc:“字符串化”,
//资料来源专栏:1,
//键入:“字符串”,
//角色:“注释”}
//                       ]);
变量选项={
标题:“SEA设备分类统计”,
宽度:1000,
身高:500,
颜色:['#6495ED','#00FF00'],
vAxis:{title:'#of Assets',titleTextStyle:{bold:true,italic:false},
hAxis:{title:'EquipmentMainCategory',titleTextStyle:{color:'red'}},
系列:{5:{type:“line”}
}
};
//options.chd=t:数据;
//chds=a;
//实例化并绘制图表,传入一些选项。
//别忘了检查你的部门ID
var chart1=新的google.visualization.ColumnChart(document.getElementById('piechart_3dmsea');
图表1.绘制(数据、选项);
}
'

您是否有一些代码可以分享给我们看?我在这里发布了我的代码Jeremy Faller。在这张图中,我有大约15列扫描您向我们展示后期呈现的javascript(在浏览器中打开页面,查看源代码,然后发布javascript)?我们需要能够复制您看到的问题以找到解决方案。我已按照您告诉asgallant的方式发布了我的代码。请就此向我提出建议。Copy/pasta您的代码似乎适合我。图表以一定角度显示所有标签(由于标签很长,因此会有一些截断)。这里有什么意外行为?