Jquery sparklines: Possible to have different tooltips? -
i'm using jquery sparklines (http://omnipotent.net/jquery.sparkline) display line graph each tick in graph corresponds hour interval of current day. i've formatted tooltip such:
<span style=\"color: {{color}}\">●</span> {{offset:names}} - {{y}}{{suffix}}</span>
where offset:names
corresponds hour of day (0 = 00:00, 1 = 01:00) etc.
the graph updates live data. problem if point in future, don't want display {{y}} value in tooltip - time of day. possible this? if not there way same effect?
found it! using tooltipformatter, did this:
sparkopts.currenttimegroup = currenttimegroup; sparkopts.tooltipformatter = function(sparklines, options, point) { if(point.x <= options.mergedoptions.currenttimegroup) return "<div class=\"jqsfield\"><span style=\"color: " + point.color + "\">●</span>" + options.get("tooltipvaluelookups").names[point.x] + " - " + point.y + options.get("tooltipsuffix") + "</div>"; else return "<div class=\"jqsfield\"><span style=\"color: " + point.color + "\">●</span>" + options.get("tooltipvaluelookups").names[point.x] + "</div>"; };
Comments
Post a Comment