Skip to content

Commit

Permalink
fixes for requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyugit committed Oct 10, 2017
1 parent 6308a6f commit d389884
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions superset/assets/javascripts/explore/stores/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/explore/stores/visTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
9 changes: 4 additions & 5 deletions superset/assets/visualizations/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,22 @@ 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()
.append('g')
.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) {
Expand Down

0 comments on commit d389884

Please sign in to comment.