@orbcharts/plugins-basic 3.0.0-alpha.33 → 3.0.0-alpha.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/dist/orbcharts-plugins-basic.es.js +10246 -9523
  2. package/dist/orbcharts-plugins-basic.umd.js +10 -10
  3. package/dist/src/base/BaseBarStack.d.ts +5 -1
  4. package/dist/src/base/BaseBars.d.ts +5 -1
  5. package/dist/src/base/BaseBarsTriangle.d.ts +5 -1
  6. package/dist/src/base/BaseDots.d.ts +33 -0
  7. package/dist/src/base/BaseGroupAxis.d.ts +35 -0
  8. package/dist/src/base/BaseLines.d.ts +3 -1
  9. package/dist/src/base/BaseValueAxis.d.ts +36 -0
  10. package/dist/src/grid/defaults.d.ts +3 -3
  11. package/dist/src/grid/gridObservables.d.ts +18 -4
  12. package/dist/src/grid/index.d.ts +1 -1
  13. package/dist/src/grid/plugins/Dots.d.ts +1 -3
  14. package/dist/src/grid/plugins/GroupAux.d.ts +3 -0
  15. package/dist/src/grid/plugins/GroupAxis.d.ts +1 -3
  16. package/dist/src/grid/plugins/ValueAxis.d.ts +1 -3
  17. package/dist/src/grid/plugins/ValueStackAxis.d.ts +1 -3
  18. package/dist/src/grid/types.d.ts +1 -1
  19. package/dist/src/multiGrid/defaults.d.ts +9 -2
  20. package/dist/src/multiGrid/index.d.ts +8 -1
  21. package/dist/src/multiGrid/multiGridObservables.d.ts +12 -0
  22. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +1 -0
  23. package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -0
  24. package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -0
  25. package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -0
  26. package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -0
  27. package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -0
  28. package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -0
  29. package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -0
  30. package/dist/src/multiGrid/types.d.ts +31 -0
  31. package/package.json +2 -2
  32. package/src/base/BaseBarStack.ts +375 -198
  33. package/src/base/BaseBars.ts +297 -191
  34. package/src/base/BaseBarsTriangle.ts +344 -229
  35. package/src/base/BaseDots.ts +634 -0
  36. package/src/base/BaseGroupAxis.ts +497 -0
  37. package/src/base/BaseLines.ts +180 -50
  38. package/src/base/BaseValueAxis.ts +475 -0
  39. package/src/grid/defaults.ts +3 -3
  40. package/src/grid/gridObservables.ts +147 -14
  41. package/src/grid/index.ts +1 -1
  42. package/src/grid/plugins/BarStack.ts +4 -0
  43. package/src/grid/plugins/Bars.ts +4 -0
  44. package/src/grid/plugins/BarsTriangle.ts +4 -0
  45. package/src/grid/plugins/Dots.ts +19 -410
  46. package/src/grid/plugins/{GroupArea.ts → GroupAux.ts} +24 -24
  47. package/src/grid/plugins/GroupAxis.ts +16 -348
  48. package/src/grid/plugins/Lines.ts +2 -0
  49. package/src/grid/plugins/ScalingArea.ts +9 -6
  50. package/src/grid/plugins/ValueAxis.ts +13 -337
  51. package/src/grid/plugins/ValueStackAxis.ts +35 -336
  52. package/src/grid/types.ts +1 -1
  53. package/src/index.ts +1 -0
  54. package/src/multiGrid/defaults.ts +120 -14
  55. package/src/multiGrid/index.ts +9 -2
  56. package/src/multiGrid/multiGridObservables.ts +279 -0
  57. package/src/multiGrid/plugins/MultiBarStack.ts +60 -0
  58. package/src/multiGrid/plugins/MultiBars.ts +59 -0
  59. package/src/multiGrid/plugins/MultiBarsTriangle.ts +58 -0
  60. package/src/multiGrid/plugins/MultiDots.ts +58 -0
  61. package/src/multiGrid/plugins/MultiGridLegend.ts +9 -10
  62. package/src/multiGrid/plugins/MultiGroupAxis.ts +53 -0
  63. package/src/multiGrid/plugins/MultiLines.ts +58 -0
  64. package/src/multiGrid/plugins/MultiValueAxis.ts +53 -0
  65. package/src/multiGrid/plugins/OverlappingValueAxes.ts +165 -0
  66. package/src/multiGrid/types.ts +39 -0
  67. package/tsconfig.dev.json +17 -0
  68. package/tsconfig.prod.json +14 -0
  69. package/vite.config.js +5 -0
  70. package/dist/src/grid/plugins/GroupArea.d.ts +0 -3
  71. package/dist/src/multiGrid/plugins/BarsAndLines.d.ts +0 -1
  72. package/dist/src/multiGrid/plugins/FirstGroupScaleAxis.d.ts +0 -0
  73. package/dist/src/multiGrid/plugins/TwoValueScaleAxes.d.ts +0 -0
  74. package/src/multiGrid/plugins/BarStackAndLines.ts +0 -0
  75. package/src/multiGrid/plugins/BarsAndLines.ts +0 -126
  76. package/src/multiGrid/plugins/BarsTriangleAndLines.ts +0 -0
  77. package/src/multiGrid/plugins/FirstGroupScaleAxis.ts +0 -0
  78. package/src/multiGrid/plugins/TwoValueScaleAxes.ts +0 -0
  79. /package/dist/src/{multiGrid/plugins/BarStackAndLines.d.ts → base/BaseGroupArea.d.ts} +0 -0
  80. /package/{dist/src/multiGrid/plugins/BarsTriangleAndLines.d.ts → src/base/BaseGroupArea.ts} +0 -0
