@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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Kirill Protasov
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Kirill Protasov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # @evergis/charts
2
-
3
- ## Важно
4
-
5
- - Стилизовать графики необходимо импортируя названия классов из библиотеки.
6
-
7
- `import { calendarChartClassNames } from "@evergis/charts"`
8
-
9
- ## Документация зависимостей
10
-
11
- - [d3](https://github.com/d3/d3/blob/master/API.md)
12
-
13
- - [styled-components](https://styled-components.com/docs)
14
-
15
- - [storybook](https://storybook.js.org/docs/react/writing-docs/docs-page)
1
+ # @evergis/charts
2
+
3
+ ## Важно
4
+
5
+ - Стилизовать графики необходимо импортируя названия классов из библиотеки.
6
+
7
+ `import { calendarChartClassNames } from "@evergis/charts"`
8
+
9
+ ## Документация зависимостей
10
+
11
+ - [d3](https://github.com/d3/d3/blob/master/API.md)
12
+
13
+ - [styled-components](https://styled-components.com/docs)
14
+
15
+ - [storybook](https://storybook.js.org/docs/react/writing-docs/docs-page)
@@ -10,6 +10,7 @@ var React = require('react');
10
10
  var React__default = _interopDefault(React);
11
11
  var d3 = require('d3');
12
12
  var ReactDOMServer = _interopDefault(require('react-dom/server'));
13
+ var lodash = require('lodash');
13
14
  var reactDom = require('react-dom');
14
15
 
15
16
  function _extends() {
@@ -2668,15 +2669,16 @@ const resizeBarWidth = _ref => {
2668
2669
  return barWidth;
2669
2670
  };
2670
2671
 
2672
+ const MIN_BAR_HEIGHT = 2;
2671
2673
  const getBars = _ref => {
2672
2674
  let {
2673
2675
  groups,
2674
2676
  barWidth
2675
2677
  } = _ref;
2676
- 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);
2678
+ 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);
2677
2679
  };
2678
2680
 
2679
- const MIN_BAR_HEIGHT = 2;
2681
+ const MIN_BAR_HEIGHT$1 = 2;
2680
2682
  const draw$4 = (node, props) => {
2681
2683
  const {
2682
2684
  data,
@@ -2823,8 +2825,9 @@ const draw$4 = (node, props) => {
2823
2825
  drawGridX
2824
2826
  });
2825
2827
  xAxis.attr('transform', "translate(0, " + (yScale(yTicks[0]) + (xAxisPadding || 0)) + ")");
2826
- 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');
2827
- const gSvg = svg.append('g').attr('class', barChartClassNames.barChartBarGlobal).attr('mask', 'url(#height-limit-mask)');
2828
+ const maskId = "height-limit-mask-" + lodash.uniqueId();
2829
+ svg.append('defs').append('mask').attr('id', maskId).append('rect').attr('width', '100%').attr('height', height - marginBottom + MIN_BAR_HEIGHT$1).attr('fill', 'white');
2830
+ const gSvg = svg.append('g').attr('class', barChartClassNames.barChartBarGlobal).attr('mask', "url(#" + maskId + ")");
2828
2831
  const groups = gSvg.selectAll('g').data(marshalledData).enter().append('g').attr('transform', (_, i) => "translate(" + Math.round(xScale(i)) + "," + -(marginTop || 0) + ")");
2829
2832
  const bars = drawBars ? drawBars({
2830
2833
  groups,