我有一个包含两列(“TOTAL_ROOF”和“POTENTIAL_”)的融合表。“POTENTIAL_”是“TOTAL_ROOF”的子集。
现在我是:
1)显示由用户“点击”确定的格式化行数据
2) 尝试绘制饼图,即:drawVisualization.PieChart(e.row['TOTAL_ROOF', "POTENTIAL_'].value);
我已经让#1 开始工作了……但是,对于#2,我有点不知所措……我看到的所有示例都显示在用户单击任何内容之前已经创建了 PieChart。
点击后有没有办法创建饼图?将空格留空直到(就像#1一样)?
我也看不到如何在我的文本框中调用它(例如:http: //jsfiddle.net/fG5a5/1/)。
到目前为止,这是我的代码:
加载库:
google.load('maps', '3.5', {other_params:'sensor=false'});
google.load('jquery', '1.6.0');
google.load('visualization', '1', {packages:["corechart"]});
google.load('jqueryui', '1.8.12');
js
var tableid = 1DGswslbC5ijqWHPJvOH1NH7vltkZIPURJun_L5I;
var location_column = 'geometry'
function drawVisualization() {
google.visualization.drawChart({
"chartType": "PieChart"
})};
// Draw Visualization of WHAT (the event listener has not been triggered??)
function initialize() {
google.maps.event.addListener(layer, 'click', function(e) {
$("#roof-panel-area").html(
'<p><strong>Total Roof Area (sqft)</strong>: ' + ' ' +
Math.round(e.row['TOTAL_ROOF'].value) +
'<br><strong> Potential Roof Area (sqft)</strong>:' + ' '
+ Math.round(e.row['POTENTIAL_'].value) +
'<br><strong> Pitched or Flat Roof (?)</strong>:'+ ' ' +
e.row['PITCHED_OR'].value +
'<br><strong> # of Panels per Roof Area :</strong>' + ' ' +
Math.round(e.row['NUMBER_OF_'].value) + '</p>');
});
// Click Listener on layer using jquery , searches for fields related to
// roof/panel,
google.maps.event.addListener(layer, 'click', function(e) {
drawVisualization.PieChart(e.row['TOTAL_ROOF','POTENTIAL_'].value);
});
// Click Listener - updates graph
layer.setMap(map);
}
html:
<div id="sidebarItem">
<br>
<h1> Hatfield Solar Map</h1>
<!---Create a text box input for the user to enter the street address-->
Address: <input type="text" id="inputTextAddress" style=" width:200px" title="Address to Geocode" />
<!--Create a button input for the user to click to geocode the address-->
<input type="button" onclick="codeAddress()" id="inputButtonGeocode" style="width:200px" title="Click to Find Address" value="Click to Find Address" />
<h3>Select a building outline or search for an address to identify buildings that you'd like to select.</h3>
<!---Content from Click-->
<hr/>
<div id="sidebar-content-area" style="padding:5px;">
<div id="intro" style="text-align: center; margin-top: 20px; display: none;">
<p><i>Buildings are symbolized according to roof size, and the possibility of increased panel placement.</i><p>
</div>
<div id="overview" style:"">
<h3>Building Overview:</h3>
<p id ="roof-panel-area"></p>
</div>
</div>