@@ -0,0 +1,475 @@
1
+ import * as d3 from 'd3'
2
+ import {
3
+ combineLatest,
4
+ switchMap,
5
+ distinctUntilChanged,
6
+ first,
7
+ map,
8
+ takeUntil,
9
+ Observable,
10
+ Subject } from 'rxjs'
11
+ import { createAxisLinearScale } from '@orbcharts/core'
12
+ import type { BasePluginFn } from './types'
13
+ import type {
14
+ ComputedDataGrid,
15
+ DataFormatterGrid,
16
+ ChartParams,
17
+ ComputedDatumGrid,
18
+ ContainerPosition,
19
+ TransformData,
20
+ EventGrid,
21
+ ColorType } from '@orbcharts/core'
22
+ import { parseTickFormatValue } from '../utils/d3Utils'
23
+ import { getColor, getMinAndMaxValue, getClassName, getUniID } from '../utils/orbchartsUtils'
24
+
25
+ export interface BaseValueAxisParams {
26
+ labelOffset: [number, number]
27
+ labelColorType: ColorType
28
+ axisLineVisible: boolean
29
+ axisLineColorType: ColorType
30
+ ticks: number
31
+ tickFormat: string | ((text: d3.NumberValue) => string)
32
+ tickLineVisible: boolean
33
+ tickPadding: number
34
+ tickFullLine: boolean
35
+ tickFullLineDasharray: string
36
+ tickColorType: ColorType
37
+ tickTextRotate: number
38
+ tickTextColorType: ColorType
39
+ }
40
+
41
+ interface BaseLinesContext {
42
+ selection: d3.Selection<any, unknown, any, unknown>
43
+ computedData$: Observable<ComputedDataGrid>
44
+ fullParams$: Observable<BaseValueAxisParams>
45
+ fullDataFormatter$: Observable<DataFormatterGrid>
46
+ fullChartParams$: Observable<ChartParams>
47
+ gridAxesTransform$: Observable<TransformData>
48
+ gridAxesReverseTransform$: Observable<TransformData>
49
+ gridAxesSize$: Observable<{
50
+ width: number;
51
+ height: number;
52
+ }>
53
+ gridContainer$: Observable<ContainerPosition[]>
54
+ isSeriesPositionSeprate$: Observable<boolean>
55
+ }
56
+
57
+ interface TextAlign {
58
+ textAnchor: "start" | "middle" | "end"
59
+ dominantBaseline: "middle" | "auto" | "hanging"
60
+ }
61
+
62
+ // const pluginName = 'ValueAxis'
63
+ // const containerClassName = getClassName(pluginName, 'container')
64
+ // const yAxisGClassName = getClassName(pluginName, 'yAxisG')
65
+ // const yAxisClassName = getClassName(pluginName, 'yAxis')
66
+ // const textClassName = getClassName(pluginName, 'text')
67
+ const defaultTickSize = 6
68
+
69
+ function renderLinearAxis ({ selection, yAxisClassName, textClassName, fullParams, tickTextAlign, axisLabelAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, textTransform, minAndMax }: {
70
+ selection: d3.Selection<SVGGElement, any, any, any>,
71
+ yAxisClassName: string
72
+ textClassName: string
73
+ fullParams: BaseValueAxisParams
74
+ tickTextAlign: TextAlign
75
+ axisLabelAlign: TextAlign
76
+ gridAxesSize: { width: number, height: number }
77
+ fullDataFormatter: DataFormatterGrid,
78
+ fullChartParams: ChartParams
79
+ valueScale: d3.ScaleLinear<number, number>
80
+ textTransform: string,
81
+ minAndMax: [number, number]
82
+ }) {
83
+
84
+ const yAxisSelection = selection
85
+ .selectAll<SVGGElement, BaseValueAxisParams>(`g.${yAxisClassName}`)
86
+ .data([fullParams])
87
+ .join('g')
88
+ .classed(yAxisClassName, true)
89
+
90
+ const axisLabelSelection = selection
91
+ .selectAll<SVGGElement, BaseValueAxisParams>(`g.${textClassName}`)
92
+ .data([fullParams])
93
+ .join('g')
94
+ .classed(textClassName, true)
95
+ .each((d, i, g) => {
96
+ const text = d3.select(g[i])
97
+ .selectAll<SVGTextElement, BaseValueAxisParams>(`text`)
98
+ .data([d])
99
+ .join(
100
+ enter => {
101
+ return enter
102
+ .append('text')
103
+ .style('font-weight', 'bold')
104
+ },
105
+ update => update,
106
+ exit => exit.remove()
107
+ )
108
+ .attr('text-anchor', axisLabelAlign.textAnchor)
109
+ .attr('dominant-baseline', axisLabelAlign.dominantBaseline)
110
+ .style('font-size', `${fullChartParams.styles.textSize}px`)
111
+ .style('fill', getColor(fullParams.labelColorType, fullChartParams))
112
+ .style('transform', textTransform)
113
+ .text(d => fullDataFormatter.grid.valueAxis.label)
114
+ })
115
+ .attr('transform', d => `translate(${- d.tickPadding + fullParams.labelOffset[0]}, ${gridAxesSize.height + d.tickPadding + fullParams.labelOffset[1]})`)
116
+
117
+ const valueLength = minAndMax[1] - minAndMax[0]
118
+
119
+ // 設定Y軸刻度
120
+ const yAxis = d3.axisLeft(valueScale)
121
+ .scale(valueScale)
122
+ .ticks(valueLength > fullParams.ticks
123
+ ? fullParams.ticks
124
+ : ((minAndMax[0] === 0 && minAndMax[1] === 0)
125
+ ? 1
126
+ : Math.ceil(valueLength))) // 刻度分段數量
127
+ .tickFormat(d => parseTickFormatValue(d, fullParams.tickFormat))
128
+ .tickSize(fullParams.tickFullLine == true
129
+ ? -gridAxesSize.width
130
+ : defaultTickSize)
131
+ .tickPadding(fullParams.tickPadding)
132
+
133
+ const yAxisEl = yAxisSelection
134
+ .transition()
135
+ .duration(100)
136
+ .call(yAxis)
137
+
138
+ yAxisEl.selectAll('line')
139
+ .style('fill', 'none')
140
+ .style('stroke', fullParams.tickLineVisible == true ? getColor(fullParams.tickColorType, fullChartParams) : 'none')
141
+ .style('stroke-dasharray', fullParams.tickFullLineDasharray)
142
+ .attr('pointer-events', 'none')
143
+
144
+ yAxisEl.selectAll('path')
145
+ .style('fill', 'none')
146
+ // .style('stroke', this.fullParams.axisLineColor!)
147
+ .style('stroke', fullParams.axisLineVisible == true ? getColor(fullParams.axisLineColorType, fullChartParams) : 'none')
148
+ .style('shape-rendering', 'crispEdges')
149
+
150
+ // const yText = yAxisEl.selectAll('text')
151
+ const yText = yAxisSelection.selectAll('text')
152
+ .style('font-family', 'sans-serif')
153
+ .style('font-size', `${fullChartParams.styles.textSize}px`)
154
+ .style('color', getColor(fullParams.tickTextColorType, fullChartParams))
155
+ .attr('text-anchor', tickTextAlign.textAnchor)
156
+ .attr('dominant-baseline', tickTextAlign.dominantBaseline)
157
+ .attr('transform-origin', `-${fullParams.tickPadding + defaultTickSize} 0`)
158
+ yText.style('transform', textTransform)
159
+
160
+ return yAxisSelection
161
+ }
162
+
163
+
164
+
165
+ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName: string, {
166
+ selection,
167
+ computedData$,
168
+ fullParams$,
169
+ fullDataFormatter$,
170
+ fullChartParams$,
171
+ gridAxesTransform$,
172
+ gridAxesReverseTransform$,
173
+ gridAxesSize$,
174
+ gridContainer$,
175
+ isSeriesPositionSeprate$,
176
+ }) => {
177
+
178
+ const destroy$ = new Subject()
179
+
180
+ const containerClassName = getClassName(pluginName, 'container')
181
+ const yAxisGClassName = getClassName(pluginName, 'yAxisG')
182
+ const yAxisClassName = getClassName(pluginName, 'yAxis')
183
+ const textClassName = getClassName(pluginName, 'text')
184
+
185
+ const containerSelection$ = combineLatest({
186
+ computedData: computedData$.pipe(
187
+ distinctUntilChanged((a, b) => {
188
+ // 只有當series的數量改變時,才重新計算
189
+ return a.length === b.length
190
+ }),
191
+ ),
192
+ isSeriesPositionSeprate: isSeriesPositionSeprate$
193
+ }).pipe(
194
+ takeUntil(destroy$),
195
+ switchMap(async (d) => d),
196
+ map(data => {
197
+ return data.isSeriesPositionSeprate
198
+ // series分開的時候顯示各別axis
199
+ ? data.computedData
200
+ // series合併的時候只顯示第一個axis
201
+ : [data.computedData[0]]
202
+ }),
203
+ map((computedData, i) => {
204
+ return selection
205
+ .selectAll<SVGGElement, ComputedDatumGrid[]>(`g.${containerClassName}`)
206
+ .data(computedData, d => d[0] ? d[0].seriesIndex : i)
207
+ .join('g')
208
+ .classed(containerClassName, true)
209
+ })
210
+ )
211
+
212
+ const axisSelection$ = containerSelection$.pipe(
213
+ takeUntil(destroy$),
214
+ map((containerSelection, i) => {
215
+ return containerSelection
216
+ .selectAll<SVGGElement, ComputedDatumGrid[]>(`g.${yAxisGClassName}`)
217
+ .data([yAxisGClassName])
218
+ .join('g')
219
+ .classed(yAxisGClassName, true)
220
+ })
221
+ )
222
+
223
+ combineLatest({
224
+ containerSelection: containerSelection$,
225
+ gridContainer: gridContainer$
226
+ }).pipe(
227
+ takeUntil(destroy$),
228
+ switchMap(async d => d)
229
+ ).subscribe(data => {
230
+ data.containerSelection
231
+ .attr('transform', (d, i) => {
232
+ const gridContainer = data.gridContainer[i] ?? data.gridContainer[0]
233
+ const translate = gridContainer.translate
234
+ const scale = gridContainer.scale
235
+ return `translate(${translate[0]}, ${translate[1]}) scale(${scale[0]}, ${scale[1]})`
236
+ })
237
+ // .attr('opacity', 0)
238
+ // .transition()
239
+ // .attr('opacity', 1)
240
+ })
241
+
242
+ combineLatest({
243
+ axisSelection: axisSelection$,
244
+ gridAxesTransform: gridAxesTransform$,
245
+ }).pipe(
246
+ takeUntil(destroy$),
247
+ switchMap(async d => d)
248
+ ).subscribe(data => {
249
+ data.axisSelection
250
+ .style('transform', data.gridAxesTransform.value)
251
+ // .attr('opacity', 0)
252
+ // .transition()
253
+ // .attr('opacity', 1)
254
+
255
+ })
256
+
257
+ // const gridAxesSize$ = gridAxisSizeObservable({
258
+ // fullDataFormatter$,
259
+ // layout$
260
+ // })
261
+
262
+ // const textTransform$: Observable<string> = new Observable(subscriber => {
263
+ // combineLatest({
264
+ // fullParams: fullParams$,
265
+ // layout: layout$
266
+ // }).pipe(
267
+ // takeUntil(destroy$),
268
+ // // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
269
+ // switchMap(async (d) => d),
270
+ // ).subscribe(data => {
271
+
272
+ // const transformData = Object.assign({}, data.layout.content.axesTransformData)
273
+
274
+ // const value = getAxesTransformValue({
275
+ // translate: [0, 0],
276
+ // scale: [transformData.scale[0] * -1, transformData.scale[1] * -1],
277
+ // rotate: transformData.rotate * -1 + data.fullParams.tickTextRotate,
278
+ // rotateX: transformData.rotateX * -1,
279
+ // rotateY: transformData.rotateY * -1
280
+ // })
281
+
282
+ // subscriber.next(value)
283
+ // })
284
+ // })
285
+ // const reverseTransform$: Observable<TransformData> = gridAxesTransform$.pipe(
286
+ // takeUntil(destroy$),
287
+ // map(d => {
288
+ // const translate: [number, number] = [d.translate[0] * -1, d.translate[1] * -1]
289
+ // const scale: [number, number] = [d.scale[0] * -1, d.scale[1] * -1]
290
+ // const rotate = d.rotate * -1
291
+ // const rotateX = d.rotateX * -1
292
+ // const rotateY = d.rotateY * -1
293
+ // return {
294
+ // translate,
295
+ // scale,
296
+ // rotate,
297
+ // rotateX,
298
+ // rotateY,
299
+ // value: ''
300
+ // }
301
+ // }),
302
+ // )
303
+ const textTransform$ = combineLatest({
304
+ fullParams: fullParams$,
305
+ fullDataFormatter: fullDataFormatter$,
306
+ gridAxesReverseTransform: gridAxesReverseTransform$,
307
+ gridContainer: gridContainer$
308
+ }).pipe(
309
+ takeUntil(destroy$),
310
+ switchMap(async (d) => d),
311
+ map(data => {
312
+ const axisReverseTranslateValue = `translate(${data.gridAxesReverseTransform.translate[0]}px, ${data.gridAxesReverseTransform.translate[1]}px)`
313
+ const axisReverseRotateValue = `rotate(${data.gridAxesReverseTransform.rotate}deg) rotateX(${data.gridAxesReverseTransform.rotateX}deg) rotateY(${data.gridAxesReverseTransform.rotateY}deg)`
314
+ const containerScaleReverseScaleValue = `scale(${1 / data.gridContainer[0].scale[0]}, ${1 / data.gridContainer[0].scale[1]})`
315
+ const tickTextRotateDeg = (data.fullDataFormatter.grid.groupAxis.position === 'left' && data.fullDataFormatter.grid.valueAxis.position === 'top')
316
+ || (data.fullDataFormatter.grid.groupAxis.position === 'right' && data.fullDataFormatter.grid.valueAxis.position === 'bottom')
317
+ ? data.fullParams.tickTextRotate + 180 // 修正文字倒轉
318
+ : data.fullParams.tickTextRotate
319
+
320
+ const textRotateValue = `rotate(${tickTextRotateDeg}deg)`
321
+
322
+ // 必須按照順序(先抵消外層rotate,再抵消最外層scale,最後再做本身的rotate)
323
+ return `${axisReverseTranslateValue} ${axisReverseRotateValue} ${containerScaleReverseScaleValue} ${textRotateValue}`
324
+ }),
325
+ distinctUntilChanged()
326
+ )
327
+
328
+ const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
329
+ combineLatest({
330
+ fullDataFormatter: fullDataFormatter$,
331
+ gridAxesSize: gridAxesSize$,
332
+ computedData: computedData$
333
+ }).pipe(
334
+ takeUntil(destroy$),
335
+ switchMap(async (d) => d),
336
+ ).subscribe(data => {
337
+ const groupMin = 0
338
+ const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
339
+ const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
340
+ ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
341
+ : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
342
+ const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'auto'
343
+ ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
344
+ : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
345
+
346
+ const filteredData = data.computedData.map((d, i) => {
347
+ return d.filter((_d, _i) => {
348
+ return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
349
+ })
350
+ })
351
+
352
+ const filteredMinAndMax = getMinAndMaxValue(filteredData.flat())
353
+
354
+ subscriber.next(filteredMinAndMax)
355
+ })
356
+ })
357
+
358
+ const valueScale$: Observable<d3.ScaleLinear<number, number>> = new Observable(subscriber => {
359
+ combineLatest({
360
+ fullDataFormatter: fullDataFormatter$,
361
+ gridAxesSize: gridAxesSize$,
362
+ minAndMax: minAndMax$
363
+ }).pipe(
364
+ takeUntil(destroy$),
365
+ // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
366
+ switchMap(async (d) => d),
367
+ ).subscribe(data => {
368
+
369
+ const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
370
+ maxValue: data.minAndMax[1],
371
+ minValue: data.minAndMax[0],
372
+ axisWidth: data.gridAxesSize.height,
373
+ scaleDomain: data.fullDataFormatter.grid.valueAxis.scaleDomain,
374
+ scaleRange: data.fullDataFormatter.grid.valueAxis.scaleRange
375
+ })
376
+
377
+ subscriber.next(valueScale)
378
+ })
379
+ })
380
+
381
+ const tickTextAlign$: Observable<TextAlign> = fullDataFormatter$.pipe(
382
+ takeUntil(destroy$),
383
+ map(d => {
384
+ let textAnchor: 'start' | 'middle' | 'end' = 'start'
385
+ let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
386
+
387
+ if (d.grid.valueAxis.position === 'left') {
388
+ textAnchor = 'end'
389
+ dominantBaseline = 'middle'
390
+ } else if (d.grid.valueAxis.position === 'right') {
391
+ textAnchor = 'start'
392
+ dominantBaseline = 'middle'
393
+ } else if (d.grid.valueAxis.position === 'bottom') {
394
+ textAnchor = 'middle'
395
+ dominantBaseline = 'hanging'
396
+ } else if (d.grid.valueAxis.position === 'top') {
397
+ textAnchor = 'middle'
398
+ dominantBaseline = 'auto'
399
+ }
400
+ return {
401
+ textAnchor,
402
+ dominantBaseline
403
+ }
404
+ })
405
+ )
406
+
407
+ const axisLabelAlign$: Observable<TextAlign> = fullDataFormatter$.pipe(
408
+ takeUntil(destroy$),
409
+ map(d => {
410
+ let textAnchor: 'start' | 'middle' | 'end' = 'start'
411
+ let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
412
+
413
+ if (d.grid.groupAxis.position === 'bottom') {
414
+ dominantBaseline = 'auto'
415
+ } else if (d.grid.groupAxis.position === 'top') {
416
+ dominantBaseline = 'hanging'
417
+ } else if (d.grid.groupAxis.position === 'left') {
418
+ textAnchor = 'start'
419
+ } else if (d.grid.groupAxis.position === 'right') {
420
+ textAnchor = 'end'
421
+ }
422
+ if (d.grid.valueAxis.position === 'left') {
423
+ textAnchor = 'end'
424
+ } else if (d.grid.valueAxis.position === 'right') {
425
+ textAnchor = 'start'
426
+ } else if (d.grid.valueAxis.position === 'bottom') {
427
+ dominantBaseline = 'hanging'
428
+ } else if (d.grid.valueAxis.position === 'top') {
429
+ dominantBaseline = 'auto'
430
+ }
431
+ return {
432
+ textAnchor,
433
+ dominantBaseline
434
+ }
435
+ })
436
+ )
437
+
438
+
439
+ combineLatest({
440
+ axisSelection: axisSelection$,
441
+ fullParams: fullParams$,
442
+ tickTextAlign: tickTextAlign$,
443
+ axisLabelAlign: axisLabelAlign$,
444
+ computedData: computedData$,
445
+ gridAxesSize: gridAxesSize$,
446
+ fullDataFormatter: fullDataFormatter$,
447
+ fullChartParams: fullChartParams$,
448
+ valueScale: valueScale$,
449
+ textTransform: textTransform$,
450
+ minAndMax: minAndMax$
451
+ }).pipe(
452
+ takeUntil(destroy$),
453
+ switchMap(async (d) => d),
454
+ ).subscribe(data => {
455
+
456
+ renderLinearAxis({
457
+ selection: data.axisSelection,
458
+ yAxisClassName,
459
+ textClassName,
460
+ fullParams: data.fullParams,
461
+ tickTextAlign: data.tickTextAlign,
462
+ axisLabelAlign: data.axisLabelAlign,
463
+ gridAxesSize: data.gridAxesSize,
464
+ fullDataFormatter: data.fullDataFormatter,
465
+ fullChartParams: data.fullChartParams,
466
+ valueScale: data.valueScale,
467
+ textTransform: data.textTransform,
468
+ minAndMax: data.minAndMax
469
+ })
470
+ })
471
+
472
+ return () => {
473
+ destroy$.next(undefined)
474
+ }
475
+ }
@@ -1,6 +1,6 @@
1
1
  import type {
2
2
  LinesParams,
3
- GroupAreaParams,
3
+ GroupAuxParams,
4
4
  DotsParams,
5
5
  BarsParams,
6
6
  BarStackParams,
@@ -24,7 +24,7 @@ export const DEFAULT_DOTS_PARAMS: DotsParams = {
24
24
  onlyShowHighlighted: false
25
25
  }
26
26
 
27
- export const DEFAULT_GROUP_AREA_PARAMS: GroupAreaParams = {
27
+ export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
28
28
  showLine: true,
29
29
  showLabel: true,
30
30
  lineDashArray: '3, 3',
@@ -56,7 +56,7 @@ export const DEFAULT_BARS_TRIANGLE_PARAMS: BarsTriangleParams = {
56
56
  linearGradientOpacity: [1, 0]
57
57
  }
58
58
 
59
- export const DEFAULT_GROUPING_AXIS_PARAMS: GroupAxisParams = {
59
+ export const DEFAULT_GROUP_AXIS_PARAMS: GroupAxisParams = {
60
60
  // labelAnchor: 'start',
61
61
  labelOffset: [0, 0],
62
62
  labelColorType: 'primary',