@evergis/charts 2.0.108 → 2.0.109
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 +20 -20
- package/README.md +13 -13
- package/dist/charts/LineChart/styled.d.ts +1 -0
- package/dist/charts/LineChart/types.d.ts +1 -0
- package/dist/charts.cjs.development.js +20 -3
- package/dist/charts.cjs.development.js.map +1 -1
- package/dist/charts.cjs.production.min.js +1 -1
- package/dist/charts.cjs.production.min.js.map +1 -1
- package/dist/charts.esm.js +21 -4
- package/dist/charts.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/charts.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { css, createGlobalStyle } from 'styled-components';
|
|
2
2
|
import React, { useState, useCallback, useMemo, useEffect, useRef, Fragment } from 'react';
|
|
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, line, curveLinear, area, scaleBand, sum, scaleLog } from 'd3';
|
|
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
5
|
import { unmountComponentAtNode, render } from 'react-dom';
|
|
6
6
|
|
|
@@ -1321,6 +1321,7 @@ const stackedData = data => {
|
|
|
1321
1321
|
var _templateObject$8, _templateObject2$2;
|
|
1322
1322
|
const lineChartClassNames = {
|
|
1323
1323
|
lineChartYScaleGlobal: 'lineChartYScaleGlobal',
|
|
1324
|
+
lineChartYScaleRight: 'lineChartYScaleRight',
|
|
1324
1325
|
lineChartXScaleGlobal: 'lineChartXScaleGlobal',
|
|
1325
1326
|
lineChartLinesGlobal: 'lineChartLinesGlobal',
|
|
1326
1327
|
lineChartLine: 'lineChartLine',
|
|
@@ -1654,7 +1655,8 @@ const draw$3 = (node, props) => {
|
|
|
1654
1655
|
tooltipClassName,
|
|
1655
1656
|
xScaleItemWidth,
|
|
1656
1657
|
areaCurve,
|
|
1657
|
-
dotSnapping
|
|
1658
|
+
dotSnapping,
|
|
1659
|
+
rightAxis
|
|
1658
1660
|
} = props;
|
|
1659
1661
|
|
|
1660
1662
|
if (node !== null && chartData.length) {
|
|
@@ -1681,7 +1683,8 @@ const draw$3 = (node, props) => {
|
|
|
1681
1683
|
return max(values);
|
|
1682
1684
|
});
|
|
1683
1685
|
const svg = appendSvg(node, width, height || 0);
|
|
1684
|
-
const
|
|
1686
|
+
const yRange = [height - marginTop - marginBottom - (xAxisPadding || 0), marginTop];
|
|
1687
|
+
const yScale = scaleLinear().domain([min$1 || 0, max$1 || 0]).range(yRange).nice();
|
|
1685
1688
|
customYScale && customYScale(yScale);
|
|
1686
1689
|
const yTicksCountDefault = 8;
|
|
1687
1690
|
const yAxisLeft = axisLeft(yScale).ticks(yTicksCountDefault);
|
|
@@ -1692,15 +1695,29 @@ const draw$3 = (node, props) => {
|
|
|
1692
1695
|
width: yAxisWidth
|
|
1693
1696
|
} = computeDimensions(yAxis);
|
|
1694
1697
|
yAxis.attr('transform', "translate(" + (marginLeft + yAxisWidth) + ", 0)");
|
|
1698
|
+
let yAxisRightWidth = 0;
|
|
1699
|
+
|
|
1700
|
+
if (rightAxis) {
|
|
1701
|
+
const rightAxisMin = min(rightAxis);
|
|
1702
|
+
const rightAxisMax = max(rightAxis);
|
|
1703
|
+
const yRightScale = scaleLinear().domain([rightAxisMin || 0, rightAxisMax || 0]).range(yRange).nice();
|
|
1704
|
+
const yAxisRightTicks = axisRight(yRightScale).ticks(yTicksCountDefault);
|
|
1705
|
+
const yAxisRight = svg.append('g').attr('class', lineChartClassNames.lineChartYScaleGlobal + " " + lineChartClassNames.lineChartYScaleRight).call(yAxisRightTicks).call(customYAxisSelection ? customYAxisSelection : none);
|
|
1706
|
+
({
|
|
1707
|
+
width: yAxisRightWidth
|
|
1708
|
+
} = computeDimensions(yAxisRight));
|
|
1709
|
+
yAxisRight.attr('transform', "translate(" + (width - yAxisRightWidth) + ", 0)");
|
|
1710
|
+
}
|
|
1695
1711
|
/** xScale **/
|
|
1696
1712
|
|
|
1713
|
+
|
|
1697
1714
|
const lastIndex = labels && labels.length ? labels.length - 1 : data.reduce((acc, _ref3) => {
|
|
1698
1715
|
let {
|
|
1699
1716
|
values
|
|
1700
1717
|
} = _ref3;
|
|
1701
1718
|
return Math.max(acc, values.length);
|
|
1702
1719
|
}, 0) - 1;
|
|
1703
|
-
const xScale = scaleLinear().domain([0, lastIndex]).range([marginLeft + yAxisWidth + (yAxisPadding || 0), width - marginRight]);
|
|
1720
|
+
const xScale = scaleLinear().domain([0, lastIndex]).range([marginLeft + yAxisWidth + (yAxisPadding || 0), width - yAxisRightWidth - marginRight]);
|
|
1704
1721
|
const xAxisBottom = axisBottom(xScale).tickFormat(value => // @ts-ignore
|
|
1705
1722
|
labels && labels.length > 0 ? labels[value] : 0).ticks(lastIndex);
|
|
1706
1723
|
|