@globalbrain/sefirot 4.16.0 → 4.17.0
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.
|
@@ -20,6 +20,8 @@ const props = withDefaults(defineProps<{
|
|
|
20
20
|
yLabel?: string
|
|
21
21
|
xLabelOffset?: number
|
|
22
22
|
yLabelOffset?: number
|
|
23
|
+
xLabelTickGap?: number
|
|
24
|
+
yLabelTickGap?: number
|
|
23
25
|
xLabelFontSize?: string
|
|
24
26
|
yLabelFontSize?: string
|
|
25
27
|
ticks?: number
|
|
@@ -39,6 +41,8 @@ const props = withDefaults(defineProps<{
|
|
|
39
41
|
|
|
40
42
|
xLabelFontSize: '14px',
|
|
41
43
|
yLabelFontSize: '14px',
|
|
44
|
+
xLabelTickGap: 20,
|
|
45
|
+
yLabelTickGap: 20,
|
|
42
46
|
ticks: 5,
|
|
43
47
|
tickFontSize: '14px',
|
|
44
48
|
|
|
@@ -85,11 +89,11 @@ function renderChart({
|
|
|
85
89
|
const maxVerticalTickWidthInCh = vertical ? maxValueLength : maxKeyLength
|
|
86
90
|
const maxVerticalTickWidthInPx = getTextSize('0'.repeat(maxVerticalTickWidthInCh), `400 ${props.tickFontSize} ${font}`).width
|
|
87
91
|
const verticalLabelWidthInPx = props.yLabel ? getTextSize(props.yLabel, `400 ${props.yLabelFontSize} ${font}`).height : 0
|
|
88
|
-
const gapBetweenVerticalLabelAndTicks = props.yLabel ?
|
|
92
|
+
const gapBetweenVerticalLabelAndTicks = props.yLabel ? props.yLabelTickGap : 0
|
|
89
93
|
|
|
90
94
|
const maxHorizontalTickHeightInPx = getTextSize('0', `400 ${props.tickFontSize} ${font}`).height // wrapping isn't supported
|
|
91
95
|
const horizontalLabelHeightInPx = props.xLabel ? getTextSize(props.xLabel, `400 ${props.xLabelFontSize} ${font}`).height : 0
|
|
92
|
-
const gapBetweenHorizontalLabelAndTicks = props.xLabel ?
|
|
96
|
+
const gapBetweenHorizontalLabelAndTicks = props.xLabel ? props.xLabelTickGap : 0
|
|
93
97
|
|
|
94
98
|
const xLabelOffset = props.xLabelOffset ?? horizontalLabelHeightInPx + 9 + maxHorizontalTickHeightInPx + gapBetweenHorizontalLabelAndTicks
|
|
95
99
|
const yLabelOffset = props.yLabelOffset ?? 9 + maxVerticalTickWidthInPx + gapBetweenVerticalLabelAndTicks
|
|
@@ -97,8 +101,8 @@ function renderChart({
|
|
|
97
101
|
const margin = {
|
|
98
102
|
top: props.margins?.top ?? 30,
|
|
99
103
|
right: props.margins?.right ?? 30,
|
|
100
|
-
bottom: props.margins?.bottom ??
|
|
101
|
-
left: props.margins?.left ??
|
|
104
|
+
bottom: (props.margins?.bottom ?? 30) + horizontalLabelHeightInPx + xLabelOffset - (props.xLabel ? 9 : 0),
|
|
105
|
+
left: (props.margins?.left ?? 30) + verticalLabelWidthInPx + yLabelOffset
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
const width = clientWidth - margin.left - margin.right
|
package/package.json
CHANGED