Draw axis thru x=0 and y=0

半腔热情 提交于 2019-12-24 00:58:18

问题


I have a set of data that I'm plotting as a scatter graph which has both positive and negative values on both axis. When I plot this in Flot, the axis are draw at the bottom and the left by default. Is there a way to make it draw the axis through the center of the graph? @X=0 and Y=0?

In other words, instead of this:

I want something like this:


回答1:


That isn't possible in the default flot. I'm sure it could be hacked in if you wanted to dig into the source, but flot by itself only supports left/right for the y-axis, and top/bottom for the x-axis.




回答2:


In case anybody else comes across the same need, I created a plugin for Flot and put it here:

https://github.com/burlandm/Flot-Origin-Axis

It does what I need, but I won't make any promises that it'll fit your particular scenario. If I have time, I might try and update it to cover more scenarios.



来源:https://stackoverflow.com/questions/12427026/draw-axis-thru-x-0-and-y-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!