@orbcharts/plugins-basic 3.0.0-alpha.34 → 3.0.0-alpha.36

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 +10136 -9414
  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 +4 -1
  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/GroupAux.d.ts +3 -0
  14. package/dist/src/grid/plugins/GroupAxis.d.ts +1 -3
  15. package/dist/src/grid/plugins/ValueAxis.d.ts +1 -3
  16. package/dist/src/grid/plugins/ValueStackAxis.d.ts +1 -3
  17. package/dist/src/grid/types.d.ts +1 -1
  18. package/dist/src/multiGrid/defaults.d.ts +9 -2
  19. package/dist/src/multiGrid/index.d.ts +8 -1
  20. package/dist/src/multiGrid/multiGridObservables.d.ts +12 -0
  21. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +1 -0
  22. package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -0
  23. package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -0
  24. package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -0
  25. package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -0
  26. package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -0
  27. package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -0
  28. package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -0
  29. package/dist/src/multiGrid/types.d.ts +31 -0
  30. package/package.json +2 -2
  31. package/src/base/BaseBarStack.ts +375 -198
  32. package/src/base/BaseBars.ts +297 -191
  33. package/src/base/BaseBarsTriangle.ts +344 -229
  34. package/src/base/BaseDots.ts +285 -117
  35. package/src/base/BaseGroupAxis.ts +497 -0
  36. package/src/base/BaseLegend.ts +54 -5
  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 +163 -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 +3 -0
  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 +2 -7
  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
@@ -1,244 +1,30 @@
1
- import * as d3 from 'd3'
2
1
  import {
3
- combineLatest,
4
- switchMap,
5
- distinctUntilChanged,
6
- first,
7
- map,
8
2
  takeUntil,
9
- Observable,
3
+ map,
4
+ switchMap,
5
+ iif,
10
6
  Subject } from 'rxjs'
11
7
  import {
12
8
  defineGridPlugin } from '@orbcharts/core'
13
- import { createAxisLinearScale } from '@orbcharts/core'
14
- import type {
15
- DataFormatterGrid,
16
- ChartParams,
17
- TransformData } from '@orbcharts/core'
18
- import type { ValueStackAxisParams } from '../types'
19
9
  import { DEFAULT_VALUE_STACK_AXIS_PARAMS } from '../defaults'
20
- import { getMinAndMax } from '../../utils/commonUtils'
21
- import { parseTickFormatValue } from '../../utils/d3Utils'
22
- import { getColor, getClassName } from '../../utils/orbchartsUtils'
23
10
 
24
- interface TextAlign {
25
- textAnchor: "start" | "middle" | "end"
26
- dominantBaseline: "middle" | "auto" | "hanging"
27
- }
11
+ import { createBaseValueAxis } from '../../base/BaseValueAxis'
28
12
 
29
13
  const pluginName = 'ValueStackAxis'
