Question

I have bullet sparkline in this fiddle which uses these configurations:

$('#sparkline')
    .sparkline(myvalues, {
    type: 'bullet',
    width: 100,
    targetColor: "#000",
    targetWidth: 4,
    tooltipValueLookups: {
        fields: {
            p: 'Current'
        }
    }
});

I would like to be able to show the tooltip only over the performance field (and not on top of the target). Is that possible?

Was it helpful?

Solution

Assuming that the 'Target' tooltip always contains a certain string, like 'Target' as it does in your fiddle, you can amend the sparkline.js file to behave how you want it to.

I have changed the following line in the sparkline.js file, from:

if (!content) {

to check for the word 'Target', like so:

if (!content || (content.indexOf("Target") != -1)) {

Please note I have changed the External Resources to point to a file on my server, which I will leave temporarily available.

If you check out this fiddle, it shows it working. I hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top