@@ -59,7 +59,7 @@ var proto = Contour.prototype;
5959
6060proto . handlePick = function ( pickResult ) {
6161 var index = pickResult . pointId ,
62- options = this . contourOptions ,
62+ options = this . heatmapOptions ,
6363 shape = options . shape ;
6464
6565 return {
@@ -87,7 +87,9 @@ proto.update = function(fullTrace, calcTrace) {
8787 rowLen = z [ 0 ] . length ,
8888 colLen = z . length ;
8989
90- this . contourOptions . z = this . heatmapOptions . z = flattenZ ( z ) ;
90+ this . contourOptions . z = flattenZ ( z , rowLen , colLen ) ;
91+ this . heatmapOptions . z = [ ] . concat . apply ( [ ] , z ) ;
92+
9193 this . contourOptions . shape = this . heatmapOptions . shape = [ rowLen , colLen ] ;
9294
9395 this . contourOptions . x = this . heatmapOptions . x = calcPt . x ;
@@ -109,15 +111,12 @@ proto.dispose = function() {
109111 this . heatmap . dispose ( ) ;
110112} ;
111113
112- function flattenZ ( zIn ) {
113- var Nx = zIn . length ,
114- Ny = zIn [ 0 ] . length ;
115-
116- var zOut = new Float32Array ( Nx * Ny ) ;
114+ function flattenZ ( zIn , rowLen , colLen ) {
115+ var zOut = new Float32Array ( rowLen * colLen ) ;
117116 var pt = 0 ;
118117
119- for ( var i = 0 ; i < Nx ; i ++ ) {
120- for ( var j = 0 ; j < Ny ; j ++ ) {
118+ for ( var i = 0 ; i < rowLen ; i ++ ) {
119+ for ( var j = 0 ; j < colLen ; j ++ ) {
121120 zOut [ pt ++ ] = zIn [ j ] [ i ] ;
122121 }
123122 }
0 commit comments