【问题标题】:Hide full screen control of google map charts隐藏谷歌地图图表的全屏控制
【发布时间】:2018-03-29 23:27:53
【问题描述】:

您好,我正在使用谷歌可视化图表Google Map Chart 中提供的谷歌地图图表。但是我们没有办法隐藏出现在右上角的全屏控制符号。可用选项可见here。我也尝试使用官方 google map api 文档fullscreenControl 上给出的 fullscreenControl: false 选项,但这对我不起作用。请建议如何在移动/离子应用上禁用此选项。

this.element = this.el.nativeElement;

let mapOptions = {
    showTooltip: true,
    tooltip: { isHtml: true },
    mapType: 'satellite',
    useMapTypeControl: true,
    fullscreenControl: false
};

let data = [
    ['Lat', 'Long', 'Name'],
    [37.4232, -122.0853, 'Work'],
    [37.4289, -122.1697, 'University'],
    [37.6153, -122.3900, 'Airport'],
    [37.4422, -122.1731, 'Shopping']
    ];

dataTable = google.visualization.arrayToDataTable( data );

this.map = new google.visualization.Map(this.element);

this.map.draw( dataTable, mapOptions );

提前致谢

【问题讨论】:

  • 这可能会有所帮助:stackoverflow.com/questions/32654034/…
  • 解决了但没有用。
  • 你怎么称呼地图?你用的是包吗?如果你能展示一些可以帮助人们弄清楚的代码。
  • @admcfajn,我自己添加了一个有问题的示例代码。请看一下。谢谢
  • fullscreenControl 设置为 false 会从主地图中隐藏全屏按钮,但我无法弄清楚如何从街景中隐藏全屏按钮。有人管理过这个吗?

标签: javascript google-maps charts google-visualization ionic3


【解决方案1】:

下面的代码在 Ionic 应用中为我工作,你可以试试这个:

declare var google; // declare this var above @Component({}) with your other imports

directionsDisplay = new google.maps.DirectionsRenderer;
@ViewChild('map') mapElement: ElementRef;
map: any;

this.map = new google.maps.Map(this.mapElement.nativeElement, {
  zoom: 15,
  center: this.maplocation, // this.maplocation={lat:'',long:''} is my Lat,Long values
  fullscreenControl: false
});

this.directionsDisplay.setMap(this.map);
new google.maps.Marker({
  position: this.maplocation,
  map: this.map
});

在 HTML 中:

<ion-content>  
  <div #map id="map"></div>
</ion-content>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-27
    • 1970-01-01
    • 2017-12-04
    • 1970-01-01
    • 2012-12-17
    • 2013-06-08
    • 1970-01-01
    相关资源
    最近更新 更多