如何使用Raphael制作复杂的图表

时间:2012-03-21 05:47:58

标签: raphael

我应该制作这种类型的图表,是否可以通过Raphael或Raphael的任何好插件制作。 (我更喜欢raphael,因为我已经使用了这个),我附上了我需要制作的图片吗?

enter image description here

感谢提前..

1 个答案:

答案 0 :(得分:0)

我真的建议只使用Raphael库手动绘制东西。当我们需要一个不常见的图形类型时,我试图让现有的图形库来绘制它,但它很糟糕。我在一个晚上嘲笑了一个原型,以证明用raphael手动绘制它有多清洁,我们最终使用它。你可以尝试做的最好的事情是原型你正在寻找:为图形创建一个虚拟的Json集合并尝试从这些数据绘制。您应该发现将内容区域划分为相对简单:

numberOfMonths = 6;
barsPerMonth = 2;
marginLeft = 40;
marginRight = 40;

graphArea = canvasWidth - marginLeft - marginRight;
monthWidth = graphArea /  numberOfMonths;
barWidth = monthWidth / barsPerMonth;

只需定义所需的所有边距和宽度即可。定义轴的范围并定义刻度尺/计数。这应该让你开始。