From d389884aa1c70e32bd26a93f2deb25697e894ed1 Mon Sep 17 00:00:00 2001 From: Yu Xiao Date: Tue, 10 Oct 2017 14:42:02 +0900 Subject: [PATCH] fixes for requested changes --- superset/assets/javascripts/explore/stores/controls.jsx | 6 +++--- superset/assets/javascripts/explore/stores/visTypes.js | 2 +- superset/assets/visualizations/heatmap.js | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/superset/assets/javascripts/explore/stores/controls.jsx b/superset/assets/javascripts/explore/stores/controls.jsx index 5f5df43cc6f53..d2851ee7247e4 100644 --- a/superset/assets/javascripts/explore/stores/controls.jsx +++ b/superset/assets/javascripts/explore/stores/controls.jsx @@ -1087,12 +1087,12 @@ export const controls = { description: t('Whether to display the legend (toggles)'), }, - show_annotation: { + show_values: { type: 'CheckboxControl', - label: t('Annotation'), + label: t('Show Values'), renderTrigger: true, default: false, - description: t('Whether to display the annotation (toggles)'), + description: t('Whether to display the numerical values within the cells'), }, x_axis_showminmax: { diff --git a/superset/assets/javascripts/explore/stores/visTypes.js b/superset/assets/javascripts/explore/stores/visTypes.js index 92297edd307dc..2d4c05d62de48 100644 --- a/superset/assets/javascripts/explore/stores/visTypes.js +++ b/superset/assets/javascripts/explore/stores/visTypes.js @@ -975,7 +975,7 @@ export const visTypes = { ['left_margin', 'bottom_margin'], ['y_axis_bounds', 'y_axis_format'], ['show_legend', 'show_perc'], - ['show_annotation'], + ['show_values'], ['sort_x_axis', 'sort_y_axis'], ], }, diff --git a/superset/assets/visualizations/heatmap.js b/superset/assets/visualizations/heatmap.js index ecf96284b75df..d86253d63f83a 100644 --- a/superset/assets/visualizations/heatmap.js +++ b/superset/assets/visualizations/heatmap.js @@ -130,7 +130,7 @@ function heatmapVis(slice, payload) { .attr('height', height) .style('position', 'relative'); - if (fd.show_annotation) { + if (fd.show_values) { const cells = svg.selectAll('rect') .data(data) .enter() @@ -138,15 +138,14 @@ function heatmapVis(slice, payload) { .attr('transform', `translate(${margin.left}, ${margin.top})`); cells.append('text') - .attr('transform', - function (d) { return 'translate(' + xRbScale(d.x) + ',' + yRbScale(d.y) + ')'; }) + .attr('transform', d => `translate(${xRbScale(d.x)}, ${yRbScale(d.y)})`) .attr('y', yRbScale.rangeBand() / 2) .attr('x', xRbScale.rangeBand() / 2) .attr('text-anchor', 'middle') .attr('dy', '.35em') - .text(function (d) { return valueFormatter(d.v); }) + .text(d => valueFormatter(d.v)) .attr('font-size', Math.min(yRbScale.rangeBand(), xRbScale.rangeBand()) / 3 + 'px') - .attr('fill', function (d) { return d.v >= payload.data.extents[1] / 2 ? 'white' : 'black'; }); + .attr('fill', d => d.v >= payload.data.extents[1] / 2 ? 'white' : 'black'); } if (fd.show_legend) {