我创建了一个带有graphael库的折线图。但它不能正常工作: - x轴步骤不显示文本。 - y轴步骤显示不正确的mersuare。 这里是代码:
var paper = Raphael("chartNode","100%","100%");
xAxis = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
yData = [1,2,3,4,5,6,7,8,9,10,11,12];
options = {
symbol: "circle",
nostroke: false,
smooth: false,
shade: true,
colors: ["#ffcc00","#ff0000"],
axis: "0 0 1 1",
axisxstep: xAxis.length - 1,
axisystep: 10
};
var lines = paper.linechart(70,60,850,350,[0,1,2,3,4,5,6,7,8,9,10,11],yData,options);
lines.hoverColumn(function() {
this.tags = paper.set();
for ( var i = 0, ii = this.y.length; i < ii; i++) {
tagDegree = i * 90 + 45;
var nTag = paper.popup(this.x, this.y[i], ": "
+ this.values[i], 'right', 5);
this.tags.push(nTag.insertBefore(this).attr([ {
fill : "#8F6F4F"
}, {
fill : "#ffffff"
} ]));
}
}, function() {
this.tags && this.tags.remove();
});
//set text for x axis
$.each(lines.axis[0].text.items, function(index, label) {
this.attr("text", xAxis[index]);
});
lines.symbols.attr({
r:5
});
结果:Result
请!帮助我。