简体   繁体   English

Fusion Tables中的列格式未保留到map语句中

[英]Column formatting from Fusion Tables NOT carrying over into map statement

I imported a kml file into fusion tables and have been trying to modify it into a particular product standard. 我将kml文件导入融合表,并一直试图将其修改为特定的产品标准。 Particularly, I need to re-adjust the floating point numbers into integers. 特别是,我需要将浮点数重新调整为整数。

I already tried manually resetting the numbers that were not meant to be seen as floats in the fusion table (by adjusting the column settings). 我已经尝试过手动重置不希望在融合表中视为浮点数的数字(通过调整列设置)。 However in my 'infowindow' call statement they still remain as floats (for an example go here, BUT this is not my most up-to-date code....the below html file is....: http://www.solar.pioneervalleydata.org/html/map.html ). 但是,在我的“ infowindow”调用语句中,它们仍然保持为浮点数(例如,请转到此处,但这不是我最新的代码。...下面的html文件是....: http:// www.solar.pioneervalleydata.org/html/map.html )。

Can number formatting in fusion tables carry over in a map document? 融合表中的数字格式能否保留在地图文档中? Is there an html approach I can take in my statements to fix this (or is re-writting an array in my initialize function my only choice....which sounds like a pretty slow hack to me)... 我可以在语句中采用html方法来解决此问题(还是在我的初始化函数中重新写一个数组,这是我唯一的选择。...听起来对我来说很慢)

var infowindow = new google.maps.InfoWindow();
  google.maps.event.addListener(layer, 'click', function(e) {
    var contentString = [
             '<div class="tabs">',
         '<ul>',
     '<li><a href="#tab-1"><span>ROOF/PANEL AREA</span></a></li>' +
     '<li><a href="#tab-2"><span>ENERGY TOTALS</span></a></li>',
     '<ul>',
     '<div id="tab-1">',
     '<div class="contents" style="display:block">' + 
     '<p>' + '<br>' + '<br>' + 'Total Roof Area (sqft) :' +              
             '&nbsp;&nbsp;&nbsp;' + e.row['TOTAL_ROOF'].value + '</p>',
    '<p>' + 'Potential Roof Area (sqft) :' + '&nbsp;&nbsp;&nbsp;' + 
             e.row['POTENTIAL_'].value + '</p>',
        '<p>' + 'Pitched or Flat Roof (?) :' + '&nbsp;&nbsp;&nbsp;' + 
            e.row['PITCHED_OR'].value + '</p>',
    '<p>' + 'Number of Panels for available Roof Area :' + 
            '&nbsp;&nbsp;&nbsp;' + e.row['NUMBER_OF_'].value + '</p>',
    '</div>',
    '</div>',
    '<div id="tab-2">',
    '<div class="contents" style="display:block">' + 
    '<p>' + '<br>' + '<br>' + 'Watts generated (# of Panels * 250kw) :' + 
            '&nbsp;&nbsp;&nbsp;' + e.row['WATTS'].value + '</p>',
    '<p>' + 'Annual KWH inc. est. daylight/cloud conditions (Watts generated / 
           1.18125) :' + '&nbsp;&nbsp;&nbsp;' + e.row['KWH_PER_YR'].value + '</p>',
    '<p>' + 'Value of Electricity PER Year (Annual KWH * .118) :' +     
           '&nbsp;&nbsp;&nbsp;' + e.row['ANNUAL_DOL'].value + '</p>',
    '<p>' + 'Value of Electricity PER Month (Electricity PER Year / 12) :' 
           + '&nbsp;&nbsp;&nbsp;' + e.row['MONTHLY_DO'].value + '</p>',
    '</div>',
    '</div>'

I would keep the data in Fusion Tables. 我会将数据保留在Fusion Tables中。 If I understand you correctly the data is not wrong, you just want to display it differently. 如果我正确地理解了您的数据,则没有错,您只是想以不同的方式显示它。

If this is the case, you can adjust the formatting of the InfoWindow. 在这种情况下,您可以调整InfoWindow的格式。 Just use JavaScript to change the display of the values. 只需使用JavaScript即可更改值的显示。 You can choose between several options to convert floats to integers: 您可以在多个选项之间进行选择,以将浮点数转换为整数:

Example: 例:

  '<p>' + 'Potential Roof Area (sqft) :' + Math.round(e.row['POTENTIAL_'].value) + '</p>'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM