score:3
Accepted answer
If you take a look the source code you'll see that it stores the event on event.browserEvent
.
It's a fixed bug: https://github.com/highslide-software/highcharts.com/pull/992
So, why you have to use event.browserEvent
instead of window.event
?
Simple, because window.event
doesn't exist in Firefox.
legendItemClick: function(e) {
var visibility = this.visible ? 'visible' : 'hidden';
if (!e.browserEvent.ctrlKey) {
if (!confirm('The series is currently '+
visibility +'. Do you want to change that?')) {
return false;
}
}
}
Source code - relevant code:
.on('click', function (event) {
var strLegendItemClick = 'legendItemClick',
fnLegendItemClick = function () {
item.setVisible();
};
// Pass over the click/touch event. #4.
event = {
browserEvent: event // < -- here is the magic
};
// click the name or symbol
if (item.firePointEvent) { // point
item.firePointEvent(strLegendItemClick, event, fnLegendItemClick);
} else {
fireEvent(item, strLegendItemClick, event, fnLegendItemClick);
}
});
score:0
you can use something like this:
var evtobj = window.event ? event : e;
if (evtobj.shiftKey) {
//do something
} else {
//other things
}
This will work in Chrome, IE and firefox.
Source: stackoverflow.com
Related Query
- event.ctrlKey works in IE and Chrome but not Firefox on legendItemClick
- HighCharts not working on Safari but works fine on Firefox and Chrome
- Highcharts Legend issue: I Wanted to make Legend 100% width and text center align it works fine in crome but it is not aligned center in firefox
- Firefox Highcharts is not showing up but it's all OK in Chrome and Edge
- jsPDF - Getting black images on IE, but works fine on Chrome and FireFox
- Highcharts mouse tracking/mouseover feature is slow on chrome but not slow in firefox or IE
- Code works on fiddle but not when I do /show
- Highcharts oncahnge event It works on the first try but not on the second try
- Highchart axis unicode(arabic) titles are inverted in chrome but not in firefox
- Highcharts/Highmaps - Halo effect on point hover not working in chrome and firefox
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- HiChart click event 1st time it's working but when I update the data then click event is not working
- Highchart is not showing in heroku, but works in local environment
- Highcharts data from a variable is not working but from works fine from an array
- Chrome won't display the x-axis labels in Highcharts, Safari and Firefox do it
- Setting additional data to Highchart series via <%= #{} %> works for integers but not Strings
- Highcharts renderer x and y different on Firefox vs Chrome
- Simple Highchart works as seperate .js file, but not in view
- I had follow someone code samples and try apply to my HighChart program but I can't get it work at all
- highcharts from event LegendItemClick to event textItemClick and iconItemClick
- JQuery-UI Slider Auto Increments But Does Not Fire Slide Event
- Highchart Combination Chart Area Range not displaying on chart but line chart works
- Decimals on yAxis are not being displayed, even if that same code works on highcharts jsfiddle
- highchart select an area to show some info by clicking and drag mouse but not release
- Javascript event conflict, but not sure how to identify the first event assignment
- Highchart JS Set data not updating Export: ShowTable on Dropdown Event but chart updates fine
- highchart custom menu with when i drilldown and drillup custom event (contextmenu) not working
- Calling Highcharts export to jpeg but the source is https and exporting is http (security warnings issued by browser)
- highstock 2.0.4 not working on IE and Firefox
- Highcharts: Set y Axis Max and Min dynamically, and not at creation
More Query from same tag
- chart.renderTo doesn't work
- Inefficient functions - how to assign colour to datapoints in Highchart
- Highcharts get selected column index
- jQuery slider range with HighCharts y-Axis
- Highcharts Highmaps How to import data from google spreadsheet
- Including server tags within javascript
- Highchart x-axis show label after specific days no matter what is in the x-axis categories
- Issue to add dynamic value in Highcharts jquery
- Adding multiple dynamic lines to highcharts
- Using HighCharts with Lambda Expression
- Highcharts Display values from sql via json
- Bind Highchart to variable, all within a div?
- How to properly import HighCharts with Backbone-boilerplate in an ECMAScript 2015 way?
- How to set highchart boxplot size
- Is it possible to reparent the high charts legend?
- Xaxis Highcharts data loading issue
- Pass data to click event callback in Highstock chart with more then 1000 entries
- Remove label from chart when exporting
- Highstock title setting via options
- highcharts pie dynamic label inside and outside for each slice
- Set the values of heatmap in highCharts in javascript function
- Highcharts: Show navigator range in subtitle
- DateTime xAxis Label Not Displaying Correct
- Showing tooltip on right side of the column in a vertical bar chart
- Highstock rangeSelector from days in the future
- change navigator date format in highstock
- How to reflow HighCharts when using highcharts-vue?
- Is there a way to show overlapping points of the same serie in highchart?
- HighCharts Pie Chart - Displaying multiple series values in Tooltip
- Highcharts: collecting all charts on a page second time produces error