Michele
Michele

Reputation: 8753

Display tool tips only over certain fields

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?

Upvotes: 1

Views: 135

Answers (1)

Luke
Luke

Reputation: 23680

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!

Upvotes: 1

Related Questions