diff --git a/panoramix/forms.py b/panoramix/forms.py index aff476699b..814fc0e972 100644 --- a/panoramix/forms.py +++ b/panoramix/forms.py @@ -116,6 +116,14 @@ class FormFactory(object): 'black_white']), default='fire', description=""), + 'normalize_across': SelectField( + 'Normalize Across', choices=self.choicify([ + 'heatmap', 'x', 'y']), + default='heatmap', + description=( + "Color will be rendered based on a ratio " + "of the cell against the sum of across this " + "criteria")), 'canvas_image_rendering': SelectField( 'Rendering', choices=( ('pixelated', 'pixelated (Sharp)'), diff --git a/panoramix/static/panoramix.js b/panoramix/static/panoramix.js index be0f71da6a..019ceacf39 100644 --- a/panoramix/static/panoramix.js +++ b/panoramix/static/panoramix.js @@ -25,7 +25,11 @@ var color = function(){ // Returns a linear scaler our of an array of color if(!Array.isArray(colors)) colors = spectrums[colors]; - var ext = d3.extent(data, accessor); + if(data !== undefined) + var ext = d3.extent(data, accessor); + else + var ext = [0,1]; + var points = []; var chunkSize = (ext[1] - ext[0]) / colors.length; $.each(colors, function(i, c){ diff --git a/panoramix/static/widgets/viz_heatmap.js b/panoramix/static/widgets/viz_heatmap.js index 7c81477652..8a04ab0581 100644 --- a/panoramix/static/widgets/viz_heatmap.js +++ b/panoramix/static/widgets/viz_heatmap.js @@ -7,6 +7,7 @@ px.registerViz('heatmap', function(slice) { var height = slice.height(); var hmWidth = width - (margins.l + margins.r) var hmHeight = height - (margins.b + margins.t) + var fp = d3.format('.3p'); d3.json(slice.jsonEndpoint(), function(error, payload) { var matrix = {}; if (error){ @@ -39,9 +40,7 @@ px.registerViz('heatmap', function(slice) { var X = 0, Y = 1; var heatmapDim = [xRbScale.domain().length, yRbScale.domain().length]; - var color = px.color.colorScalerFactory( - fd.linear_color_scheme, data, function(d){return d.v}); - + var color = px.color.colorScalerFactory(fd.linear_color_scheme); var scale = [ d3.scale.linear() @@ -99,6 +98,7 @@ px.registerViz('heatmap', function(slice) { s += "