@orbcharts/plugins-basic 3.0.0-alpha.38 → 3.0.0-alpha.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/orbcharts-plugins-basic/src/base/BaseBarStack.d.ts +1 -1
  2. package/dist/orbcharts-plugins-basic/src/base/BaseBars.d.ts +1 -1
  3. package/dist/orbcharts-plugins-basic/src/base/BaseBarsTriangle.d.ts +1 -1
  4. package/dist/orbcharts-plugins-basic/src/base/BaseDots.d.ts +1 -1
  5. package/dist/orbcharts-plugins-basic/src/base/BaseLegend.d.ts +1 -0
  6. package/dist/orbcharts-plugins-basic/src/base/BaseLineAreas.d.ts +30 -0
  7. package/dist/orbcharts-plugins-basic/src/base/BaseLines.d.ts +1 -1
  8. package/dist/orbcharts-plugins-basic/src/grid/defaults.d.ts +2 -1
  9. package/dist/orbcharts-plugins-basic/src/grid/gridObservables.d.ts +2 -2
  10. package/dist/orbcharts-plugins-basic/src/grid/index.d.ts +1 -0
  11. package/dist/orbcharts-plugins-basic/src/grid/plugins/LineAreas.d.ts +1 -0
  12. package/dist/orbcharts-plugins-basic/src/grid/types.d.ts +5 -0
  13. package/dist/orbcharts-plugins-basic/src/multiGrid/types.d.ts +1 -0
  14. package/dist/orbcharts-plugins-basic/src/series/types.d.ts +1 -0
  15. package/dist/orbcharts-plugins-basic/src/tree/types.d.ts +2 -2
  16. package/dist/orbcharts-plugins-basic/src/utils/orbchartsUtils.d.ts +7 -2
  17. package/dist/orbcharts-plugins-basic.es.js +7449 -7078
  18. package/dist/orbcharts-plugins-basic.umd.js +12 -9
  19. package/package.json +2 -2
  20. package/src/base/BaseBarStack.ts +7 -3
  21. package/src/base/BaseBars.ts +7 -3
  22. package/src/base/BaseBarsTriangle.ts +52 -135
  23. package/src/base/BaseDots.ts +7 -3
  24. package/src/base/BaseLegend.ts +16 -1
  25. package/src/base/BaseLineAreas.ts +625 -0
  26. package/src/base/BaseLines.ts +12 -12
  27. package/src/base/BaseValueAxis.ts +0 -1
  28. package/src/grid/defaults.ts +7 -0
  29. package/src/grid/gridObservables.ts +5 -5
  30. package/src/grid/index.ts +1 -0
  31. package/src/grid/plugins/BarStack.ts +1 -1
  32. package/src/grid/plugins/Bars.ts +1 -1
  33. package/src/grid/plugins/BarsDiverging.ts +1 -1
  34. package/src/grid/plugins/BarsTriangle.ts +1 -1
  35. package/src/grid/plugins/Dots.ts +1 -1
  36. package/src/grid/plugins/GroupAux.ts +8 -0
  37. package/src/grid/plugins/LineAreas.ts +37 -0
  38. package/src/grid/plugins/Lines.ts +1 -1
  39. package/src/grid/plugins/ScalingArea.ts +11 -7
  40. package/src/grid/types.ts +6 -1
  41. package/src/multiGrid/defaults.ts +2 -1
  42. package/src/multiGrid/multiGridObservables.ts +6 -6
  43. package/src/multiGrid/plugins/MultiBarStack.ts +1 -1
  44. package/src/multiGrid/plugins/MultiBars.ts +1 -1
  45. package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
  46. package/src/multiGrid/plugins/MultiDots.ts +1 -1
  47. package/src/multiGrid/plugins/MultiLines.ts +1 -1
  48. package/src/multiGrid/types.ts +1 -0
  49. package/src/noneData/defaults.ts +21 -7
  50. package/src/series/defaults.ts +1 -0
  51. package/src/series/types.ts +1 -0
  52. package/src/tree/defaults.ts +1 -0
  53. package/src/tree/plugins/TreeMap.ts +7 -5
  54. package/src/tree/types.ts +2 -2
  55. package/src/utils/orbchartsUtils.ts +22 -8
  56. package/tsconfig.json +4 -1
