Skip to main content

flotjs labels on tooltips for categories plugin

I had been using awesome flot.js charting library on my results app. The charts were easy to generate and I included categories plugin to replace x-axis labels to words rather than integer values.

But I faced some issues while enabling tooltips and having them display the labels rather than x coordinates. I checked up the source code.

[caption id="attachment_35" align="aligncenter" width="646"]flotjs categories plugin docs getAxes()??[/caption]

plot.getAxes() method described in the documentation was giving me an undefined method error.I searched the docs, searched on Google, stackexchange etc.. but to no avail.

Then I found solution thanks to firebug.

I did a console.log() of the whole item object and began inspecting. I could see few objects that looked promising. Upon further inspection I found a way to map a value back to its label.

[caption id="attachment_34" align="aligncenter" width="924"]dumping whole object Dumping entire item object in firebug[/caption]

I found 3 ways

  1. item.series.data[previousPoint][0]

  2. item.series.xaxis.categories

  3. item.series.xaxis.ticks[previousPoint].label


Note:-- previousPoint is the point reference on x-axis.

Problem Solved.

Comments

Popular posts from this blog

How to split large mp3 files using mp3splt

If you have a  lengthy  or large MP3 file and you want to  split  it into files of smaller size or duration, You can easily do this using mp3splt. Mp3splt   is an utility to split mp3 and ogg vorbis digital audio files without the need of decoding. It can be used to split a file into no of tracks of fixed duration and size or specified  split points. It supports variable bit rate mp3 files, silent detection, splitting with local .XMCD, .CDDB or .CUE file splitpoints or from external servers like   tracktype.org . It copies the original files first and then generates new, smaller files during the process of splitting without altering the original file. It does not do any encoding or decoding so the splitting is very fast and lossless. Steps to follow Navigate to directory where you have downloaded mp3splt { if using portable version } . Run and execute mp3slpt using the command   mp3splt  . Specify the options according to which you wanna split. The basic syntax is   mp3splt [file path]...

Convert/Compress multiple images at once using IrfanView

Want to convert/compress multiple images at once? You can easily do this using a very useful and small image viewer called IrfanView. IrfanView is free image viewer that can be used to view, convert, optimize, process image files of numerous formats. It can also handle few video/audio formats, and has limited image creation and painting capabilities. It’s like an Swiss Army Knife for images. Some Features:— You can read more about IrfanView Here. Let’s get started. Open IrfanView and select Batch Conversion/Rename option from File Menu(Shortcut Key: B ) Navigate to folder where your images are located and Add the ones you want to compress. Choose the options you want to do from left window pane. Select the format and other options like Compression Ratio etc. from the Batch Conversion Settings Menu. Choose the options according to your need. After you are all set Click Start Batch. You images will be converted and you can find them in the specified output directory. Note—...