用指数x轴绘制图

时间:2022-04-20 01:16:58

Trying to build a plot with an exponent x-axis. It should start with 0 and increasing by the power of 1.85

尝试使用指数x轴构建绘图。它应该从0开始并以1.85的幂增加

i.e.:
tick:1 label:1000 value:3.55
tick:2 label:1500 value:7.51
tick:3 label:2000 value:12.79
tick:4 label:2500 value:19.33
tick:5 label:3000 value:27.08
and so on untill 7000.

即:tick:1标签:1000值:3.55 tick:2 label:1500 value:7.51 tick:3 label:2000 value:12.79 tick:4 label:2500 value:19.33 tick:5 label:3000 value:27.08依此类推直到7000。

obviously, the value should be the distance of the tick from the 0,0 point. The y-axis should be from 0 to 7.

显然,该值应该是从0,0点开始的距离。 y轴应为0到7。

Being trying to achieve this using custom ticks without success.
I'm guessing I could use a function to produce the array but don't know how.

尝试使用自定义滴答来实现这一点但没有成功。我猜我可以使用一个函数来生成数组,但不知道如何。

1 个解决方案

#1


2  

If flot doesn't allow your to have exponential axes, with custom exponents, then just pre scale your axes and data and use custom ticks and labels.

如果flot不允许你有指数轴,使用自定义指数,那么只需预先缩放你的轴和数据,并使用自定义刻度和标签。

EDIT: here is a jsFiddle which i think does what you want. The tickLabel rotation is annoyingly necessary to prevent the labels overlapping one another.

编辑:这是一个jsFiddle,我认为你做了什么。为了防止标签彼此重叠,需要使用tickLabel旋转。

#1


2  

If flot doesn't allow your to have exponential axes, with custom exponents, then just pre scale your axes and data and use custom ticks and labels.

如果flot不允许你有指数轴,使用自定义指数,那么只需预先缩放你的轴和数据,并使用自定义刻度和标签。

EDIT: here is a jsFiddle which i think does what you want. The tickLabel rotation is annoyingly necessary to prevent the labels overlapping one another.

编辑:这是一个jsFiddle,我认为你做了什么。为了防止标签彼此重叠,需要使用tickLabel旋转。