2
내가 차트를 표시 할 graphaeljs 라이브러리를 사용하고 내가 graphaeljs 웹 사이트graphaeljs 오류
<script src="scripts/raphael.js"></script>
<script src="scripts/g.raphael-min.js"></script>
<script src="scripts/g.bar-min.js"></script>
<script>
window.onload = function() {
var r = Raphael("holder"),
fin = function() {
this.flag = r.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
},
fout = function() {
this.flag.animate({ opacity: 0 }, 300, function() { this.remove(); });
},
fin2 = function() {
var y = [], res = [];
for (var i = this.bars.length; i--;) {
y.push(this.bars[i].y);
res.push(this.bars[i].value || "0");
}
this.flag = r.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this);
},
fout2 = function() {
this.flag.animate({ opacity: 0 }, 300, function() { this.remove(); });
},
txtattr = { font: "12px sans-serif" };
r.text(160, 10, "Single Series Chart").attr(txtattr);
r.text(480, 10, "Multiline Series Stacked Chart").attr(txtattr);
r.text(160, 250, "Multiple Series Chart").attr(txtattr);
r.text(480, 250, "Multiline Series Stacked Chart\nColumn Hover").attr(txtattr);
r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]]).hover(fin, fout);
r.hbarchart(330, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], { stacked: true }).hover(fin, fout);
r.hbarchart(10, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]]).hover(fin, fout);
var c = r.barchart(330, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], { stacked: true, type: "soft" }).hoverColumn(fin2, fout2);
};
</script>
에서이 코드를 복사 그러나 한 내 브라우저에서 실행할 때, 이 메시지가 나타납니다
Uncaught TypeError: Cannot read property 'x' of undefined raphael.js:11
c._engine.create raphael.js:11
c raphael.js:9
window.onload (index):92
내가 뭘 잘못했는지 정확히 모르겠다. 제 실수라고 할 수 있겠습니까?
감사합니다. 나는 id = "holder"를 잊었다. 최선의 답변으로 선택되었습니다. Btw 당신이 graphael에 익숙한, 당신도 도와 줄 수 있습니까? http://stackoverflow.com/questions/21097540/weird-chart-maximum-axis-x-value 또는 http://stackoverflow.com/questions/21098797/where-does-graphael-line-chart-calculates-its - 최대 값? 나는이 어제부터 쌓아 올랐다. 아무도 나에게 대답하지 않았다. –
미안하지만 나는 실제로 라파엘/라파엘에 익숙하지 않다. 그러나 나는 어떤 결과에 대해서도 덧붙일 것이다. – haferje
고맙습니다. 많은 친구 :) –