6

I have a jqplot chart with two data lines. Only one should have the highlighter enabled. I tried this:

series:[
    {
        highlighter: {
            formatString: "",
            show: false
        }
    },
    {
        highlighter: {
            formatString: "Day %s: %d",
            show: true
        }
    }
]

But unfortunately, this doesn't work: the highlighter shows a small empty dot at the first line, whereas it should show nothing.

How do I show the highlighter on one chart and not on the other?

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
  • 5
    You might want to check out http://stackoverflow.com/questions/3003772/jqplot-highlighter-for-different-line-graphs – Moss Oct 31 '12 at 09:58

2 Answers2

2

This is a very interesting question (+1). The only solution that came to my mind, as playing with options of a plot didn't help, was to clean the canvas and hide highlighter's tooltip every time that it is suppose to show. This is done in the code below and presented in a working sample available here.

$('#chart').bind('jqplotMouseMove', function(event, xy, axesData, neighbor, plot) {
    if (neighbor && neighbor.seriesIndex == 0) {
        var drawingCanvas = $(".jqplot-highlight-canvas")[0];
        var context = drawingCanvas.getContext('2d');
        context.clearRect(0, 0, drawingCanvas.width, drawingCanvas.height);
        $('.jqplot-highlighter-tooltip').hide();
    }
});
Boro
  • 7,913
  • 4
  • 43
  • 85
  • thanks for your reply! I guess I have to change the value 0 in the if-sentence in case I want to hide another series? –  Jul 23 '12 at 17:55
  • Yes that is what you should do or add a list and a for loop and you will have it for many series. – Boro Jul 24 '12 at 09:10
2

set showHighlight: false for the series for which you don't need highlighter

Swapna VD
  • 21
  • 1