krzysu / flot.tooltip

tooltip plugin for wonderful Flot plotting library
https://github.com/krzysu/flot.tooltip
187 stars 153 forks source link

Use custom tick label for Y axis #60

Closed LoicUV closed 10 years ago

LoicUV commented 10 years ago

As it is for x axis, it may be useful to use custom tick labels for y axis if they are given. Here's my code, feel free to improve it :

// change y from number to given label, if given
if(typeof item.series.yaxis.ticks !== 'undefined') {
    for (var index in item.series.yaxis.ticks) {
        if (item.series.yaxis.ticks.hasOwnProperty(index)) {
            if (item.series.yaxis.ticks[index].v === y) {
                content = content.replace(yPattern, item.series.yaxis.ticks[index].label);
            }
        }
    }
}
krzysu commented 10 years ago

can you provide example of use? then I will be able to test it. Feel free to add a new file in /examples folder and send pull request. Thanks!

LoicUV commented 10 years ago

Sent a pull request with the changes !