且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jqplot中反转轴上的填充值

更新时间:2023-11-26 13:27:40

这既有趣又放松.您的问题的答案很明显,因为设置轴的最小/最大时显然会忽略填充设置.因此,您应该使用将点从边界移开的方法就是增加最小/最大值就像代码中的.

That was interesting and relaxing at the same time. The answer to your problem is obvious, since the padding settings are apparently ignored when setting min/max for an axis. Therefore, what you should use to move points away from the border is just increase min/max values just like in the code.

第一个图形的最小/最大值增加了,以使点远离图的边界,而下一个(为相同数据创建)则没有.

First graph has min/max increased to move the points away from the borders of the plot, the below one (created for the same data) does not.

为避免此类问题和手动设置这些参数,为什么没有一种可以根据给定数据计算并返回最小值/最大值的方法.然后在图形中为每个值应用所需的间隙(填充).就像在代码中使用minMax(data)方法一样.

To avoid this sort of issues and manual setting of these parameters why don't you have a method which could from the given data calculate and return min/max. Then in your graph for each of the values you apply the gap (pad) you like. Just as it is done with use of the minMax(data) method in the code.

顺便说一句::感谢您教我如何反转绘图的值,我不知道该技巧. :)

BTW: Thanks for teaching me how to invert values of a plot I didn't know this trick. :)

编辑

请参阅另一个版本,该版本提供了不涉及使用jqPlot脚本进行操作的解决方案.

在这种方法中,我基本上是隐藏不需要的值标签,刻度线仍然存在.恐怕如果不与情节的画布进行交互,您将无法删除那些不需要的滴答声.

In this approach I am basically hiding the unwanted value labels, tick marks still are there. I am afraid that without interacting with canvas of the plot you cannot remove those unwanted ticks.