Highcharts test tool
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>
JavaScript
/**
* Highcharts plugin for adding contextmenu event to points
*/
(function (Highcharts) {
Highcharts.wrap(Highcharts.Chart.prototype, 'firstRender', function (proceed) {
proceed.call(this);
var chart = this,
container = this.container,
plotLeft = this.plotLeft,
plotTop = this.plotTop,
plotWidth = this.plotWidth,
plotHeight = this.plotHeight,
inverted = this.inverted,
tracker = this.tracker;
// Note: Safari 5, IE8: mousedown, contextmenu, click
// Firefox 5: mousedown contextmenu
container.oncontextmenu = function(e) {
var hoverPoint = chart.hoverPoint,
chartPosition = tracker.chartPosition;
this.rightClick = true;
e = tracker.normalizeMouseEvent(e);
e.cancelBubble = true; // IE specific
if (e.stopPropagation) {
e.stopPropagation();
}
if (e.preventDefault) {
e.preventDefault();
}
if (!tracker.hasDragged) {
if (hoverPoint && (e.target.getAttribute('isTracker') || e.target.parentNode.getAttribute('isTracker'))) {
var plotX = hoverPoint.plotX,
plotY = hoverPoint.plotY;
// add page position info
Highcharts.extend(hoverPoint, {
pageX: chartPosition.left + plotLeft +
(inverted ? plotWidth - plotY : plotX),
pageY: chartPosition.top + plotTop +
(inverted ? plotHeight - plotX : plotY)
});
// the series click event
HighchartsAdapter.fireEvent(
hoverPoint.series,...