Search code examples
javascriptflot

How to display flot chart crosshair values in a <div> tag?


Being given this example: http://jsfiddle.net/ringstaff/k9FkZ/, how could I display sin and cos values in a <div></div>? I tried to append y like: $("#h2").eq(i).html(y.toFixed(2)); and H2: <div id="h2" />, but didn't work.

Thanks in advance!


Solution

  • See this fiddle for a working version.

    Added to the HTML:

    <div id="h1"></div>
    <div id="h2"></div>
    

    Added to the updateLegend function:

        $('#h' + (i + 1).toString()).html(series.label.replace(/=.*/, "= " + y.toFixed(2)));