javascript - How to trigger a modal view with Highcharts, when zoom is also enabled? -


I have a webpage that shows a high chart, with zoom type 'x' enabled. The chart div is wrapped in a container device such as:

  & lt; Div class = 'chart-container' & gt; & Lt; Div id = 'chart_0' square = 'chart' & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

There is also an event handler attached to the "mouseoverpe" event on the chart-container, which toggle the Modalchart CSS class to switch to a model view:

  .modalChart {status: fixed; Width: 100%; Height: 100%; Top: 0; Left: 0; Background: RGBA (0, 0, 0, 0.7); Z-index: 99 99 99; }. Chart {height: 300px; } .Modelchart. Chart {height: 90%; Width: 90%; Max-width: None; Margin: 1 AM Auto; }  

The event handler is defined:

  $ ("body"). ("Mouseup", ".chart-container", function () {$ (this) .toggleClass "modalChart" $ (".chart", this). Highchurch (.) Reflow ()});  

The problem I am facing is that the mouseview event on "Chart-Container", which sets fire before extreams event, when zooming. Therefore, each time the user uses the zoom functionality, the model view is toggled. How do I stop this from happening? I want the user to be able to zoom, without toggle the model view, and to be able to click on the chart to toggle the modal view.

The problem is definitely that the "mouseover" incident on "chart-container" fire first And the model view is also toggled when the user is zooming. To stop this, we need to delay the modal toggle and cancel it if necessary. One solution is to delay the modal toggles using the settime (associated with global variable), and then a clear timeout at the appropriate location while using the zoom functionality.

I have changed the event handler on "chart-container" ("mouseup", ".chart-container", function () {chart = this application.modalTimeout = setTimeout (function () P> $ (chart) .toggleClass "modalChart"; $ ("chart", chart). Highchurch (). Reflow ();}, 100)});

And then set the setTimeout to xAxis on the chart for the set Xx, like this:

  xAxis: {events: {setExtremes: function ) {If (application.modalTimeout) {returns clear timeout (vm.Analysis.modalTimeout); }}}}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -