@evergis/charts 3.0.24 → 3.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import styled, { css, createGlobalStyle } from 'styled-components';
2
2
  import React, { useState, useCallback, useMemo, useEffect, useRef, Fragment } from 'react';
3
3
  import { select, pointer, min, max, scaleLinear, lineRadial, curveLinearClosed, range as range$1, format, arc, pie, create, quantize, interpolate, interpolateRound, quantile, axisBottom, group, utcFormat, scaleSequential, interpolateGreens, utcYear, utcMonths, utcMonth, utcSunday, utcMonday, axisLeft, axisRight, line, curveLinear, area, scaleBand, sum, scaleLog } from 'd3';
4
4
  import ReactDOMServer from 'react-dom/server';
5
+ import { uniqueId } from 'lodash-es';
5
6
  import { unmountComponentAtNode, render } from 'react-dom';
6
7
 
7
8
  function _extends() {
@@ -2660,15 +2661,16 @@ const resizeBarWidth = _ref => {
2660
2661
  return barWidth;
2661
2662
  };
2662
2663
 
2664
+ const MIN_BAR_HEIGHT = 2;
2663
2665
  const getBars = _ref => {
2664
2666
  let {
2665
2667
  groups,
2666
2668
  barWidth
2667
2669
  } = _ref;
2668
- return groups.selectAll('rect').data(item => item).join('rect').attr('x', item => item.x).attr('y', item => item.y).attr('width', barWidth).attr('height', item => item.height).style('fill', item => item.color);
2670
+ return groups.selectAll('rect').data(item => item).join('rect').attr('x', item => item.x).attr('y', item => item.y).attr('width', barWidth).attr('height', item => item.value === null ? 0 : Math.max(item.height, MIN_BAR_HEIGHT)).style('fill', item => item.color);
2669
2671
  };
2670
2672
 
2671
- const MIN_BAR_HEIGHT = 2;
2673
+ const MIN_BAR_HEIGHT$1 = 2;
2672
2674
  const draw$4 = (node, props) => {
2673
2675
  const {
2674
2676
  data,
@@ -2815,8 +2817,9 @@ const draw$4 = (node, props) => {
2815
2817
  drawGridX
2816
2818
  });
2817
2819
  xAxis.attr('transform', "translate(0, " + (yScale(yTicks[0]) + (xAxisPadding || 0)) + ")");
2818
- svg.append('defs').append('mask').attr('id', 'height-limit-mask').append('rect').attr('width', '100%').attr('height', height - marginBottom + MIN_BAR_HEIGHT).attr('fill', 'white');
2819
- const gSvg = svg.append('g').attr('class', barChartClassNames.barChartBarGlobal).attr('mask', 'url(#height-limit-mask)');
2820
+ const maskId = "height-limit-mask-" + uniqueId();
2821
+ svg.append('defs').append('mask').attr('id', maskId).append('rect').attr('width', '100%').attr('height', height - marginBottom + MIN_BAR_HEIGHT$1).attr('fill', 'white');
2822
+ const gSvg = svg.append('g').attr('class', barChartClassNames.barChartBarGlobal).attr('mask', "url(#" + maskId + ")");
2820
2823
  const groups = gSvg.selectAll('g').data(marshalledData).enter().append('g').attr('transform', (_, i) => "translate(" + Math.round(xScale(i)) + "," + -(marginTop || 0) + ")");
2821
2824
  const bars = drawBars ? drawBars({
2822
2825
  groups,