Skip to content

Commit

Permalink
fix: dist bar will render value multi times (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikedu1988 authored and zhaoyongjie committed Nov 26, 2021
1 parent 971eb03 commit 12bfdb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import d3tip from 'd3-tip';
import dompurify from 'dompurify';
import { getNumberFormatter } from '@superset-ui/number-format';
import { smartDateFormatter } from '@superset-ui/time-format';

// Regexp for the label added to time shifted series
// (1 hour offset, 2 days offset, etc.)
const TIME_SHIFT_PATTERN = /\d+ \w+ offset/;
Expand Down Expand Up @@ -50,7 +49,6 @@ export function getTimeOrNumberFormatter(format) {
export function drawBarValues(svg, data, stacked, axisFormat) {
const format = getNumberFormatter(axisFormat);
const countSeriesDisplayed = data.filter(d => !d.disabled).length;

const totalStackedValues =
stacked && data.length !== 0
? data[0].values.map((bar, iBar) => {
Expand All @@ -59,9 +57,9 @@ export function drawBarValues(svg, data, stacked, axisFormat) {
return d3.sum(bars, d => d.y);
})
: [];

svg.selectAll('.bar-chart-label-group').remove();
setTimeout(() => {
svg.selectAll('.bar-chart-label-group').remove();
const groupLabels = svg
.select('g.nv-barsWrap')
.append('g')
Expand Down
5 changes: 5 additions & 0 deletions superset-frontend/temporary_superset_ui/superset-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18051,6 +18051,11 @@ uuid@^3.0.1, uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

uuid@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea"
integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==

v8-compile-cache@^2.0.3:
version "2.1.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e"
Expand Down

0 comments on commit 12bfdb2

Please sign in to comment.