Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tooltip plugin for wonderful Flot plotting library
branch: master

This branch is 128 commits behind krzysu:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
js
README.md
demo.png

README.md

jquery.flot.tooltip

tooltip plugin for wonderful Flot plotting library

Check http://code.google.com/p/flot/ for Flot details.

Works also with Time series data and supports Date formatting in the same way as Flot itself. You can fully define content of tip (with values precision) and you can use HTML tags too. Flot Tooltip can be easily customized with CSS. Just do what you want with #flotTip in your stylesheet.

See the example.html and example_series.html files and source code of plugin for details of how to use it.

Changelog

What's new in v0.4.4?

  • added percentages to content option
    • Example: content: '%p.2%' displays "20.25%"
    • Especially useful with pie charts (using flot.pie plugin)

v0.4.3

  • add jquery.flot.stack plugin support, values in tooltip are now displayed correctly (issue #3)

v0.4.2

  • tooltip is appended to body, not placeholder of graph
  • changed default values of tip's shifts
  • time is formatted when first axis of flot's multi-axes is in time mode (issue #2) (full multi-axes support maybe in the future)
  • #flotTip container is initialized only if it does not exist (see new multiple-axes example and re-initialize plot)

v0.4.1

  • default theme with new option to disable it if you like to add your own styles

v0.4

Now you can easily set precision of values displayed on tip thanks to enhanced string formatter. Just put your desired precision after value in format like this %x.precision, where precision is a number of digits to appear after the decimal point. It uses number.toFixed(precision) function internally.

What is more string formatter was rewritten and now is RegExp based.

Examples:

content: "value of X is %x.1 and value of Y is %y.4 and they belong to '%s' series"
content: "<h4>%s</h4><ul><li>X is %x</li><li>Y is %y.2</li></ul>"

v0.3

I'd like to introduce string formatter. Now you can easily define how content of your flot.tooltip should look like. You can also use HTML tags!

Just use new option called content. The following specifiers are supported:

  • %x: for X value
  • %y: for Y value
  • %s: for series label

From now on also minified version is available.

v0.2

  • many series support with series name on the tooltip
  • date and time formatting can be defined when in time mode (using internal plot function)
  • tooltip position shift can be defined

Important!

You need to set hoverable to true if you want this tooltip plugin to work.

grid: {
    hoverable: true 
}

Plugin Options (from v0.4.1)

In comments there are default values

tooltip:            boolean         //false
tooltipOpts: {
    content:        string          //"%s | X: %x | Y: %y.2"
    dateFormat:     string          //"%y-%0m-%0d"
    shifts: { 
        x:          int             //10
        y:          int             //20
    },
    defaultTheme:   boolean         //true
}
  • tooltip : set to true to turn on this plugin (if grid.hoverable is also set to true)
  • content : content of your tooltip, HTML tags are also allowed; use %s as series label, %x as X value, %y as Y value. With %x and %y values you can also use .precision, for example %x.2 means that value of X will be rounded to 2 digits after the decimal point.
  • dateFormat : you can use the same specifiers as in Flot, for time mode data
  • shifts : shift tooltip position regarding mouse pointer for x and y, negative values are ok
  • defaultTheme : plugin have default theme build-in but here you can switch it off and adjust look of tip styling #flotTip in your CSS

Depreciated in v0.3:

  • xValText : you can change text displayed on tooltip related to X value of hovered item
  • yValText : the same as above but regarding Y value
  • series : determine if name of series should be displayed in tooltip (if label exists)

Copyright (c) 2011 Krzysztof Urbas (@krzysu).

jquery.flot.tooltip is available under the MIT license.

Something went wrong with that request. Please try again.