Padding values on inverted axis in jqplot

前端 未结 1 1314
北海茫月
北海茫月 2020-12-21 16:52

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.

this is the code i have

y         


        
相关标签:
1条回答
  • 2020-12-21 17:22

    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.

    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. :)

    EDIT

    Please see another version which offers a solution that doesn't involve manipulating with the jqPlot script.

    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.

    0 讨论(0)
提交回复
热议问题