jqplot中反转轴上的填充值 [英] Padding values on inverted axis in jqplot

查看:92
本文介绍了jqplot中反转轴上的填充值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何为jqplot轴设置正确的填充值,以免在边界上绘制点.

i would like to know how to set the correct padding values to a jqplot axis so that points aren't rendered on the borders.

这是我拥有的代码

yaxis:{     
    max: 1,
    min: 200,
    numberTicks: 5,
    tickOptions:{
        formatString:'%i'
    }
 }

这将显示一个倒置轴,从底部的200到顶部的1.值也从1到200不等.我尝试使用maxPad,minPad甚至使用(ticks:['200','150','100','50','1'])手动设置刻度,但没有运气到目前为止.

this displays an inverted axis going from 200 on the bottom to 1 on the top. values vary also from 1 to 200. i have tried with maxPad, minPad and even setting the ticks manually with ( ticks: ['200','150','100','50','1'] ) but no luck so far.

提前感谢:)

推荐答案

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

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.

这篇关于jqplot中反转轴上的填充值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