Take the 2-minute tour ×

So I am using jqPlot to display distance (y-axis) over time (x-axis) in a simple line graph.

However, while I have actual distances as the underlying data used to position the points, I'm not interested in displaying those distances on the y-axis.

Instead, there are a series of landmarks at given distances, that I want to appear on the y-axis as a 'tick' next to the appropriate point for the distance to that landmark. That way the line appears to "pass" each landmark as it travels upward.

Currently I'm "faking" this by hiding the ticks and putting a manually-created series of labels next to the graph. This works well enough, but I had to disable vertical zooming because if the user chose to zoom in, the labels would not match up with the actual distances. My users would really like to zoom in vertically, however, and I want to allow them to.

Therefore, does anyone know of a way (a plugin or similar) that would allow me to associate custom labels with given tick marks in jqPlot, that will match up nicely and respond to zooming? It would be necessary to hide some of the landmarks if the graph is zoomed out too much, so that would have to be a feature.

Alternatively, if someone knows of a "zoom event" that passes in the min and max y values, I could probably recreate my manual labels with that data, so let me know if you know of a way to get that information. I haven't been able to find one.

share|improve this question
This sounds interesting (+1). Did you manage to sort this one out? Please share otherwise please show a code sample presenting the problem on jsfiddle.net so we can look into it. –  Boro May 29 '12 at 14:18

1 Answer 1

I would need to see a bit of your code to customize it to the distance but to start with you could label the ticks and it will display over the size of the chart.

axes:{yaxis:{ticks:['DiscanceA','DiscanceB', 'DiscanceC', 'DiscanceD', 'DiscanceE'],     
renderer: $.jqplot.CategoryAxisRenderer,},

Let me know how it goes and if you have any code lets see it!

share|improve this answer
Unfortunately, much as with Boro's comment, I cannot share the code in question, and I don't really have time to put together a fake example. Yes, I know this makes it very difficult to actually help; I'd been hoping when I asked that there was simply a renderer out there that I was unaware of... Anyway, CategoryAxisRenderer just puts the labels at even intervals... do you know of a way to change that? –  KRyan Jul 6 '12 at 15:31

Your Answer


