未找到HTTP 404资源 - Grafana World Map Plugin自定义标记

时间:2017-06-21 18:49:31

标签: leaflet grafana

我正在尝试使用Leaflet JS库使用Grafana World Map插件的自定义标记。但即使我将自定义标记图像放在源目录中,我仍然会收到以下错误 -

http://localhost:3000/datacenter.png 404 (Not Found)

我的代码看起来像这样 -

var dataCenterIcon = window.L.icon({
    iconUrl: 'datacenter.png',
    iconSize:     [38, 95], // size of the icon
    iconAnchor:   [22, 94], // point of the icon which will correspond to marker's location
    popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
});

window.L.marker([caponeDCLat, caponeDCLong], {icon: dataCenterIcon}).addTo(this.map);

任何人都可以提供一些关于我在这里做错了什么的输入。

1 个答案:

答案 0 :(得分:2)

由于它是Grafana插件,因此路径与Grafana主页相关。

以下是WorldPing App的一个示例:

<img src="public/plugins/raintank-worldping-app/img/loading-pulse.svg"

请参阅:

https://github.com/raintank/worldping-app/blob/master/dist/components/probe/partials/probe_list.html#L11

相关问题