@evergis/charts 3.1.13 → 3.1.15
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/dist/charts/LineChart/types.d.ts +2 -0
- package/dist/charts.esm.js +62 -47
- package/dist/charts.esm.js.map +1 -1
- package/dist/helpers/drawMarkers.d.ts +10 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/index.js +62 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { Margin } from '../../common/types/margin';
|
|
3
|
+
import { BarChartMarker } from '../BarChart/types';
|
|
3
4
|
import * as d3 from 'd3';
|
|
4
5
|
export type LineChartCustomAxis = (axis: d3.Axis<d3.NumberValue>) => void;
|
|
5
6
|
type LineChartCustomAxisSelection = (selection: d3.Selection<SVGGElement, unknown, null, undefined>) => void;
|
|
@@ -51,6 +52,7 @@ export interface LineChartProps extends PropsWithChildren {
|
|
|
51
52
|
xScaleItemWidth?: number;
|
|
52
53
|
dotSnapping?: boolean;
|
|
53
54
|
rightAxis?: number[];
|
|
55
|
+
markers?: BarChartMarker[];
|
|
54
56
|
}
|
|
55
57
|
export type LineChartDot = {
|
|
56
58
|
radius?: number;
|
package/dist/charts.esm.js
CHANGED
|
@@ -57,6 +57,56 @@ const appendSvg = (node, width, height) => {
|
|
|
57
57
|
return svg;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
const drawMarkers = ({ svg, markers, width, left, top, count, yScale }) => {
|
|
61
|
+
markers?.filter(marker => marker?.value > -1).forEach(marker => {
|
|
62
|
+
const x = left + ((width - left) / count * marker.value + 1);
|
|
63
|
+
if (marker.horizontal) {
|
|
64
|
+
if (marker.line) {
|
|
65
|
+
svg.append('line')
|
|
66
|
+
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
67
|
+
.style("stroke-width", 1)
|
|
68
|
+
.style("stroke-dasharray", ("5, 3"))
|
|
69
|
+
.attr("x1", left)
|
|
70
|
+
.attr("y1", yScale(marker.value) + 1)
|
|
71
|
+
.attr("x2", width)
|
|
72
|
+
.attr("y2", yScale(marker.value) + 1);
|
|
73
|
+
}
|
|
74
|
+
svg.append("text")
|
|
75
|
+
.attr("y", yScale(marker.value) + 1)
|
|
76
|
+
.attr("x", left)
|
|
77
|
+
.attr('text-anchor', 'middle')
|
|
78
|
+
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
79
|
+
.style("fill", marker?.color || "inherit")
|
|
80
|
+
.text(marker.label);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (marker.line) {
|
|
84
|
+
svg.append('line')
|
|
85
|
+
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
86
|
+
.style("stroke-width", 1)
|
|
87
|
+
.style("stroke-dasharray", ("5, 3"))
|
|
88
|
+
.attr("x1", x)
|
|
89
|
+
.attr("y1", 0)
|
|
90
|
+
.attr("x2", x)
|
|
91
|
+
.attr("y2", (top - 12));
|
|
92
|
+
}
|
|
93
|
+
svg.append("text")
|
|
94
|
+
.attr("y", top - 4)
|
|
95
|
+
.attr("x", x)
|
|
96
|
+
.attr("text-anchor", (_, i) => !marker.align && !i ? "left"
|
|
97
|
+
: marker.align === "right"
|
|
98
|
+
? "end"
|
|
99
|
+
: marker.align === "left"
|
|
100
|
+
? "start"
|
|
101
|
+
: "middle")
|
|
102
|
+
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
103
|
+
.style("fill", marker?.color || "inherit")
|
|
104
|
+
.style("font-size", "0.625rem")
|
|
105
|
+
.style("line-height", "0")
|
|
106
|
+
.text(marker.label);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
60
110
|
const SwipeScrollContainer = styled.div `
|
|
61
111
|
width: 100%;
|
|
62
112
|
overflow: hidden;
|
|
@@ -1766,7 +1816,7 @@ const drawTooltip$2 = ({ svg, node, data: argData, xScale, yScale, dynamicCircle
|
|
|
1766
1816
|
};
|
|
1767
1817
|
|
|
1768
1818
|
const draw$2 = (node, props) => {
|
|
1769
|
-
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, } = props;
|
|
1819
|
+
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, markers, } = props;
|
|
1770
1820
|
if (node !== null && chartData.length) {
|
|
1771
1821
|
const data = stacked ? stackedData(chartData) : chartData;
|
|
1772
1822
|
const marginTop = margin ? margin.top : 0;
|
|
@@ -1805,6 +1855,7 @@ const draw$2 = (node, props) => {
|
|
|
1805
1855
|
const { width: yAxisWidth } = computeDimensions(yAxis);
|
|
1806
1856
|
yAxis.attr('transform', `translate(${marginLeft + yAxisWidth}, 0)`);
|
|
1807
1857
|
let yAxisRightWidth = 0;
|
|
1858
|
+
const left = marginLeft + yAxisWidth + (yAxisPadding || 0);
|
|
1808
1859
|
if (rightAxis) {
|
|
1809
1860
|
const rightAxisMin = d3.min(rightAxis);
|
|
1810
1861
|
const rightAxisMax = d3.max(rightAxis);
|
|
@@ -1830,7 +1881,7 @@ const draw$2 = (node, props) => {
|
|
|
1830
1881
|
.scaleLinear()
|
|
1831
1882
|
.domain([0, lastIndex])
|
|
1832
1883
|
.range([
|
|
1833
|
-
|
|
1884
|
+
left,
|
|
1834
1885
|
width - yAxisRightWidth - marginRight,
|
|
1835
1886
|
]);
|
|
1836
1887
|
const xAxisBottom = d3
|
|
@@ -1957,6 +2008,8 @@ const draw$2 = (node, props) => {
|
|
|
1957
2008
|
}
|
|
1958
2009
|
});
|
|
1959
2010
|
}
|
|
2011
|
+
const count = data?.[0]?.values?.length || 0;
|
|
2012
|
+
drawMarkers({ svg, markers, width, left, top: height - marginTop, count, yScale });
|
|
1960
2013
|
d3.select(node)
|
|
1961
2014
|
.select(`.${labelClassName}`)
|
|
1962
2015
|
.remove();
|
|
@@ -2166,8 +2219,9 @@ const TooltipStyles$1 = createGlobalStyle `
|
|
|
2166
2219
|
transition: all linear 144ms;
|
|
2167
2220
|
|
|
2168
2221
|
.${barChartClassNames.barChartTooltipItem} {
|
|
2222
|
+
padding: 0.125rem;
|
|
2169
2223
|
margin-bottom: 4px;
|
|
2170
|
-
|
|
2224
|
+
|
|
2171
2225
|
:last-of-type {
|
|
2172
2226
|
margin-bottom: 0;
|
|
2173
2227
|
}
|
|
@@ -2765,8 +2819,9 @@ const draw$1 = (node, props) => {
|
|
|
2765
2819
|
});
|
|
2766
2820
|
customYAxis && customYAxis(yAxis);
|
|
2767
2821
|
const { width: yAxisWidth } = computeDimensions(yAxis);
|
|
2822
|
+
const left = marginLeft + yAxisWidth + (yAxisPadding || 0);
|
|
2768
2823
|
const range = [
|
|
2769
|
-
|
|
2824
|
+
left,
|
|
2770
2825
|
width - marginRight,
|
|
2771
2826
|
];
|
|
2772
2827
|
const xScale = d3
|
|
@@ -2844,48 +2899,8 @@ const draw$1 = (node, props) => {
|
|
|
2844
2899
|
const bars = drawBars
|
|
2845
2900
|
? drawBars({ groups, yScale, marshalledData, barWidth })
|
|
2846
2901
|
: getBars({ groups, barWidth });
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
return;
|
|
2850
|
-
}
|
|
2851
|
-
if (marker.horizontal) {
|
|
2852
|
-
if (marker.line) {
|
|
2853
|
-
svg.append('line')
|
|
2854
|
-
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
2855
|
-
.style("stroke-width", 1)
|
|
2856
|
-
.style("stroke-dasharray", ("5, 3"))
|
|
2857
|
-
.attr("x1", marginLeft + yAxisWidth)
|
|
2858
|
-
.attr("y1", yScale(marker.value) + 1)
|
|
2859
|
-
.attr("x2", width)
|
|
2860
|
-
.attr("y2", yScale(marker.value) + 1);
|
|
2861
|
-
}
|
|
2862
|
-
svg.append("text")
|
|
2863
|
-
.attr("y", yScale(marker.value) + 1)
|
|
2864
|
-
.attr("x", marginLeft + yAxisWidth)
|
|
2865
|
-
.attr('text-anchor', 'middle')
|
|
2866
|
-
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
2867
|
-
.style("fill", marker?.color || "inherit")
|
|
2868
|
-
.text(marker.label);
|
|
2869
|
-
return;
|
|
2870
|
-
}
|
|
2871
|
-
if (marker.line) {
|
|
2872
|
-
svg.append('line')
|
|
2873
|
-
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
2874
|
-
.style("stroke-width", 1)
|
|
2875
|
-
.style("stroke-dasharray", ("5, 3"))
|
|
2876
|
-
.attr("x1", width / data.length * marker.value + 1)
|
|
2877
|
-
.attr("y1", 0)
|
|
2878
|
-
.attr("x2", width / data.length * marker.value + 1)
|
|
2879
|
-
.attr("y2", (height - marginTop - marginBottom + 8));
|
|
2880
|
-
}
|
|
2881
|
-
svg.append("text")
|
|
2882
|
-
.attr("y", height - 2)
|
|
2883
|
-
.attr("x", width / data.length * marker.value + 1)
|
|
2884
|
-
.attr('text-anchor', marker.align === 'right' ? 'end' : marker.align === 'left' ? 'start' : 'middle')
|
|
2885
|
-
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
2886
|
-
.style("fill", marker?.color || "inherit")
|
|
2887
|
-
.text(marker.label);
|
|
2888
|
-
});
|
|
2902
|
+
const count = data?.length || 0;
|
|
2903
|
+
drawMarkers({ svg, markers, width, left, top: height - marginTop, count, yScale });
|
|
2889
2904
|
let lines = null;
|
|
2890
2905
|
if (Array.isArray(lineData) && lineData.length > 0) {
|
|
2891
2906
|
lines = drawLines({
|
|
@@ -3514,5 +3529,5 @@ const BubbleChart = (props) => {
|
|
|
3514
3529
|
};
|
|
3515
3530
|
BubbleChart.defaultProps = bubbleChartDefaultProps;
|
|
3516
3531
|
|
|
3517
|
-
export { BarChart, BubbleChart, CalendarChart, Wrapper as ChartWrapper, HorizontalBarChart, LineChart, PieChart, RadarChart, SwipeScroll, appendSvg, barChartClassNames, bubbleChartClassNames, calendarChartClassNames, horizontalBarChartClassNames, lineChartClassNames, pieChartclassNames, radarChartclassNames, useNode, useResize };
|
|
3532
|
+
export { BarChart, BubbleChart, CalendarChart, Wrapper as ChartWrapper, HorizontalBarChart, LineChart, PieChart, RadarChart, SwipeScroll, appendSvg, barChartClassNames, bubbleChartClassNames, calendarChartClassNames, drawMarkers, horizontalBarChartClassNames, lineChartClassNames, pieChartclassNames, radarChartclassNames, useNode, useResize };
|
|
3518
3533
|
//# sourceMappingURL=charts.esm.js.map
|
package/dist/charts.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"charts.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BarChartMarker } from '../charts/BarChart/types';
|
|
2
|
+
export declare const drawMarkers: ({ svg, markers, width, left, top, count, yScale }: {
|
|
3
|
+
svg: d3.Selection<SVGGElement, unknown, null, undefined>;
|
|
4
|
+
markers: BarChartMarker[];
|
|
5
|
+
width: number;
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
count: number;
|
|
9
|
+
yScale: (value: number) => number;
|
|
10
|
+
}) => void;
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -78,6 +78,56 @@ const appendSvg = (node, width, height) => {
|
|
|
78
78
|
return svg;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
const drawMarkers = ({ svg, markers, width, left, top, count, yScale }) => {
|
|
82
|
+
markers?.filter(marker => marker?.value > -1).forEach(marker => {
|
|
83
|
+
const x = left + ((width - left) / count * marker.value + 1);
|
|
84
|
+
if (marker.horizontal) {
|
|
85
|
+
if (marker.line) {
|
|
86
|
+
svg.append('line')
|
|
87
|
+
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
88
|
+
.style("stroke-width", 1)
|
|
89
|
+
.style("stroke-dasharray", ("5, 3"))
|
|
90
|
+
.attr("x1", left)
|
|
91
|
+
.attr("y1", yScale(marker.value) + 1)
|
|
92
|
+
.attr("x2", width)
|
|
93
|
+
.attr("y2", yScale(marker.value) + 1);
|
|
94
|
+
}
|
|
95
|
+
svg.append("text")
|
|
96
|
+
.attr("y", yScale(marker.value) + 1)
|
|
97
|
+
.attr("x", left)
|
|
98
|
+
.attr('text-anchor', 'middle')
|
|
99
|
+
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
100
|
+
.style("fill", marker?.color || "inherit")
|
|
101
|
+
.text(marker.label);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (marker.line) {
|
|
105
|
+
svg.append('line')
|
|
106
|
+
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
107
|
+
.style("stroke-width", 1)
|
|
108
|
+
.style("stroke-dasharray", ("5, 3"))
|
|
109
|
+
.attr("x1", x)
|
|
110
|
+
.attr("y1", 0)
|
|
111
|
+
.attr("x2", x)
|
|
112
|
+
.attr("y2", (top - 12));
|
|
113
|
+
}
|
|
114
|
+
svg.append("text")
|
|
115
|
+
.attr("y", top - 4)
|
|
116
|
+
.attr("x", x)
|
|
117
|
+
.attr("text-anchor", (_, i) => !marker.align && !i ? "left"
|
|
118
|
+
: marker.align === "right"
|
|
119
|
+
? "end"
|
|
120
|
+
: marker.align === "left"
|
|
121
|
+
? "start"
|
|
122
|
+
: "middle")
|
|
123
|
+
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
124
|
+
.style("fill", marker?.color || "inherit")
|
|
125
|
+
.style("font-size", "0.625rem")
|
|
126
|
+
.style("line-height", "0")
|
|
127
|
+
.text(marker.label);
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
81
131
|
const SwipeScrollContainer = styled.div `
|
|
82
132
|
width: 100%;
|
|
83
133
|
overflow: hidden;
|
|
@@ -1787,7 +1837,7 @@ const drawTooltip$2 = ({ svg, node, data: argData, xScale, yScale, dynamicCircle
|
|
|
1787
1837
|
};
|
|
1788
1838
|
|
|
1789
1839
|
const draw$2 = (node, props) => {
|
|
1790
|
-
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, } = props;
|
|
1840
|
+
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, markers, } = props;
|
|
1791
1841
|
if (node !== null && chartData.length) {
|
|
1792
1842
|
const data = stacked ? stackedData(chartData) : chartData;
|
|
1793
1843
|
const marginTop = margin ? margin.top : 0;
|
|
@@ -1826,6 +1876,7 @@ const draw$2 = (node, props) => {
|
|
|
1826
1876
|
const { width: yAxisWidth } = computeDimensions(yAxis);
|
|
1827
1877
|
yAxis.attr('transform', `translate(${marginLeft + yAxisWidth}, 0)`);
|
|
1828
1878
|
let yAxisRightWidth = 0;
|
|
1879
|
+
const left = marginLeft + yAxisWidth + (yAxisPadding || 0);
|
|
1829
1880
|
if (rightAxis) {
|
|
1830
1881
|
const rightAxisMin = d3__namespace.min(rightAxis);
|
|
1831
1882
|
const rightAxisMax = d3__namespace.max(rightAxis);
|
|
@@ -1851,7 +1902,7 @@ const draw$2 = (node, props) => {
|
|
|
1851
1902
|
.scaleLinear()
|
|
1852
1903
|
.domain([0, lastIndex])
|
|
1853
1904
|
.range([
|
|
1854
|
-
|
|
1905
|
+
left,
|
|
1855
1906
|
width - yAxisRightWidth - marginRight,
|
|
1856
1907
|
]);
|
|
1857
1908
|
const xAxisBottom = d3__namespace
|
|
@@ -1978,6 +2029,8 @@ const draw$2 = (node, props) => {
|
|
|
1978
2029
|
}
|
|
1979
2030
|
});
|
|
1980
2031
|
}
|
|
2032
|
+
const count = data?.[0]?.values?.length || 0;
|
|
2033
|
+
drawMarkers({ svg, markers, width, left, top: height - marginTop, count, yScale });
|
|
1981
2034
|
d3__namespace.select(node)
|
|
1982
2035
|
.select(`.${labelClassName}`)
|
|
1983
2036
|
.remove();
|
|
@@ -2187,8 +2240,9 @@ const TooltipStyles$1 = styled.createGlobalStyle `
|
|
|
2187
2240
|
transition: all linear 144ms;
|
|
2188
2241
|
|
|
2189
2242
|
.${barChartClassNames.barChartTooltipItem} {
|
|
2243
|
+
padding: 0.125rem;
|
|
2190
2244
|
margin-bottom: 4px;
|
|
2191
|
-
|
|
2245
|
+
|
|
2192
2246
|
:last-of-type {
|
|
2193
2247
|
margin-bottom: 0;
|
|
2194
2248
|
}
|
|
@@ -2786,8 +2840,9 @@ const draw$1 = (node, props) => {
|
|
|
2786
2840
|
});
|
|
2787
2841
|
customYAxis && customYAxis(yAxis);
|
|
2788
2842
|
const { width: yAxisWidth } = computeDimensions(yAxis);
|
|
2843
|
+
const left = marginLeft + yAxisWidth + (yAxisPadding || 0);
|
|
2789
2844
|
const range = [
|
|
2790
|
-
|
|
2845
|
+
left,
|
|
2791
2846
|
width - marginRight,
|
|
2792
2847
|
];
|
|
2793
2848
|
const xScale = d3__namespace
|
|
@@ -2865,48 +2920,8 @@ const draw$1 = (node, props) => {
|
|
|
2865
2920
|
const bars = drawBars
|
|
2866
2921
|
? drawBars({ groups, yScale, marshalledData, barWidth })
|
|
2867
2922
|
: getBars({ groups, barWidth });
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
return;
|
|
2871
|
-
}
|
|
2872
|
-
if (marker.horizontal) {
|
|
2873
|
-
if (marker.line) {
|
|
2874
|
-
svg.append('line')
|
|
2875
|
-
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
2876
|
-
.style("stroke-width", 1)
|
|
2877
|
-
.style("stroke-dasharray", ("5, 3"))
|
|
2878
|
-
.attr("x1", marginLeft + yAxisWidth)
|
|
2879
|
-
.attr("y1", yScale(marker.value) + 1)
|
|
2880
|
-
.attr("x2", width)
|
|
2881
|
-
.attr("y2", yScale(marker.value) + 1);
|
|
2882
|
-
}
|
|
2883
|
-
svg.append("text")
|
|
2884
|
-
.attr("y", yScale(marker.value) + 1)
|
|
2885
|
-
.attr("x", marginLeft + yAxisWidth)
|
|
2886
|
-
.attr('text-anchor', 'middle')
|
|
2887
|
-
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
2888
|
-
.style("fill", marker?.color || "inherit")
|
|
2889
|
-
.text(marker.label);
|
|
2890
|
-
return;
|
|
2891
|
-
}
|
|
2892
|
-
if (marker.line) {
|
|
2893
|
-
svg.append('line')
|
|
2894
|
-
.style("stroke", marker.lineColor || marker.color || "inherit")
|
|
2895
|
-
.style("stroke-width", 1)
|
|
2896
|
-
.style("stroke-dasharray", ("5, 3"))
|
|
2897
|
-
.attr("x1", width / data.length * marker.value + 1)
|
|
2898
|
-
.attr("y1", 0)
|
|
2899
|
-
.attr("x2", width / data.length * marker.value + 1)
|
|
2900
|
-
.attr("y2", (height - marginTop - marginBottom + 8));
|
|
2901
|
-
}
|
|
2902
|
-
svg.append("text")
|
|
2903
|
-
.attr("y", height - 2)
|
|
2904
|
-
.attr("x", width / data.length * marker.value + 1)
|
|
2905
|
-
.attr('text-anchor', marker.align === 'right' ? 'end' : marker.align === 'left' ? 'start' : 'middle')
|
|
2906
|
-
.attr("class", ["marker", marker.className].filter(Boolean).join(" "))
|
|
2907
|
-
.style("fill", marker?.color || "inherit")
|
|
2908
|
-
.text(marker.label);
|
|
2909
|
-
});
|
|
2923
|
+
const count = data?.length || 0;
|
|
2924
|
+
drawMarkers({ svg, markers, width, left, top: height - marginTop, count, yScale });
|
|
2910
2925
|
let lines = null;
|
|
2911
2926
|
if (Array.isArray(lineData) && lineData.length > 0) {
|
|
2912
2927
|
lines = drawLines({
|
|
@@ -3548,6 +3563,7 @@ exports.appendSvg = appendSvg;
|
|
|
3548
3563
|
exports.barChartClassNames = barChartClassNames;
|
|
3549
3564
|
exports.bubbleChartClassNames = bubbleChartClassNames;
|
|
3550
3565
|
exports.calendarChartClassNames = calendarChartClassNames;
|
|
3566
|
+
exports.drawMarkers = drawMarkers;
|
|
3551
3567
|
exports.horizontalBarChartClassNames = horizontalBarChartClassNames;
|
|
3552
3568
|
exports.lineChartClassNames = lineChartClassNames;
|
|
3553
3569
|
exports.pieChartclassNames = pieChartclassNames;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.1.
|
|
2
|
+
"version": "3.1.15",
|
|
3
3
|
"name": "@evergis/charts",
|
|
4
4
|
"author": "Everpoint",
|
|
5
5
|
"license": "MIT",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"react-is": "^19.1.1",
|
|
53
53
|
"styled-components": "5.3.5"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "cef9f8627556aa3008a7ba97d4f05691555b2cf6"
|
|
56
56
|
}
|