hrbrmstr / metricsgraphics

:chart_with_upwards_trend: htmlwidget interface to the MetricsGraphics.js D3 chart library
http://hrbrmstr.github.io/metricsgraphics/
Other
132 stars 35 forks source link

Can anyone show me how to customize tooltip content in a metricsgrahpics graph within shiny? #37

Closed Liuy12 closed 9 years ago

Liuy12 commented 9 years ago

metricsgrahpics have an option to control the tooltip:

MG.data_graphic({
    ...
    mouseover: function(d, i) {
        //custom format the rollover text, show days
        var prefix = d3.formatPrefix(d.value);
        $('div#custom-rollover svg .mg-active-datapoint')
            .html('Day ' + (i+1) + '   '
                + prefix.scale(d.value).toFixed(2) + prefix.symbol);
    }
})

The link is here

hrbrmstr commented 9 years ago

did you see the mjs_add_mouseover function? it has examples in the help.

Liuy12 commented 9 years ago

@hrbrmstr Thanks very much for your response! Sorry that I didn't look at the help page closely.