I am trying to get a custom tool tip for the line graph as I want the tool tip to describe the points in greater detail rather than the value of that point. (Image attached further explaining what I am on about)
I have given an attempt on how to do it.
Below is my code:
<script type="text/javascript"> $('#page3a').live('pageshow', function () {
var s1 = [1, 2, 3, 4, 5];
var s2 = ["Message 1", "Message 2", "Message 3", "Message 4", "Message 5"];
var lineGraph1 = $.jqplot('lineGraph1', [s1,s2], {
animate: true,
seriesDefault: {
showMarker: false,
pointLabels: { show: true }
},
grid: {
drawBorder: false,
drawGridlines: false,
background: '#eafaff',
shadow: false
},
axesDefaults: {
show: false,
showTicks: false,
showTickMarks: false
},
highlighter: {
show: true,
sizeAdjust: 8,
tooltipLocation: 'n',
tooltipAxes: 'piered',
formatString:'%s',
fadeTooltip: true,
tooltipFadeSpeed: "fast",
useAxesFormatters: false
}
});
});</script>
Any help would be greatly appreciated. :)
There is a configuration option that allows you to provide a custom callback method that is called to retrieve the tooltip contents:
highlighter: {
tooltipContentEditor: function (str, seriesIndex, pointIndex) {
return str + "<br/> additional data";
},
// other options just for completeness
show: true,
showTooltip: true,
tooltipFade: true,
sizeAdjust: 10,
formatString: '%s',
tooltipLocation: 'n',
useAxesFormatters: false,
}