javascript - Highcharts Uncaught TypeError: Cannot read property 'chart' of undefined -


i upgrading highcharts 3.0.7 4.2.5. several charts worked fine in 3.0.7 , throwing error on reflow. seems reflow event providing wrong context. context of window, chart undefined. there way fix context?

here chart code environment:

var chartsize = {         small: {             margintop: 44,             marginleft: 26,             marginright: 26,             height: 226,             width: 290,             yaxis: {                 height: 116             },             xaxis: {                 plotlines: {                     x: -30,                     y: -26                 },                 offset: 32,                 labels: {                     y: 20,                     fontsize: '11px'                 },                 y: 15             }         },         large: {             margintop: 75,             marginleft: 28,             marginright: 28,             height: 375,             yaxis: {                 height: 216             },             xaxis: {                 plotlines: {                     x: -83,                     y: -60                                     },                 offset: 40,                 labels: {                     y: 25,                     fontsize: '12px'                 },                 y: 20             }         }     } 

...

{                 chart: {                     backgroundcolor: 'transparent',                     type: 'area',                     margintop: chartsize[args.size].margintop,                     marginleft: chartsize[args.size].marginleft,                     marginright: chartsize[args.size].marginright,                     height: chartsize[args.size].height,                     width: chartsize[args.size].width,                     reflow: true,                   events: {                     load: function() {                         that.onchartloaded(this);                     },                     redraw: function() {                         that.onchartloaded(this);                     }                 }             },              credits: {                 enabled: false             },              exporting: {                 enabled: false             },              plotoptions: {                 area: {                     marker: {                         enabled: false,                         states: {                             hover: {                                  enabled: false                             }                         },                         symbol: 'circle'                     },                     linewidth: 0                 },                  series: {                     fillopacity: 1                 }             },              title: {                 text: '',                 margin: 0             },              tooltip: {                 formatter: function() {                     return that.gettitle(this.y) + "<br/>" + timeutil.formattime(that.getsecondsoffset(this.x), that.timeformat24hour);                 },                 shared: true,                 usehtml: true             },              xaxis: [{                 type: 'datetime',                 tickinterval: 3600 * 1000,                 title: {                     text: null                 },                 startontick: false,                 maxpadding: 0,                 min: min,                 max: max,                 labels: {                     y: chartsize[args.size].xaxis.labels.y,                     autorotation: false,                     staggerlines: 1,                     style: {                         color: '#000000',                         fontsize: chartsize[args.size].xaxis.labels.fontsize                     },                     formatter: function() {                         if (this.isfirst) {                             return '<span class="first-time-label" ' + that.firstlabelstyle + '>' + timeutil.formattime(that.getsecondsoffset(min), that.timeformat24hour) + '</span>';                         } else if (this.islast) {                             var style = that.timeformat24hour ? 'style="margin-left: 6px"' : '';                             return '<span class="last-time-label" style="margin-left: -5px" ' + that.lastlabelstyle + '>' + timeutil.formattime(that.getsecondsoffset(max), that.timeformat24hour) + '</span>';                         }                         return '<a href="javascript:void(0)" style="color:#898989; font-size: 12px" title="'                                 + timeutil.formattime(that.getsecondsoffset(this.value), that.timeformat24hour) + '">&#9679;</a>';                     },                     usehtml: true                 },                 tickwidth: 0,                 plotlines: [{                     color: '#282828',                     dashstyle: 'shortdash',                     value: sleeptime.gettime(),                     width: 2,                     label: {                         text: '<div class="sleep-time-placeholder bed-time"></div>',                         usehtml: true,                         rotation: 0,                         textalign: 'left',                         x: chartsize[args.size].xaxis.plotlines.x,                         y: chartsize[args.size].xaxis.plotlines.y,                         style: {                             fontfamily: "'open sans', 'helvetica neue', helvetica, arial, sans-serif"                         }                     },                     zindex: 5,                     padding: 0.5                 },                 {                     color: '#282828',                     dashstyle: 'shortdash',                     value: waketime.gettime(),                     width: 2,                     label: {                         text: '<div class="awake-time-placeholder wake-time"></div>',                         usehtml: true,                         rotation: 0,                         textalign: 'left',                         x: chartsize[args.size].xaxis.plotlines.x,                         y: chartsize[args.size].xaxis.plotlines.y,                         style: {                             fontfamily: "'open sans', 'helvetica neue', helvetica, arial, sans-serif"                         }                     },                     zindex: 5                 }]             },             {                 type: 'datetime',                 title: {                     text: null                 },                 linecolor: '#c5c5c5',                 linkedto: 0,                 offset: chartsize[args.size].xaxis.offset,                 startontick: true,                 min: min,                 labels: {                     autorotation: false,                     align: 'left',                     staggerlines: 1,                     usehtml: true,                     style: {                         color: '#000000',                         fontsize: chartsize[args.size].xaxis.labels.fontsize                     },                     formatter: function() {                         if(this.islast) {                             return '';                         }                         var date = dateparser.parseepoch(this.value);                         var datestr = dateformatter.formatmonthday(date);                          return '<span class="timeline_label">' + datestr.touppercase() + '</span>';                     },                     y: chartsize[args.size].xaxis.y                 },                 tickwidth: 1,                 tickposition: 'inside',                 tickpositions: [ min, midnighttime.gettime(), max ]             }],             yaxis: [ {                 gridlinecolor: '#e6e6e6',                 labels: {                     enabled: false                 },                 title: {                     text: ''                 },                 linewidth: 0,                 max: 3,                 tickinterval: 1             } ],              legend: {                 enabled: false             }         }     } 


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -