0

Consider the HighCharts object here which has been given as a solution of a previous question and whose plotOptions details are:

    plotOptions: {
        scatter: {
            lineWidth:1,
            marker: {
                radius: 1,
                symbol:'circle',
                fillColor: '#800000',
                states: {
                    hover: {
                        enabled: true,
                        radius:0,
                        radiusPlus:2,
                        lineColor: '#ff0000',
                        fillColor: '#ff0000'
                    }
                }
            },
            events: {
                mouseOver: function () {

                    this.chart.series[this.index].update({
                        color: 'red'
                    });
                },
                mouseOut: function () {

                    this.chart.series[this.index].update({
                        color: "#b0b0b0"
                    });                           
                }
            }
        }
    },

When I copy and paste the code in an html file (but even in jfiddle) and run it in Firefox with FireBug active, hovering over and out the series gives the error: TypeError: f.onMouseOut is not a function in the console. How can I eliminate such an error?

Community
  • 1
  • 1
tic
  • 4,009
  • 15
  • 45
  • 86
  • Maybe you could set up an example like [this](http://jsfiddle.net/fxshk196/) that show the entire chart ? – adeneo Jan 03 '16 at 22:33
  • I commented on the answer of the previous question. I'm not sure it is related, but I'm experiencing a flickering from the `mouseOver`/`mouseOut` code, that seems to be some kind of looping. – Halvor Holsten Strand Jan 03 '16 at 22:37
  • Have you any other solution? Thank you. – tic Jan 03 '16 at 22:43
  • 2
    As mentioned, I think there's some looping in the form of repeated/overlapping calls to update the series or `mouseOver`/`mouseOut`. See [this example](http://jsfiddle.net/1wfotmoa/5/) where I've wrapped the `mouseOut` code in a meaningless timeout, but the error does not occur. I *think* it also got rid of the flickering. I wouldn't call it a solution though. More of a workaround. – Halvor Holsten Strand Jan 03 '16 at 22:44
  • 1
    The problem is that you try to call mouseout, before series.update (from mouseover) is finished. The solution is using timeout like @HalvorStrand mentioned. – Sebastian Bochan Jan 04 '16 at 12:37
  • It works. You are great! – tic Jan 04 '16 at 21:52
  • After some experiments I have returned to the initial state yielding the console errors. The timeout solution causes a lot of "flashing" in my chart. I also have tried another solution (flag=true; in mouseOver function, if (flag) then {flag=false; ... } in mouseOut function. It seems to me that number of errors lowers even if they don't disappear. – tic Jan 04 '16 at 23:10

0 Answers0