30
- const gClassName = getClassName(pluginName, 'g')
31
- const textClassName = getClassName(pluginName, 'text')
32
- const defaultTickSize = 6
33
-
34
- function renderLinearAxis ({ selection, fullParams, tickTextAlign, axisLabelAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, contentTransform, minAndMax }: {
35
- selection: d3.Selection<SVGGElement, any, any, any>,
36
- fullParams: ValueStackAxisParams
37
- tickTextAlign: TextAlign
38
- axisLabelAlign: TextAlign
39
- gridAxesSize: { width: number, height: number }
40
- fullDataFormatter: DataFormatterGrid,
41
- fullChartParams: ChartParams
42
- valueScale: d3.ScaleLinear<number, number>
43
- contentTransform: string,
44
- minAndMax: [number, number]
45
- }) {
46
-
47
- const yAxisSelection = selection
48
- .selectAll<SVGGElement, ValueStackAxisParams>(`g.${gClassName}`)
49
- .data([fullParams])
50
- .join('g')
51
- .classed(gClassName, true)
52
-
53
- const axisLabelSelection = selection
54
- .selectAll<SVGGElement, ValueStackAxisParams>(`g.${textClassName}`)
55
- .data([fullParams])
56
- .join('g')
57
- .classed(textClassName, true)
58
- .each((d, i, g) => {
59
- const text = d3.select(g[i])
60
- .selectAll<SVGTextElement, ValueStackAxisParams>(`text`)
61
- .data([d])
62
- .join(
63
- enter => {
64
- return enter
65
- .append('text')
66
- .style('font-weight', 'bold')
67
- },
68
- update => update,
69
- exit => exit.remove()
70
- )
71
- .attr('text-anchor', axisLabelAlign.textAnchor)
72
- .attr('dominant-baseline', axisLabelAlign.dominantBaseline)
73
- .style('font-size', `${fullChartParams.styles.textSize}px`)
74
- .style('fill', getColor(fullParams.labelColorType, fullChartParams))
75
- .style('transform', contentTransform)
76
- .text(d => fullDataFormatter.valueAxis.label)
77
- })
78
- .attr('transform', d => `translate(${- d.tickPadding + fullParams.labelOffset[0]}, ${gridAxesSize.height + d.tickPadding + fullParams.labelOffset[1]})`)
79
-
80
-
81
- const valueLength = minAndMax[1] - minAndMax[0]
82
-
83
- // 設定Y軸刻度
84
- const yAxis = d3.axisLeft(valueScale)
85
- .scale(valueScale)
86
- .ticks(valueLength > fullParams.ticks
87
- ? fullParams.ticks
88
- : ((minAndMax[0] === 0 && minAndMax[1] === 0)
89
- ? 1
90
- : Math.ceil(valueLength))) // 刻度分段數量
91
- .tickFormat(d => parseTickFormatValue(d, fullParams.tickFormat))
92
- .tickSize(fullParams.tickFullLine == true
93
- ? -gridAxesSize.width
94
- : defaultTickSize)
95
- .tickPadding(fullParams.tickPadding)
96
-
97
- const yAxisEl = yAxisSelection
98
- .transition()
99
- .duration(100)
100
- .call(yAxis)
101
-
102
- yAxisEl.selectAll('line')
103
- .style('fill', 'none')
104
- .style('stroke', fullParams.tickLineVisible == true ? getColor(fullParams.tickColorType, fullChartParams) : 'none')
105
- .style('stroke-dasharray', fullParams.tickFullLineDasharray)
106
- .attr('pointer-events', 'none')
107
-
108
- yAxisEl.selectAll('path')
109
- .style('fill', 'none')
110
- // .style('stroke', this.fullParams.axisLineColor!)
111
- .style('stroke', fullParams.axisLineVisible == true ? getColor(fullParams.axisLineColorType, fullChartParams) : 'none')
112
- .style('shape-rendering', 'crispEdges')
113
-
114
- // const yText = yAxisEl.selectAll('text')
115
- const yText = yAxisSelection.selectAll('text')
116
- .style('font-family', 'sans-serif')
117
- .style('font-size', `${fullChartParams.styles.textSize}px`)
118
- .style('color', getColor(fullParams.tickTextColorType, fullChartParams))
119
- .attr('text-anchor', tickTextAlign.textAnchor)
120
- .attr('dominant-baseline', tickTextAlign.dominantBaseline)
121
- .attr('transform-origin', `-${fullParams.tickPadding + defaultTickSize} 0`)
122
- yText.style('transform', contentTransform)
123
-
124
- return yAxisSelection
125
- }
126
-
127
14
 