@@ -38,7 +38,7 @@ export interface BaseLinesParams {
38
38
  interface BaseLinesContext {
39
39
  selection: d3.Selection<any, unknown, any, unknown>
40
40
  computedData$: Observable<ComputedDataGrid>
41
- existedSeriesLabels$: Observable<string[]>
41
+ existSeriesLabels$: Observable<string[]>
42
42
  SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
43
43
  GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
44
44
  fullDataFormatter$: Observable<DataFormatterGrid>
@@ -75,10 +75,6 @@ function createLinePath (lineCurve: string = 'curveLinear'): d3.Line<ComputedDat
75
75
  .curve((d3 as any)[lineCurve])
76
76
  }
77
77
 
78
- // function renderGraphicG ({ selection }) {
79
-
80
- // }
81
-
82
78
  // 依無值的資料分段
83
79
  function makeSegmentData (data: ComputedDatumGrid[]): ComputedDatumGrid[][] {
84
80
  let segmentData: ComputedDatumGrid[][] = [[]]
@@ -100,7 +96,7 @@ function makeSegmentData (data: ComputedDatumGrid[]): ComputedDatumGrid[][] {
100
96
  }
101
97
 
102
98
 
103
- function renderLine ({ selection, pathClassName, segmentData, linePath, params }: {
99
+ function renderLines ({ selection, pathClassName, segmentData, linePath, params }: {
104
100
  selection: d3.Selection<SVGGElement, unknown, any, unknown>
105
101
  pathClassName: string
106
102
  segmentData: ComputedDatumGrid[][]
@@ -136,7 +132,7 @@ function renderLine ({ selection, pathClassName, segmentData, linePath, params }
136
132
  return lines
137
133
  }
138
134
 
139
- function highlightLine ({ selection, seriesLabel, fullChartParams }: {
135
+ function highlightLines ({ selection, seriesLabel, fullChartParams }: {
140
136
  selection: d3.Selection<any, string, any, any>
141
137
  seriesLabel: string | null
142
138
  fullChartParams: ChartParams
@@ -225,7 +221,7 @@ function renderClipPath ({ defsSelection, clipPathData, transitionDuration, tran
225
221
  export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: string, {
226
222
  selection,
227
223
  computedData$,
228
- existedSeriesLabels$,
224
+ existSeriesLabels$,
229
225
  SeriesDataMap$,
230
226
  GroupDataMap$,
231
227
  fullParams$,
@@ -386,7 +382,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
386
382
  selection,
387
383
  pluginName,
388
384
  clipPathID,
389
- existedSeriesLabels$,
385
+ existSeriesLabels$,
390
386
  gridContainer$,
391
387
  gridAxesTransform$,
392
388
  gridGraphicTransform$
@@ -534,7 +530,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
534
530
  // 將資料分段
535
531
  const segmentData = makeSegmentData(data.computedData[i] ?? [])
536
532
 
537
- const pathSelection = renderLine({
533
+ const pathSelection = renderLines({
538
534
  selection: d3.select(all[i]),
539
535
  pathClassName,
540
536
  linePath: data.linePath,
@@ -558,6 +554,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
558
554
  pluginName,
559
555
  highlightTarget: data.highlightTarget,
560
556
  datum: _datum,
557
+ gridIndex: _datum.gridIndex,
561
558
  series: data.SeriesDataMap.get(_datum.seriesLabel)!,
562
559
  seriesIndex: _datum.seriesIndex,
563
560
  seriesLabel: _datum.seriesLabel,
@@ -583,6 +580,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
583
580
  pluginName,
584
581
  highlightTarget: data.highlightTarget,
585
582
  datum: _datum,
583
+ gridIndex: _datum.gridIndex,
586
584
  series: data.SeriesDataMap.get(_datum.seriesLabel)!,
587
585
  seriesIndex: _datum.seriesIndex,
588
586
  seriesLabel: _datum.seriesLabel,
@@ -608,6 +606,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
608
606
  pluginName,
609
607
  highlightTarget: data.highlightTarget,
610
608
  datum: _datum,
609
+ gridIndex: _datum.gridIndex,
611
610
  series: data.SeriesDataMap.get(_datum.seriesLabel)!,
612
611
  seriesIndex: _datum.seriesIndex,
613
612
  seriesLabel: _datum.seriesLabel,
@@ -633,6 +632,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
633
632
  pluginName,
634
633
  highlightTarget: data.highlightTarget,
635
634
  datum: _datum,
635
+ gridIndex: _datum.gridIndex,
636
636
  series: data.SeriesDataMap.get(_datum.seriesLabel)!,
637
637
  seriesIndex: _datum.seriesIndex,
638
638
  seriesLabel: _datum.seriesLabel,
@@ -651,7 +651,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
651
651
  // graphicSelection$.next(graphicSelection)
652
652
 
653
653
 
654
- // pathSelection = renderLine({
654
+ // pathSelection = renderLines({
655
655
  // selection: graphicSelection,
656
656
  // linePath: d.linePath,
657
657
  // data: d.computedData
@@ -682,7 +682,7 @@ export const createBaseLines: BasePluginFn<BaseLinesContext> = (pluginName: stri
682
682
  // if (!datum) {
683
683
  // return
684
684
  // }
685
- highlightLine({
685
+ highlightLines({
686
686
  selection: data.graphicGSelection,
687
687
  seriesLabel: (datum && datum.seriesLabel) ? datum.seriesLabel : null,
688
688
  fullChartParams: data.fullChartParams
@@ -369,7 +369,6 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
369
369
  // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
370
370
  switchMap(async (d) => d),
371
371
  ).subscribe(data => {
372
- console.log(data)
373
372
 
374
373
  const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
375
374
  maxValue: data.minAndMax[1],
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  LinesParams,
3
+ LineAreasParams,
3
4
  GroupAuxParams,
4
5
  DotsParams,
5
6
  BarsParams,
@@ -16,6 +17,11 @@ export const DEFAULT_LINES_PARAMS: LinesParams = {
16
17
  lineWidth: 2
17
18
  }
18
19
 
20
+ export const DEFAULT_LINE_AREAS_PARAMS: LineAreasParams = {
21
+ lineCurve: 'curveLinear',
22
+ linearGradientOpacity: [1, 0]
23
+ }
24
+
19
25
  export const DEFAULT_DOTS_PARAMS: DotsParams = {
20
26
  radius: 4,
21
27
  fillColorType: 'white',
@@ -111,4 +117,5 @@ export const DEFAULT_GRID_LEGEND_PARAMS: GridLegendParams = {
111
117
  listRectHeight: 14,
112
118
  listRectRadius: 0,
113
119
  // highlightEvent: false
120
+ textColorType: 'primary'
114
121
  }
@@ -24,12 +24,12 @@ import type {
24
24
  import { createAxisQuantizeScale } from '@orbcharts/core'
25
25
  import { getClassName, getUniID } from '../utils/orbchartsUtils'
26
26
 
27
- export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, existedSeriesLabels$, gridContainer$, gridAxesTransform$, gridGraphicTransform$ }: {
27
+ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, existSeriesLabels$, gridContainer$, gridAxesTransform$, gridGraphicTransform$ }: {
28
28
  selection: d3.Selection<any, unknown, any, unknown>
29
29
  pluginName: string
30
30
  clipPathID: string
31
31
  // computedData$: Observable<ComputedDataGrid>
32
- existedSeriesLabels$: Observable<string[]>
32
+ existSeriesLabels$: Observable<string[]>
33
33
  gridContainer$: Observable<ContainerPosition[]>
34
34
  gridAxesTransform$: Observable<TransformData>
35
35
  gridGraphicTransform$: Observable<TransformData>
@@ -38,11 +38,11 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, ex
38
38
  const axesClassName = getClassName(pluginName, 'axes')
39
39
  const graphicClassName = getClassName(pluginName, 'graphic')
40
40
 
41
- const seriesSelection$ = existedSeriesLabels$.pipe(
42
- map((existedSeriesLabels, i) => {
41
+ const seriesSelection$ = existSeriesLabels$.pipe(
42
+ map((existSeriesLabels, i) => {
43
43
  return selection
44
44
  .selectAll<SVGGElement, string>(`g.${seriesClassName}`)
45
- .data(existedSeriesLabels, d => d)
45
+ .data(existSeriesLabels, d => d)
46
46
  .join(
47
47
  enter => {
48
48
  return enter
package/src/grid/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './defaults'
2
2
  export * from './types'
3
3
  export { Lines } from './plugins/Lines'
4
+ export { LineAreas } from './plugins/LineAreas'
4
5
  export { Bars } from './plugins/Bars'
5
6
  export { BarsDiverging } from './plugins/BarsDiverging'
6
7
  export { BarStack } from './plugins/BarStack'
@@ -15,7 +15,7 @@ export const BarStack = defineGridPlugin(pluginName, DEFAULT_BAR_STACK_PARAMS)((
15
15
  selection,
16
16
  computedData$: observer.computedData$,
17
17
  visibleComputedData$: observer.visibleComputedData$,
18
- existedSeriesLabels$: observer.existedSeriesLabels$,
18
+ existSeriesLabels$: observer.existSeriesLabels$,
19
19
  SeriesDataMap$: observer.SeriesDataMap$,
20
20
  GroupDataMap$: observer.GroupDataMap$,
21
21
  fullParams$: observer.fullParams$,
@@ -15,7 +15,7 @@ export const Bars = defineGridPlugin(pluginName, DEFAULT_BARS_PARAMS)(({ selecti
15
15
  selection,
16
16
  computedData$: observer.computedData$,
17
17
  visibleComputedData$: observer.visibleComputedData$,
18
- existedSeriesLabels$: observer.existedSeriesLabels$,
18
+ existSeriesLabels$: observer.existSeriesLabels$,
19
19
  SeriesDataMap$: observer.SeriesDataMap$,
20
20
  GroupDataMap$: observer.GroupDataMap$,
21
21
  fullParams$: observer.fullParams$,
@@ -16,7 +16,7 @@ export const BarsDiverging = defineGridPlugin(pluginName, DEFAULT_BARS_PARAMS)((
16
16
  selection,
17
17
  computedData$: observer.computedData$,
18
18
  visibleComputedData$: observer.visibleComputedData$,
19
- existedSeriesLabels$: observer.existedSeriesLabels$,
19
+ existSeriesLabels$: observer.existSeriesLabels$,
20
20
  SeriesDataMap$: observer.SeriesDataMap$,
21
21
  GroupDataMap$: observer.GroupDataMap$,
22
22
  fullParams$: observer.fullParams$,
@@ -14,7 +14,7 @@ export const BarsTriangle = defineGridPlugin(pluginName, DEFAULT_BARS_TRIANGLE_P
14
14
  selection,
15
15
  computedData$: observer.computedData$,
16
16
  visibleComputedData$: observer.visibleComputedData$,
17
- existedSeriesLabels$: observer.existedSeriesLabels$,
17
+ existSeriesLabels$: observer.existSeriesLabels$,
18
18
  SeriesDataMap$: observer.SeriesDataMap$,
19
19
  GroupDataMap$: observer.GroupDataMap$,
20
20
  fullParams$: observer.fullParams$,
@@ -15,7 +15,7 @@ export const Dots = defineGridPlugin(pluginName, DEFAULT_DOTS_PARAMS)(({ selecti
15
15
  selection,
16
16
  computedData$: observer.computedData$,
17
17
  visibleComputedData$: observer.visibleComputedData$,
18
- existedSeriesLabels$: observer.existedSeriesLabels$,
18
+ existSeriesLabels$: observer.existSeriesLabels$,
19
19
  SeriesDataMap$: observer.SeriesDataMap$,
20
20
  GroupDataMap$: observer.GroupDataMap$,
21
21
  fullParams$: observer.fullParams$,
@@ -407,6 +407,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
407
407
  eventName: 'mouseover',
408
408
  highlightTarget: data.highlightTarget,
409
409
  datum: null,
410
+ gridIndex: 0, // @Q@ 暫不處理
410
411
  series: [],
411
412
  seriesIndex: -1,
412
413
  seriesLabel: '',
@@ -428,6 +429,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
428
429
  eventName: 'mousemove',
429
430
  highlightTarget: data.highlightTarget,
430
431
  datum: null,
432
+ gridIndex: 0, // @Q@ 暫不處理
431
433
  series: [],
432
434
  seriesIndex: -1,
433
435
  seriesLabel: '',
@@ -449,6 +451,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
449
451
  eventName: 'mouseout',
450
452
  highlightTarget: data.highlightTarget,
451
453
  datum: null,
454
+ gridIndex: 0, // @Q@ 暫不處理
452
455
  series: [],
453
456
  seriesIndex: -1,
454
457
  seriesLabel: '',
@@ -470,6 +473,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
470
473
  eventName: 'click',
471
474
  highlightTarget: data.highlightTarget,
472
475
  datum: null,
476
+ gridIndex: 0, // @Q@ 暫不處理
473
477
  series: [],
474
478
  seriesIndex: -1,
475
479
  seriesLabel: '',
@@ -550,6 +554,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
550
554
  eventName: 'mouseover',
551
555
  highlightTarget: data.highlightTarget,
552
556
  datum: null,
557
+ gridIndex: 0, // @Q@ 暫不處理
553
558
  series: [],
554
559
  seriesIndex: -1,
555
560
  seriesLabel: '',
@@ -569,6 +574,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
569
574
  eventName: 'mousemove',
570
575
  highlightTarget: data.highlightTarget,
571
576
  datum: null,
577
+ gridIndex: 0, // @Q@ 暫不處理
572
578
  series: [],
573
579
  seriesIndex: -1,
574
580
  seriesLabel: '',
@@ -588,6 +594,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
588
594
  eventName: 'mouseout',
589
595
  highlightTarget: data.highlightTarget,
590
596
  datum: null,
597
+ gridIndex: 0, // @Q@ 暫不處理
591
598
  series: [],
592
599
  seriesIndex: -1,
593
600
  seriesLabel: '',
@@ -607,6 +614,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
607
614
  eventName: 'click',
608
615
  highlightTarget: data.highlightTarget,
609
616
  datum: null,
617
+ gridIndex: 0, // @Q@ 暫不處理
610
618
  series: [],
611
619
  seriesIndex: -1,
612
620
  seriesLabel: '',
@@ -0,0 +1,37 @@
1
+ import {
2
+ Subject } from 'rxjs'
3
+ import {
4
+ defineGridPlugin } from '@orbcharts/core'
5
+ import { DEFAULT_LINE_AREAS_PARAMS } from '../defaults'
6
+ import { createBaseLineAreas } from '../../base/BaseLineAreas'
7
+
8
+ const pluginName = 'LineAreas'
9
+
10
+ export const LineAreas = defineGridPlugin(pluginName, DEFAULT_LINE_AREAS_PARAMS)(({ selection, name, observer, subject }) => {
11
+
12
+ const destroy$ = new Subject()
13
+
14
+ const unsubscribeBaseBars = createBaseLineAreas(pluginName, {
15
+ selection,
16
+ computedData$: observer.computedData$,
17
+ existSeriesLabels$: observer.existSeriesLabels$,
18
+ SeriesDataMap$: observer.SeriesDataMap$,
19
+ GroupDataMap$: observer.GroupDataMap$,
20
+ fullParams$: observer.fullParams$,
21
+ fullDataFormatter$: observer.fullDataFormatter$,
22
+ fullChartParams$: observer.fullChartParams$,
23
+ gridAxesTransform$: observer.gridAxesTransform$,
24
+ gridGraphicTransform$: observer.gridGraphicTransform$,
25
+ gridAxesSize$: observer.gridAxesSize$,
26
+ gridHighlight$: observer.gridHighlight$,
27
+ gridContainer$: observer.gridContainer$,
28
+ layout$: observer.layout$,
29
+ event$: subject.event$,
30
+ })
31
+
32
+
33
+ return () => {
34
+ destroy$.next(undefined)
35
+ unsubscribeBaseBars()
36
+ }
37
+ })
@@ -14,7 +14,7 @@ export const Lines = defineGridPlugin(pluginName, DEFAULT_LINES_PARAMS)(({ selec
14
14
  const unsubscribeBaseBars = createBaseLines(pluginName, {
15
15
  selection,
16
16
  computedData$: observer.computedData$,
17
- existedSeriesLabels$: observer.existedSeriesLabels$,
17
+ existSeriesLabels$: observer.existSeriesLabels$,
18
18
  SeriesDataMap$: observer.SeriesDataMap$,
19
19
  GroupDataMap$: observer.GroupDataMap$,
20
20
  fullParams$: observer.fullParams$,
@@ -9,6 +9,7 @@ import {
9
9
  takeUntil,
10
10
  debounceTime,
11
11
  Subject } from 'rxjs'
12
+ import type { DataFormatterGrid } from '@orbcharts/core'
12
13
  import {
13
14
  defineGridPlugin } from '@orbcharts/core'
14
15
  import { DEFAULT_SCALING_AREA_PARAMS } from '../defaults'
@@ -87,9 +88,9 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
87
88
  ? groupMax + data.initGroupAxis.scalePadding
88
89
  : data.initGroupAxis.scaleDomain[1] as number + data.initGroupAxis.scalePadding
89
90
 
90
- const scaleRange: [number, number] = data.fullDataFormatter.grid.valueAxis.position === 'left' || data.fullDataFormatter.grid.valueAxis.position === 'top'
91
- ? [0, 1]
92
- : [1, 0]
91
+ // const scaleRange: [number, number] = data.fullDataFormatter.grid.valueAxis.position === 'left' || data.fullDataFormatter.grid.valueAxis.position === 'top'
92
+ // ? [0, 1]
93
+ // : [1, 0]
93
94
 
94
95
  const groupScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
95
96
  maxValue: data.groupMaxIndex,
@@ -97,7 +98,7 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
97
98
  axisWidth: data.axisSize.width,
98
99
  scaleDomain: [groupScaleDomainMin, groupScaleDomainMax],
99
100
  // scaleDomain: [groupMin, groupMax],
100
- scaleRange
101
+ scaleRange: [0, 1]
101
102
  })
102
103
 
103
104
  const shadowScale = groupScale.copy()
@@ -106,6 +107,7 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
106
107
  // .scaleExtent([1, data.groupMaxIndex])
107
108
  // .translateExtent([[0, 0], [data.layout.rootWidth, data.layout.rootWidth]])
108
109
  .on("zoom", function zoomed(event) {
110
+ // debugger
109
111
  // console.log('event', event)
110
112
  const t = event.transform;
111
113
  // console.log('t', t)
@@ -146,7 +148,8 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
146
148
  lastTransform.y = t.y
147
149
  // console.log(String(data.fullDataFormatter.visibleFilter))
148
150
  // console.log('zoomedDomain', zoomedDomain)
149
- subject.dataFormatter$.next({
151
+
152
+ const newDataFormatter: DataFormatterGrid = {
150
153
  ...data.fullDataFormatter,
151
154
  grid: {
152
155
  ...data.fullDataFormatter.grid,
@@ -154,8 +157,9 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
154
157
  ...data.fullDataFormatter.grid.groupAxis,
155
158
  scaleDomain: zoomedDomain
156
159
  }
157
- }
158
- })
160
+ },
161
+ }
162
+ subject.dataFormatter$.next(newDataFormatter)
159
163
  })
160
164
 
161
165
  // 傳入外層selection
package/src/grid/types.ts CHANGED
@@ -5,7 +5,6 @@ import type { ColorType } from '@orbcharts/core'
5
5
  // export type BarType = 'rect' | 'triangle'
6
6
 
7
7
  export interface LinesParams {
8
- // lineType: LineType
9
8
  lineCurve: string
10
9
  lineWidth: number
11
10
  // labelFn: (d: ComputedDatumSeries) => string
@@ -16,6 +15,11 @@ export interface LinesParams {
16
15
  // labelPadding: number
17
16
  }
18
17
 
18
+ export interface LineAreasParams {
19
+ lineCurve: string
20
+ linearGradientOpacity: [number, number]
21
+ }
22
+
19
23
  export interface DotsParams {
20
24
  radius: number
21
25
  fillColorType: ColorType
@@ -113,4 +117,5 @@ export interface GridLegendParams {
113
117
  listRectWidth: number
114
118
  listRectHeight: number
115
119
  listRectRadius: number
120
+ textColorType: ColorType
116
121
  }
@@ -26,7 +26,8 @@ export const DEFAULT_MULTI_GRID_LEGEND_PARAMS: MultiGridLegendParams = {
26
26
  listRectHeight: 14,
27
27
  listRectRadius: 0,
28
28
  }
29
- ]
29
+ ],
30
+ textColorType: 'primary'
30
31
  }
31
32
 
32
33
  export const DEFAULT_MULTI_GROUP_AXIS_PARAMS: MultiGroupAxisParams = {
@@ -100,8 +100,8 @@ import type { ContextObserverMultiGrid, ComputedDataGrid, DataFormatterGrid, Con
100
100
  // switchMap(d => d.gridHighlight$)
101
101
  // )
102
102
 
103
- // const existedSeriesLabels$ = gridDetail$.pipe(
104
- // switchMap(d => d.existedSeriesLabels$)
103
+ // const existSeriesLabels$ = gridDetail$.pipe(
104
+ // switchMap(d => d.existSeriesLabels$)
105
105
  // )
106
106
 
107
107
  // const SeriesDataMap$ = gridDetail$.pipe(
@@ -127,7 +127,7 @@ import type { ContextObserverMultiGrid, ComputedDataGrid, DataFormatterGrid, Con
127
127
  // gridAxesReverseTransform$,
128
128
  // gridAxesSize$,
129
129
  // gridHighlight$,
130
- // existedSeriesLabels$,
130
+ // existSeriesLabels$,
131
131
  // SeriesDataMap$,
132
132
  // GroupDataMap$,
133
133
  // visibleComputedData$,
@@ -241,8 +241,8 @@ export const multiGridDetailObservables = (observer: ContextObserverMultiGrid<Mu
241
241
  switchMap(d => d.gridHighlight$)
242
242
  )
243
243
 
244
- const existedSeriesLabels$ = gridDetail$.pipe(
245
- switchMap(d => d.existedSeriesLabels$)
244
+ const existSeriesLabels$ = gridDetail$.pipe(
245
+ switchMap(d => d.existSeriesLabels$)
246
246
  )
247
247
 
248
248
  const SeriesDataMap$ = gridDetail$.pipe(
@@ -266,7 +266,7 @@ export const multiGridDetailObservables = (observer: ContextObserverMultiGrid<Mu
266
266
  gridAxesReverseTransform$,
267
267
  gridAxesSize$,
268
268
  gridHighlight$,
269
- existedSeriesLabels$,
269
+ existSeriesLabels$,
270
270
  SeriesDataMap$,
271
271
  GroupDataMap$,
272
272
  visibleComputedData$,
@@ -35,7 +35,7 @@ export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR
35
35
  selection: gridSelection,
36
36
  computedData$: d.gridComputedData$,
37
37
  visibleComputedData$: d.visibleComputedData$,
38
- existedSeriesLabels$: d.existedSeriesLabels$,
38
+ existSeriesLabels$: d.existSeriesLabels$,
39
39
  SeriesDataMap$: d.SeriesDataMap$,
40
40
  GroupDataMap$: d.GroupDataMap$,
41
41
  fullParams$: observer.fullParams$,
@@ -35,7 +35,7 @@ export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PA
35
35
  selection: gridSelection,
36
36
  computedData$: d.gridComputedData$,
37
37
  visibleComputedData$: d.visibleComputedData$,
38
- existedSeriesLabels$: d.existedSeriesLabels$,
38
+ existSeriesLabels$: d.existSeriesLabels$,
39
39
  SeriesDataMap$: d.SeriesDataMap$,
40
40
  GroupDataMap$: d.GroupDataMap$,
41
41
  fullParams$: observer.fullParams$,
@@ -35,7 +35,7 @@ export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI
35
35
  selection: gridSelection,
36
36
  computedData$: d.gridComputedData$,
37
37
  visibleComputedData$: d.visibleComputedData$,
38
- existedSeriesLabels$: d.existedSeriesLabels$,
38
+ existSeriesLabels$: d.existSeriesLabels$,
39
39
  SeriesDataMap$: d.SeriesDataMap$,
40
40
  GroupDataMap$: d.GroupDataMap$,
41
41
  fullParams$: observer.fullParams$,
@@ -35,7 +35,7 @@ export const MultiDots = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_DOTS_PA
35
35
  selection: gridSelection,
36
36
  computedData$: d.gridComputedData$,
37
37
  visibleComputedData$: d.visibleComputedData$,
38
- existedSeriesLabels$: d.existedSeriesLabels$,
38
+ existSeriesLabels$: d.existSeriesLabels$,
39
39
  SeriesDataMap$: d.SeriesDataMap$,
40
40
  GroupDataMap$: d.GroupDataMap$,
41
41
  fullParams$: observer.fullParams$,
@@ -35,7 +35,7 @@ export const MultiLines = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_LINES_
35
35
  unsubscribeFnArr[i] = createBaseLines(pluginName, {
36
36
  selection: gridSelection,
37
37
  computedData$: d.gridComputedData$,
38
- existedSeriesLabels$: d.existedSeriesLabels$,
38
+ existSeriesLabels$: d.existSeriesLabels$,
39
39
  SeriesDataMap$: d.SeriesDataMap$,
40
40
  GroupDataMap$: d.GroupDataMap$,
41
41
  fullDataFormatter$: d.gridDataFormatter$,
@@ -29,6 +29,7 @@ export interface MultiGridLegendParams {
29
29
  listRectHeight: number
30
30
  listRectRadius: number
31
31
  }>
32
+ textColorType: ColorType
32
33
  }
33
34
 
34
35
  export interface MultiGroupAxisParams extends BaseGroupAxisParams {
@@ -1,5 +1,5 @@
1
1
  import type { ContainerPluginParams, TooltipParams } from './types'
2
- import type { EventSeries, EventGrid } from '@orbcharts/core'
2
+ import type { EventBaseSeriesValue, EventBaseGridValue, EventBaseCategoryValue } from '@orbcharts/core'
3
3
 
4
4
  export const CONTAINER_PLUGIN_PARAMS: ContainerPluginParams = {
5
5
  header: {
@@ -25,20 +25,34 @@ export const TOOLTIP_PARAMS: TooltipParams = {
25
25
  if (eventData.highlightTarget === 'datum' && eventData.datum) {
26
26
  return [`${eventData.datum.label}: ${eventData.datum.value}`]
27
27
  } else if (eventData.highlightTarget === 'series') {
28
- const label = (eventData as EventSeries).seriesLabel
29
- const value = (eventData as EventSeries).series
28
+ const label = (eventData as EventBaseSeriesValue<any, any>).seriesLabel
29
+ const valueArr = (eventData as EventBaseSeriesValue<any, any>).series
30
30
  .map(d => {
31
31
  return d.value
32
32
  })
33
- .join(',')
33
+ const value = valueArr.length > 5
34
+ ? valueArr.slice(0, 5).join(',') + '...'
35
+ : valueArr.join(',')
34
36
  return [label, value]
35
37
  } else if (eventData.highlightTarget === 'group') {
36
- const label = (eventData as EventGrid).groupLabel
37
- const value = (eventData as EventGrid).groups
38
+ const label = (eventData as EventBaseGridValue<any, any>).groupLabel
39
+ const valueArr = (eventData as EventBaseGridValue<any, any>).series
38
40
  .map(d => {
39
41
  return d.value
40
42
  })
41
- .join(',')
43
+ const value = valueArr.length > 5
44
+ ? valueArr.slice(0, 5).join(',') + '...'
45
+ : valueArr.join(',')
46
+ return [label, value]
47
+ } else if (eventData.highlightTarget === 'category') {
48
+ const label = (eventData as EventBaseCategoryValue<any, any>).categoryLabel
49
+ const valueArr = (eventData as EventBaseCategoryValue<any, any>).category
50
+ .map(d => {
51
+ return d.value
52
+ })
53
+ const value = valueArr.length > 5
54
+ ? valueArr.slice(0, 5).join(',') + '...'
55
+ : valueArr.join(',')
42
56
  return [label, value]
43
57
  }
44
58
  return []
@@ -95,4 +95,5 @@ export const DEFAULT_SERIES_LEGEND_PARAMS: SeriesLegendParams = {
95
95
  listRectHeight: 14,
96
96
  listRectRadius: 0,
97
97
  // highlightEvent: false
98
+ textColorType: 'primary'
98
99
  }
@@ -63,4 +63,5 @@ export interface SeriesLegendParams {
63
63
  listRectWidth: number
64
64
  listRectHeight: number
65
65
  listRectRadius: number
66
+ textColorType: ColorType
66
67
  }
@@ -18,4 +18,5 @@ export const DEFAULT_TREE_LEGEND_PARAMS: TreeLegendParams = {
18
18
  listRectWidth: 14,
19
19
  listRectHeight: 14,
20
20
  listRectRadius: 0,
21
+ textColorType: 'primary'
21
22
  }