[英]First time when I open a popup (Mapbox)
I'm trying to create a popup, but first time I do not get the right style. 我正在尝试创建一个弹出窗口,但是第一次我没有正确的样式。 What I can be doing wrong?
我可能做错了什么?
var canvas = document.getElementById("canvas");
My html. 我的HTML。
<canvas id='canvas' style="min-width: 600px; margin: -4px"></canvas>
My JavaScript code 我的JavaScript代码
map.on('click', 'region-capa', function (e) {
if (typeof myChart != 'undefined') {
myChart.destroy();
}
if (e) {
nombre = e.features[0].properties.SST_NOMBRE;
$.ajax({
type: "GET",
url: "/Mapa/GetEstadisticas/" + parseInt(e.features[0].properties.SST_ID),
contentType: "application/json",
dataType: "json",
success: function (response) {
if (response) {
grafica(response);
new mapboxgl.Popup({ closeButton: true, closeOnClick: true })
.setLngLat(e.lngLat)
.setDOMContent(canvas)
.addTo(map);
}
},
failure: function (response) {
alert(response);
}
});
}
});
I don't know what am I doing wrong? 我不知道我在做什么错?
Example that I got: https://user-images.githubusercontent.com/2707903/35266189-c11f0856-0022-11e8-9a4e-0e8c2a8420a0.JPG 我得到的示例: https : //user-images.githubusercontent.com/2707903/35266189-c11f0856-0022-11e8-9a4e-0e8c2a8420a0.JPG
I've found the answer. 我找到了答案。
I've change responsive options to false of my Chartjs config 我已将我的Chartjs配置的响应选项更改为false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.