128
15
  export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_AXIS_PARAMS)(({ selection, name, observer, subject }) => {
129
16
 
130
17
  const destroy$ = new Subject()
131
18
 
132
- // const axisGUpdate = selection
133
- // .selectAll('g')
134
- // .data()
135
-
136
- const axisSelection: d3.Selection<SVGGElement, any, any, any> = selection.append('g')
137
- // let graphicSelection: d3.Selection<SVGGElement, any, any, any> | undefined
138
- // let pathSelection: d3.Selection<SVGPathElement, ComputedDatumGrid[], any, any> | undefined
139
- // .style('transform', 'translate(0px, 0px) scale(1)')
140
-
141
- observer.gridAxesTransform$
142
- .pipe(
143
- takeUntil(destroy$),
144
- map(d => d.value),
145
- distinctUntilChanged()
146
- ).subscribe(d => {
147
- axisSelection
148
- .style('transform', d)
149
- .attr('opacity', 0)
150
- .transition()
151
- .attr('opacity', 1)
152
- })
153
-
154
- // const gridAxesSize$ = gridAxisSizeObservable({
155
- // fullDataFormatter$,
156
- // computedLayout$
157
- // })
158
-
159
- // const contentTransform$: Observable<string> = new Observable(subscriber => {
160
- // combineLatest({
161
- // fullParams: fullParams$,
162
- // computedLayout: computedLayout$
163
- // }).pipe(
164
- // takeUntil(destroy$),
165
- // // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
166
- // switchMap(async (d) => d),
167
- // ).subscribe(data => {
168
-
169
- // const transformData = Object.assign({}, data.computedLayout.content.axesTransformData)
170
-
171
- // const value = getAxesTransformValue({
172
- // translate: [0, 0],
173
- // scale: [transformData.scale[0] * -1, transformData.scale[1] * -1],
174
- // rotate: transformData.rotate * -1 + data.fullParams.tickTextRotate,
175
- // rotateX: transformData.rotateX * -1,
176
- // rotateY: transformData.rotateY * -1
177
- // })
178
-
179
- // subscriber.next(value)
180
- // })
181
- // })
182
- // const oppositeTransform$: Observable<TransformData> = observer.gridAxesTransform$.pipe(
183
- // takeUntil(destroy$),
184
- // map(d => {
185
- // const translate: [number, number] = [d.translate[0] * -1, d.translate[1] * -1]
186
- // const scale: [number, number] = [d.scale[0] * -1, d.scale[1] * -1]
187
- // const rotate = d.rotate * -1
188
- // const rotateX = d.rotateX * -1
189
- // const rotateY = d.rotateY * -1
190
- // return {
191
- // translate,
192
- // scale,
193
- // rotate,
194
- // rotateX,
195
- // rotateY,
196
- // value: ''
197
- // }
198
- // }),
199
- // )
200
- const contentTransform$ = combineLatest({
201
- fullParams: observer.fullParams$,
202
- gridAxesOppositeTransform: observer.gridAxesOppositeTransform$
203
- }).pipe(
19
+ // 將原本的value全部替換成加總後的value
20
+ const stackedData$ = observer.computedData$.pipe(
204
21
  takeUntil(destroy$),
205
- switchMap(async data => {
206
- const rotate = data.gridAxesOppositeTransform.rotate + data.fullParams.tickTextRotate
207
- return `translate(${data.gridAxesOppositeTransform.translate[0]}px, ${data.gridAxesOppositeTransform.translate[1]}px) rotate(${rotate}deg) rotateX(${data.gridAxesOppositeTransform.rotateX}deg) rotateY(${data.gridAxesOppositeTransform.rotateY}deg)`
208
- }),
209
- distinctUntilChanged()
210
- )
211
-
212
- const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
213
- combineLatest({
214
- fullDataFormatter: observer.fullDataFormatter$,
215
- gridAxesSize: observer.gridAxesSize$,
216
- computedData: observer.computedData$,
217
- }).pipe(
218
- takeUntil(destroy$),
219
- // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
220
- switchMap(async (d) => d),
221
- ).subscribe(data => {
222
- const groupMin = 0
223
- const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
224
- const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
225
- ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
226
- : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
227
- const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'auto'
228
- ? groupMax + data.fullDataFormatter.groupAxis.scalePadding
229
- : data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
230
-
231
- const filteredData = data.computedData.map((d, i) => {
232
- return d.filter((_d, _i) => {
233
- return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
234
- })
235
- })
236
-
22
+ map(data => {
237
23
  // 將同一group的value加總起來
238
- const filteredStackedData = new Array(filteredData[0] ? filteredData[0].length : 0)
24
+ const stackedValue = new Array(data[0] ? data[0].length : 0)
239
25
  .fill(null)
240
26
  .map((_, i) => {
241
- return filteredData.reduce((prev, current) => {
27
+ return data.reduce((prev, current) => {
242
28
  if (current && current[i]) {
243
29
  const currentValue = current[i].value == null || current[i].visible == false
244
30
  ? 0
@@ -248,125 +34,38 @@ export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_A
248
34
  return prev
249
35
  }, 0)
250
36
  })
251
-
252
- const filteredMinAndMax = getMinAndMax(filteredStackedData)
253
-
254
- subscriber.next(filteredMinAndMax)
255
- })
256
- })
257
-
258
- const valueScale$: Observable<d3.ScaleLinear<number, number>> = new Observable(subscriber => {
259
- combineLatest({
260
- fullDataFormatter: observer.fullDataFormatter$,
261
- gridAxesSize: observer.gridAxesSize$,
262
- minAndMax: minAndMax$
263
- }).pipe(
264
- takeUntil(destroy$),
265
- // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
266
- switchMap(async (d) => d),
267
- ).subscribe(data => {
268
-
269
- const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
270
- maxValue: data.minAndMax[1],
271
- minValue: data.minAndMax[0],
272
- axisWidth: data.gridAxesSize.height,
273
- scaleDomain: data.fullDataFormatter.valueAxis.scaleDomain,
274
- scaleRange: data.fullDataFormatter.valueAxis.scaleRange
37
+ // 將原本的value全部替換成加總後的value
38
+ const computedData = data.map((series, seriesIndex) => {
39
+ return series.map((d, i) => {
40
+ return {
41
+ ...d,
42
+ value: stackedValue[i],
43
+ }
44
+ })
275
45
  })
276
-
277
- subscriber.next(valueScale)
278
- })
279
- })
280
-
281
- const tickTextAlign$: Observable<TextAlign> = observer.fullDataFormatter$.pipe(
282
- takeUntil(destroy$),
283
- map(d => {
284
- let textAnchor: 'start' | 'middle' | 'end' = 'start'
285
- let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
286
-
287
- if (d.valueAxis.position === 'left') {
288
- textAnchor = 'end'
289
- dominantBaseline = 'middle'
290
- } else if (d.valueAxis.position === 'right') {
291
- textAnchor = 'start'
292
- dominantBaseline = 'middle'
293
- } else if (d.valueAxis.position === 'bottom') {
294
- textAnchor = 'middle'
295
- dominantBaseline = 'hanging'
296
- } else if (d.valueAxis.position === 'top') {
297
- textAnchor = 'middle'
298
- dominantBaseline = 'auto'
299
- }
300
- return {
301
- textAnchor,
302
- dominantBaseline
303
- }
304
- })
305
- )
306
-
307
- const axisLabelAlign$: Observable<TextAlign> = observer.fullDataFormatter$.pipe(
308
- takeUntil(destroy$),
309
- map(d => {
310
- let textAnchor: 'start' | 'middle' | 'end' = 'start'
311
- let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
312
-
313
- if (d.groupAxis.position === 'bottom') {
314
- dominantBaseline = 'auto'
315
- } else if (d.groupAxis.position === 'top') {
316
- dominantBaseline = 'hanging'
317
- } else if (d.groupAxis.position === 'left') {
318
- textAnchor = 'start'
319
- } else if (d.groupAxis.position === 'right') {
320
- textAnchor = 'end'
321
- }
322
- if (d.valueAxis.position === 'left') {
323
- textAnchor = 'end'
324
- } else if (d.valueAxis.position === 'right') {
325
- textAnchor = 'start'
326
- } else if (d.valueAxis.position === 'bottom') {
327
- dominantBaseline = 'hanging'
328
- } else if (d.valueAxis.position === 'top') {
329
- dominantBaseline = 'auto'
330
- }
331
- return {
332
- textAnchor,
333
- dominantBaseline
334
- }
335
- })
46
+ return computedData
47
+ }),
336
48
  )
337
49
 
338
- combineLatest({
339
- fullParams: observer.fullParams$,
340
- tickTextAlign: tickTextAlign$,
341
- axisLabelAlign: axisLabelAlign$,
342
- computedData: observer.computedData$,
343
- gridAxesSize: observer.gridAxesSize$,
344
- fullDataFormatter: observer.fullDataFormatter$,
345
- fullChartParams: observer.fullChartParams$,
346
- valueScale: valueScale$,
347
- contentTransform: contentTransform$,
348
- minAndMax: minAndMax$
349
- }).pipe(
350
- takeUntil(destroy$),
351
- // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
352
- switchMap(async (d) => d),
353
- ).subscribe(data => {
354
-
355
- renderLinearAxis({
356
- selection: axisSelection,
357
- fullParams: data.fullParams,
358
- tickTextAlign: data.tickTextAlign,
359
- axisLabelAlign: data.axisLabelAlign,
360
- gridAxesSize: data.gridAxesSize,
361
- fullDataFormatter: data.fullDataFormatter,
362
- fullChartParams: data.fullChartParams,
363
- valueScale: data.valueScale,
364
- contentTransform: data.contentTransform,
365
- minAndMax: data.minAndMax
366
- })
50
+ const unsubscribeBaseValueAxis = createBaseValueAxis(pluginName, {
51
+ selection,
52
+ computedData$: observer.isSeriesPositionSeprate$.pipe(
53
+ switchMap(isSeriesPositionSeprate => {
54
+ return iif(() => isSeriesPositionSeprate, observer.computedData$, stackedData$)
55
+ })
56
+ ),
57
+ fullParams$: observer.fullParams$,
58
+ fullDataFormatter$: observer.fullDataFormatter$,
59
+ fullChartParams$: observer.fullChartParams$,
60
+ gridAxesTransform$: observer.gridAxesTransform$,
61
+ gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
62
+ gridAxesSize$: observer.gridAxesSize$,
63
+ gridContainer$: observer.gridContainer$,
64
+ isSeriesPositionSeprate$: observer.isSeriesPositionSeprate$,
367
65
  })
368
66
 
369
67
  return () => {
370
68
  destroy$.next(undefined)
69
+ unsubscribeBaseValueAxis()
371
70
  }
372
71
  })
package/src/grid/types.ts CHANGED
@@ -24,7 +24,7 @@ export interface DotsParams {
24
24
  onlyShowHighlighted: boolean
25
25
  }
26
26
 
27
- export interface GroupAreaParams {
27
+ export interface GroupAuxParams {
28
28
  showLine: boolean
29
29
  showLabel: boolean
30
30
  lineDashArray: string
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // export { default as pie } from './seriesPlugins/pie'
3
3
  // export { default as pieEventTexts } from './seriesPlugins/pieEventTexts'
4
4
  // export { default as pieLabels } from './seriesPlugins/pieLabels'
5
+
5
6
  export * from './grid'
6
7
  export * from './multiGrid'
7
8
  export * from './noneData'
@@ -1,17 +1,14 @@
1
- import type { BarsAndLinesParams, MultiGridLegendParams } from './types'
2
-
3
- export const DEFAULT_BARS_AND_LINES_PARAMS: BarsAndLinesParams = {
4
- bars: {
5
- barWidth: 0,
6
- barPadding: 1,
7
- barGroupPadding: 40,
8
- barRadius: false,
9
- },
10
- lines: {
11
- lineCurve: 'curveLinear',
12
- lineWidth: 2
13
- }
14
- }
1
+ import type {
2
+ MultiGridLegendParams,
3
+ MultiBarsParams,
4
+ MultiBarStackParams,
5
+ MultiBarsTriangleParams,
6
+ MultiLinesParams,
7
+ MultiDotsParams,
8
+ MultiGroupAxisParams,
9
+ MultiValueAxisParams,
10
+ OverlappingValueAxesParams
11
+ } from './types'
15
12
 
16
13
  export const DEFAULT_MULTI_GRID_LEGEND_PARAMS: MultiGridLegendParams = {
17
14
  position: 'right',
@@ -31,3 +28,112 @@ export const DEFAULT_MULTI_GRID_LEGEND_PARAMS: MultiGridLegendParams = {
31
28
  }
32
29
  ]
33
30
  }
31
+
32
+ export const DEFAULT_MULTI_GROUP_AXIS_PARAMS: MultiGroupAxisParams = {
33
+ // labelAnchor: 'start',
34
+ labelOffset: [0, 0],
35
+ labelColorType: 'primary',
36
+ axisLineVisible: true,
37
+ axisLineColorType: 'primary',
38
+ tickFormat: text => text,
39
+ tickLineVisible: true,
40
+ tickPadding: 20,
41
+ tickFullLine: false,
42
+ tickFullLineDasharray: 'none',
43
+ tickColorType: 'secondary',
44
+ tickTextRotate: 0,
45
+ tickTextColorType: 'primary',
46
+ gridIndexes: [0]
47
+ }
48
+
49
+ export const DEFAULT_MULTI_VALUE_AXIS_PARAMS: MultiValueAxisParams = {
50
+ // labelAnchor: 'end',
51
+ labelOffset: [0, 0],
52
+ labelColorType: 'primary',
53
+ axisLineVisible: false,
54
+ axisLineColorType: 'primary',
55
+ ticks: 4,
56
+ tickFormat: ',.0f',
57
+ tickLineVisible: true,
58
+ tickPadding: 20,
59
+ tickFullLine: true,
60
+ tickFullLineDasharray: 'none',
61
+ tickColorType: 'secondary',
62
+ tickTextRotate: 0,
63
+ tickTextColorType: 'primary',
64
+ gridIndexes: [0]
65
+ }
66
+
67
+ export const DEFAULT_MULTI_BARS_PARAMS: MultiBarsParams = {
68
+ barWidth: 0,
69
+ barPadding: 1,
70
+ barGroupPadding: 40,
71
+ barRadius: false,
72
+ gridIndexes: [0]
73
+ }
74
+
75
+ export const DEFAULT_MULTI_BAR_STACK_PARAMS: MultiBarStackParams = {
76
+ barWidth: 0,
77
+ barGroupPadding: 10,
78
+ barRadius: false,
79
+ gridIndexes: [0]
80
+ }
81
+
82
+ export const DEFAULT_MULTI_BARS_TRIANGLE_PARAMS: MultiBarsTriangleParams = {
83
+ barWidth: 0,
84
+ barPadding: 1,
85
+ barGroupPadding: 20,
86
+ linearGradientOpacity: [1, 0],
87
+ gridIndexes: [0]
88
+ }
89
+
90
+ export const DEFAULT_MULTI_LINES_PARAMS: MultiLinesParams = {
91
+ lineCurve: 'curveLinear',
92
+ lineWidth: 2,
93
+ gridIndexes: [1]
94
+ }
95
+
96
+ export const DEFAULT_MULTI_DOTS_PARAMS: MultiDotsParams = {
97
+ radius: 4,
98
+ fillColorType: 'white',
99
+ strokeColorType: 'series',
100
+ strokeWidth: 2,
101
+ onlyShowHighlighted: false,
102
+ gridIndexes: [1]
103
+ }
104
+
105
+ export const DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS: OverlappingValueAxesParams = {
106
+ firstAxis: {
107
+ // labelAnchor: 'end',
108
+ labelOffset: [0, 0],
109
+ labelColorType: 'primary',
110
+ axisLineVisible: false,
111
+ axisLineColorType: 'primary',
112
+ ticks: 4,
113
+ tickFormat: ',.0f',
114
+ tickLineVisible: true,
115
+ tickPadding: 20,
116
+ tickFullLine: true,
117
+ tickFullLineDasharray: 'none',
118
+ tickColorType: 'secondary',
119
+ tickTextRotate: 0,
120
+ tickTextColorType: 'primary',
121
+ },
122
+ secondAxis: {
123
+ // labelAnchor: 'end',
124
+ labelOffset: [0, 0],
125
+ labelColorType: 'primary',
126
+ axisLineVisible: false,
127
+ axisLineColorType: 'primary',
128
+ ticks: 4,
129
+ tickFormat: ',.0f',
130
+ tickLineVisible: true,
131
+ tickPadding: 20,
132
+ tickFullLine: true,
133
+ tickFullLineDasharray: 'none',
134
+ tickColorType: 'secondary',
135
+ tickTextRotate: 0,
136
+ tickTextColorType: 'primary',
137
+ },
138
+ gridIndexes: [0, 1]
139
+ }
@@ -1,4 +1,11 @@
1
1
  export * from './defaults'
2
2
  export * from './types'
3
- export { BarsAndLines } from './plugins/BarsAndLines'
4
- export { MultiGridLegend } from './plugins/MultiGridLegend'
3
+ export { MultiGridLegend } from './plugins/MultiGridLegend'
4
+ export { MultiBars } from './plugins/MultiBars'
5
+ export { MultiBarStack } from './plugins/MultiBarStack'
6
+ export { MultiBarsTriangle } from './plugins/MultiBarsTriangle'
7
+ export { MultiLines } from './plugins/MultiLines'
8
+ export { MultiDots } from './plugins/MultiDots'
9
+ export { MultiGroupAxis } from './plugins/MultiGroupAxis'
10
+ export { MultiValueAxis } from './plugins/MultiValueAxis'
11
+ export { OverlappingValueAxes } from './plugins/OverlappingValueAxes'