Plugin which will highlight data points when they are moused over.

To use this plugin, include the js file in your source:

<script type="text/javascript" src="plugins/jqplot.highlighter.js"></script>

A tooltip providing information about the data point is enabled by default.  To disable the tooltip, set “showTooltip” to false.

You can control what data is displayed in the tooltip with various options.  The “tooltipAxes” option controls whether the x, y or both data values are displayed.

Some chart types (e.g. hi-low-close) have more than one y value per data point.  To display the additional values in the tooltip, set the “yvalues” option to the desired number of y values present (3 for a hlc chart).

By default, data values will be formatted with the same formatting specifiers as used to format the axis ticks.  A custom format code can be supplied with the tooltipFormatString option.  This will apply to all values in the tooltip.

For more complete control, the “formatString” option can be set.  This Allows conplete control over tooltip formatting.  Values are passed to the format string in an order determined by the “tooltipAxes” and “yvalues” options.  So, if you have a hi-low-close chart and you just want to display the hi-low-close values in the tooltip, you could set a formatString like:

highlighter: {
    tooltipAxes: 'y',
    yvalues: 3,
    formatString:'<table class="jqplot-highlighter">
        <tr><td>hi:</td><td>%s</td></tr>
        <tr><td>low:</td><td>%s</td></tr>
        <tr><td>close:</td><td>%s</td></tr></table>'
}
Summary
$.jqplot.HighlighterPlugin which will highlight data points when they are moused over.
Properties
showtrue to show the highlight.
markerRendererRenderer used to draw the marker of the highlighted point.
showMarkertrue to show the marker
lineWidthAdjustPixels to add to the lineWidth of the highlight.
sizeAdjustPixels to add to the overall size of the highlight.
showTooltipShow a tooltip with data point values.
tooltipLocationWhere to position tooltip, ‘n’, ‘ne’, ‘e’, ‘se’, ‘s’, ‘sw’, ‘w’, ‘nw’
fadeTooltiptrue = fade in/out tooltip, flase = show/hide tooltip
tooltipFadeSpeed‘slow’, ‘def’, ‘fast’, or number of milliseconds.
tooltipOffsetPixel offset of tooltip from the highlight.
tooltipAxesWhich axes to display in tooltip, ‘x’, ‘y’ or ‘both’, ‘xy’ or ‘yx’ ‘both’ and ‘xy’ are equivalent, ‘yx’ reverses order of labels.
useAxesFormattersUse the x and y axes formatters to format the text in the tooltip.
tooltipFormatStringsprintf format string for the tooltip.
formatStringalternative to tooltipFormatString will format the whole tooltip text, populating with x, y values as indicated by tooltipAxes option.
yvaluesNumber of y values to expect in the data point array.
bringSeriesToFrontThis option requires jQuery 1.4+ True to bring the series of the highlighted point to the front of other series.

Properties

show

this.show = $.jqplot.config.enablePlugins

true to show the highlight.

markerRenderer

this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false})

Renderer used to draw the marker of the highlighted point.  Renderer will assimilate attributes from the data point being highlighted, so no attributes need set on the renderer directly.  Default is to turn off shadow drawing on the highlighted point.

showMarker

this.showMarker = true

true to show the marker

lineWidthAdjust

this.lineWidthAdjust = 2.5

Pixels to add to the lineWidth of the highlight.

sizeAdjust

this.sizeAdjust = 5

Pixels to add to the overall size of the highlight.

showTooltip

this.showTooltip = true

Show a tooltip with data point values.

tooltipLocation

this.tooltipLocation = 'nw'

Where to position tooltip, ‘n’, ‘ne’, ‘e’, ‘se’, ‘s’, ‘sw’, ‘w’, ‘nw’

fadeTooltip

this.fadeTooltip = true

true = fade in/out tooltip, flase = show/hide tooltip

tooltipFadeSpeed

this.tooltipFadeSpeed = "fast"

’slow’, ‘def’, ‘fast’, or number of milliseconds.

tooltipOffset

this.tooltipOffset = 2

Pixel offset of tooltip from the highlight.

tooltipAxes

this.tooltipAxes = 'both'

Which axes to display in tooltip, ‘x’, ‘y’ or ‘both’, ‘xy’ or ‘yx’ ‘both’ and ‘xy’ are equivalent, ‘yx’ reverses order of labels.

useAxesFormatters

this.useAxesFormatters = true

Use the x and y axes formatters to format the text in the tooltip.

tooltipFormatString

this.tooltipFormatString = '%.5P'

sprintf format string for the tooltip.  Uses Ash Searle’s javascript sprintf implementation found here: http://hexmen.com/blog/2007/03/printf-sprintf/ See http://perldoc.perl.org/functions/sprintf.html for reference.  Additional “p” and “P” format specifiers added by Chris Leonello.

formatString

this.formatString = null

alternative to tooltipFormatString will format the whole tooltip text, populating with x, y values as indicated by tooltipAxes option.  So, you could have a tooltip like: ‘Date: %s, number of cats: %d’ to format the whole tooltip at one go.  If useAxesFormatters is true, values will be formatted according to Axes formatters and you can populate your tooltip string with %s placeholders.

yvalues

this.yvalues = 1

Number of y values to expect in the data point array.  Typically this is 1.  Certain plots, like OHLC, will have more y values in each data point array.

bringSeriesToFront

this.bringSeriesToFront = false

This option requires jQuery 1.4+ True to bring the series of the highlighted point to the front of other series.

this.show = $.jqplot.config.enablePlugins
true to show the highlight.
this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false})
Renderer used to draw the marker of the highlighted point.
this.showMarker = true
true to show the marker
this.lineWidthAdjust = 2.5
Pixels to add to the lineWidth of the highlight.
this.sizeAdjust = 5
Pixels to add to the overall size of the highlight.
this.showTooltip = true
Show a tooltip with data point values.
this.tooltipLocation = 'nw'
Where to position tooltip, ‘n’, ‘ne’, ‘e’, ‘se’, ‘s’, ‘sw’, ‘w’, ‘nw’
this.fadeTooltip = true
true = fade in/out tooltip, flase = show/hide tooltip
this.tooltipFadeSpeed = "fast"
‘slow’, ‘def’, ‘fast’, or number of milliseconds.
this.tooltipOffset = 2
Pixel offset of tooltip from the highlight.
this.tooltipAxes = 'both'
Which axes to display in tooltip, ‘x’, ‘y’ or ‘both’, ‘xy’ or ‘yx’ ‘both’ and ‘xy’ are equivalent, ‘yx’ reverses order of labels.
this.useAxesFormatters = true
Use the x and y axes formatters to format the text in the tooltip.
this.tooltipFormatString = '%.5P'
sprintf format string for the tooltip.
this.formatString = null
alternative to tooltipFormatString will format the whole tooltip text, populating with x, y values as indicated by tooltipAxes option.
this.yvalues = 1
Number of y values to expect in the data point array.
this.bringSeriesToFront = false
This option requires jQuery 1.4+ True to bring the series of the highlighted point to the front of other series.
Close