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) {
83
83
this . hoverinfo = fullTrace . hoverinfo ;
84
84
85
85
// 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 ,
90
88
colLen = z . length ;
89
+
90
+ this . contourOptions . z = this . heatmapOptions . z = flattenZ ( z ) ;
91
91
this . contourOptions . shape = this . heatmapOptions . shape = [ rowLen , colLen ] ;
92
92
93
93
this . contourOptions . x = this . heatmapOptions . x = calcPt . x ;
@@ -109,6 +109,22 @@ proto.dispose = function() {
109
109
this . heatmap . dispose ( ) ;
110
110
} ;
111
111
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
+
112
128
function convertColorscale ( fullTrace ) {
113
129
var contours = fullTrace . contours ,
114
130
start = contours . start ,
You can’t perform that action at this time.
0 commit comments