@santi020k/lumen-astro 3.0.0 → 3.0.1

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.
@@ -5,6 +5,7 @@ import {
5
5
  alignLumenChartSeries,
6
6
  createLumenLineGeometry,
7
7
  formatLumenChartSummary,
8
+ getLumenChartAxisPadding,
8
9
  getLumenChartCategories,
9
10
  getLumenChartDomain,
10
11
  getLumenChartTicks,
@@ -75,15 +76,18 @@ const domain = getLumenChartDomain([
75
76
  referenceValue ?? null
76
77
  ], false)
77
78
 
79
+ const ticks = getLumenChartTicks(domain)
80
+ const paddingLeft = getLumenChartAxisPadding(ticks.map(tick => formatValue(tick)))
81
+
78
82
  const geometries = alignedSeries.map(item => createLumenLineGeometry(item.data, {
79
83
  domain,
80
84
  height,
81
85
  includeZero: false,
82
86
  padding,
87
+ paddingLeft,
83
88
  width
84
89
  }))
85
90
 
86
- const ticks = getLumenChartTicks(domain)
87
91
  const labelStep = Math.max(1, Math.ceil(categories.length / 8))
88
92
  let markerStep = 1
89
93
 
@@ -139,8 +143,8 @@ const referenceY =
139
143
 
140
144
  return (
141
145
  <>
142
- <line x1={padding} x2={width - padding} y1={y} y2={y} />
143
- <text x={padding - 8} y={y}>
146
+ <line x1={paddingLeft} x2={width - padding} y1={y} y2={y} />
147
+ <text x={paddingLeft - 8} y={y}>
144
148
  {formatValue(tick)}
145
149
  </text>
146
150
  </>
@@ -160,7 +164,7 @@ const referenceY =
160
164
  const denominator = Math.max(1, categories.length - 1)
161
165
 
162
166
  const x =
163
- padding + (index / denominator) * (width - padding * 2)
167
+ paddingLeft + (index / denominator) * (width - paddingLeft - padding)
164
168
 
165
169
  return (
166
170
  <text text-anchor="middle" x={x} y={height - 14}>
@@ -174,7 +178,7 @@ const referenceY =
174
178
  referenceY !== undefined && (
175
179
  <line
176
180
  class="ui-chart__reference"
177
- x1={padding}
181
+ x1={paddingLeft}
178
182
  x2={width - padding}
179
183
  y1={referenceY}
180
184
  y2={referenceY}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@santi020k/lumen-astro",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,8 +42,8 @@
42
42
  "lumen": "./bin/lumen.mjs"
43
43
  },
44
44
  "dependencies": {
45
- "@santi020k/lumen": "^3.0.0",
46
- "@santi020k/lumen-core": "^3.0.0",
45
+ "@santi020k/lumen": "^3.0.1",
46
+ "@santi020k/lumen-core": "^3.0.1",
47
47
  "uqr": "^0.1.3"
48
48
  },
49
49
  "devDependencies": {