0
JS의 스 니펫을 사용하여 그래프를 생성하려고합니다. metrics2에 문제가있는 것 같습니다.왜 입체파 JS의이 스 니펫이 Graphite에서 그래프를 생성하지 않습니까?
이 경우 metrics2를 설정하면 내 브라우저에 그래프가 렌더링됩니다.
[1]
var metrics2 = [
graphite.metric("servers.<HOSTNAME>-1_domain_local.load.load.shortterm"),
graphite.metric("servers.<HOSTNAME>-2_domain_local.load.load.shortterm"),
graphite.metric("servers.<HOSTNAME>-3_domain_local.load.load.shortterm"),
graphite.metric("servers.<HOSTNAME>-4_domain_local.load.load.shortterm")
]
그러나, JS 다음 코드에서 그래프가 브라우저에서 렌더링되지 않습니다.
[2]
var metrics = [];
graphite.find("servers.*.load.load.shortterm", function(error, results) {
for (var i = 0; i < results.length; i++) {
metrics[i] = results[i];
}
});
var metrics2 = metrics.map(function(i) {
return graphite.metric(i);
});
이 metrics2를 호출 그래프를 생성 입체파 조각이다.
d3.select(".span4").call(function(div) {
a = metrics.length;
div.select(".charts2").call(context.axis().orient("top"));
div.select(".charts2").selectAll(".horizon")
.data(metrics2)
.enter().append("div")
.attr("class", "horizon")
.call(context.horizon().height(30));
});
[2] 실제로 그래프를 생성하지 않는 이유는 무엇입니까? metrics2 배열에 뭔가가 있습니까?