File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,11 @@ proto.update = function(fullTrace, calcTrace) {
8383 this . hoverinfo = fullTrace . hoverinfo ;
8484
8585 // convert z from 2D -> 1D
86- var z = calcPt . z ;
87- this . contourOptions . z = this . heatmapOptions . z = new Float32Array ( [ ] . concat . apply ( [ ] , z ) ) ;
88-
89- var rowLen = z [ 0 ] . length ,
86+ var z = calcPt . z ,
87+ rowLen = z [ 0 ] . length ,
9088 colLen = z . length ;
89+
90+ this . contourOptions . z = this . heatmapOptions . z = flattenZ ( z ) ;
9191 this . contourOptions . shape = this . heatmapOptions . shape = [ rowLen , colLen ] ;
9292
9393 this . contourOptions . x = this . heatmapOptions . x = calcPt . x ;
@@ -109,6 +109,22 @@ proto.dispose = function() {
109109 this . heatmap . dispose ( ) ;
110110} ;
111111
112+ function flattenZ ( zIn ) {
113+ var Nx = zIn . length ,
114+ Ny = zIn [ 0 ] . length ;
115+
116+ var zOut = new Float32Array ( Nx * Ny ) ;
117+ var pt = 0 ;
118+
119+ for ( var i = 0 ; i < Nx ; i ++ ) {
120+ for ( var j = 0 ; j < Ny ; j ++ ) {
121+ zOut [ pt ++ ] = zIn [ j ] [ i ] ;
122+ }
123+ }
124+
125+ return zOut ;
126+ }
127+
112128function convertColorscale ( fullTrace ) {
113129 var contours = fullTrace . contours ,
114130 start = contours . start ,
You can’t perform that action at this time.
0 commit comments