@orbcharts/plugins-basic 3.0.0-beta.3 → 3.0.0-beta.5

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.
Files changed (147) hide show
  1. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarStack.d.ts +2 -2
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
  8. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
  9. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
  10. package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +1 -1
  11. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
  12. package/dist/orbcharts-plugins-basic/src/index.d.ts +6 -0
  13. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
  14. package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
  15. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
  16. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  17. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  18. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
  19. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  20. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
  21. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
  22. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
  23. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
  24. package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
  25. package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
  26. package/dist/orbcharts-plugins-basic.es.js +11809 -10185
  27. package/dist/orbcharts-plugins-basic.umd.js +66 -34
  28. package/dist/src/index.d.ts +1 -5
  29. package/package.json +4 -4
  30. package/src/base/BaseBarStack.ts +2 -2
  31. package/src/base/BaseBars.ts +2 -2
  32. package/src/base/BaseBarsTriangle.ts +2 -2
  33. package/src/base/BaseDots.ts +2 -53
  34. package/src/base/BaseGroupAxis.ts +3 -3
  35. package/src/base/BaseLegend.ts +21 -17
  36. package/src/base/BaseLineAreas.ts +3 -3
  37. package/src/base/BaseLines.ts +3 -3
  38. package/src/base/BaseValueAxis.ts +46 -43
  39. package/src/grid/defaults.ts +3 -3
  40. package/src/grid/gridObservables.ts +24 -15
  41. package/src/grid/plugins/GridLegend.ts +2 -2
  42. package/src/grid/plugins/GridZoom.ts +14 -14
  43. package/src/grid/plugins/GroupAux.ts +206 -201
  44. package/src/grid/plugins/ValueAxis.ts +1 -0
  45. package/src/grid/plugins/ValueStackAxis.ts +1 -0
  46. package/src/index.ts +1 -0
  47. package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
  48. package/src/multiGrid/plugins/MultiValueAxis.ts +1 -0
  49. package/src/multiGrid/plugins/MultiValueStackAxis.ts +1 -0
  50. package/src/multiGrid/plugins/OverlappingValueAxes.ts +1 -0
  51. package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +1 -0
  52. package/src/multiValue/defaults.ts +163 -0
  53. package/src/multiValue/index.ts +9 -0
  54. package/src/multiValue/multiValueObservables.ts +258 -0
  55. package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
  56. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
  57. package/src/multiValue/plugins/Scatter.ts +426 -0
  58. package/src/multiValue/plugins/ScatterBubbles.ts +551 -0
  59. package/src/multiValue/plugins/XYAux.ts +682 -0
  60. package/src/multiValue/plugins/XYAxes.ts +677 -0
  61. package/src/multiValue/plugins/XYZoom.ts +300 -0
  62. package/src/series/plugins/Bubbles.ts +4 -4
  63. package/src/series/plugins/Pie.ts +2 -2
  64. package/src/series/plugins/PieEventTexts.ts +2 -2
  65. package/src/series/plugins/PieLabels.ts +2 -2
  66. package/src/series/plugins/Rose.ts +2 -2
  67. package/src/series/plugins/RoseLabels.ts +2 -2
  68. package/src/series/plugins/SeriesLegend.ts +4 -4
  69. package/src/series/seriesObservables.ts +3 -3
  70. package/src/tree/plugins/TreeLegend.ts +3 -10
  71. package/src/utils/d3Utils.ts +2 -1
  72. package/src/utils/observables.ts +2 -2
  73. package/src/utils/orbchartsUtils.ts +7 -6
  74. package/dist/src/base/BaseGroupArea.d.ts +0 -0
  75. package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
  76. package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
  77. package/dist/src/relationship/index.d.ts +0 -0
  78. package/src/base/BaseGroupArea.ts +0 -0
  79. package/src/multiValue/plugins/ScatterAxes.ts +0 -0
  80. /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
  81. /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
  82. /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
  83. /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
  84. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  85. /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
  86. /package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +0 -0
  87. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarStack.d.ts +0 -0
  88. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  89. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
  90. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  91. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  92. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  93. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
  94. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
  95. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  96. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  97. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  98. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  99. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  100. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueStackAxis.d.ts +0 -0
  101. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +0 -0
  102. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +0 -0
  103. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
  104. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarStack.d.ts +0 -0
  105. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  106. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  107. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  108. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  109. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
  110. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  111. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  112. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  113. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  114. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -0
  115. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  116. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -0
  117. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
  118. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
  119. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  120. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
  121. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Container.d.ts +0 -0
  122. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Tooltip.d.ts +0 -0
  123. /package/dist/{src/multiValue → orbcharts-plugins-basic/src/relationship}/index.d.ts +0 -0
  124. /package/dist/{src → orbcharts-plugins-basic/src}/relationship/plugins/Relationship.d.ts +0 -0
  125. /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
  126. /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
  127. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  128. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  129. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
  130. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  131. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
  132. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
  133. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  134. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
  135. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  136. /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
  137. /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
  138. /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
  139. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  140. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  141. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
  142. /package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +0 -0
  143. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  144. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +0 -0
  145. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
  146. /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
  147. /package/src/{grid → multiValue}/plugins/RankingAxis.ts +0 -0
@@ -1,5 +1 @@
1
- export * from './grid';
2
- export * from './multiGrid';
3
- export * from './noneData';
4
- export * from './series';
5
- export * from './tree';
1
+ export * from '../orbcharts-plugins-basic/src/index'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbcharts/plugins-basic",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.5",
4
4
  "description": "plugins for OrbCharts",
5
5
  "author": "Blue Planet Inc.",
6
6
  "license": "Apache-2.0",
@@ -35,9 +35,9 @@
35
35
  "vite-plugin-dts": "^3.7.3"
36
36
  },
37
37
  "dependencies": {
38
- "@orbcharts/core": "^3.0.0-beta.2",
39
- "@orbcharts/core-types": "^3.0.0-beta.2",
40
- "@orbcharts/plugins-basic-types": "^3.0.0-beta.3",
38
+ "@orbcharts/core": "^3.0.0-beta.4",
39
+ "@orbcharts/core-types": "^3.0.0-beta.3",
40
+ "@orbcharts/plugins-basic-types": "^3.0.0-beta.4",
41
41
  "d3": "^7.8.5",
42
42
  "rxjs": "^7.8.1"
43
43
  }
@@ -17,7 +17,7 @@ import type {
17
17
  DataFormatterGrid,
18
18
  EventGrid,
19
19
  ChartParams,
20
- GridContainerPosition,
20
+ ContainerPositionScaled,
21
21
  Layout,
22
22
  TransformData } from '../../lib/core-types'
23
23
  import type { BaseBarStackParams } from '../../lib/plugins-basic-types'
@@ -52,7 +52,7 @@ interface BaseBarStackContext {
52
52
  height: number;
53
53
  }>
54
54
  gridHighlight$: Observable<ComputedDatumGrid[]>
55
- gridContainerPosition$: Observable<GridContainerPosition[]>
55
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
56
56
  isSeriesSeprate$: Observable<boolean>
57
57
  event$: Subject<EventGrid>
58
58
  }
@@ -14,7 +14,7 @@ import type {
14
14
  ComputedDataGrid,
15
15
  ComputedLayoutDataGrid,
16
16
  DataFormatterTypeMap,
17
- GridContainerPosition,
17
+ ContainerPositionScaled,
18
18
  EventGrid,
19
19
  ChartParams,
20
20
  Layout,
@@ -51,7 +51,7 @@ interface BaseBarsContext {
51
51
  height: number;
52
52
  }>
53
53
  gridHighlight$: Observable<ComputedDatumGrid[]>
54
- gridContainerPosition$: Observable<GridContainerPosition[]>
54
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
55
55
  isSeriesSeprate$: Observable<boolean>
56
56
  event$: Subject<EventGrid>
57
57
  }
@@ -17,7 +17,7 @@ import type {
17
17
  DataFormatterTypeMap,
18
18
  EventGrid,
19
19
  ChartParams,
20
- GridContainerPosition,
20
+ ContainerPositionScaled,
21
21
  Layout,
22
22
  TransformData
23
23
  } from '../../lib/core-types'
@@ -52,7 +52,7 @@ interface BaseBarsContext {
52
52
  height: number;
53
53
  }>
54
54
  gridHighlight$: Observable<ComputedDatumGrid[]>
55
- gridContainerPosition$: Observable<GridContainerPosition[]>
55
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
56
56
  isSeriesSeprate$: Observable<boolean>
57
57
  event$: Subject<EventGrid>
58
58
  }
@@ -14,7 +14,7 @@ import type {
14
14
  ComputedLayoutDataGrid,
15
15
  EventGrid,
16
16
  ChartParams,
17
- GridContainerPosition,
17
+ ContainerPositionScaled,
18
18
  Layout,
19
19
  TransformData,
20
20
  ColorType
@@ -51,7 +51,7 @@ interface BaseDotsContext {
51
51
  height: number;
52
52
  }>
53
53
  gridHighlight$: Observable<ComputedDatumGrid[]>
54
- gridContainerPosition$: Observable<GridContainerPosition[]>
54
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
55
55
  event$: Subject<EventGrid>
56
56
  }
57
57
 
@@ -138,57 +138,6 @@ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, vis
138
138
  .attr('transform', `scale(${graphicReverseScale[seriesIndex][0] ?? 1}, ${graphicReverseScale[seriesIndex][1] ?? 1})`)
139
139
  })
140
140
  })
141
-
142
- // const dots = graphicGSelection
143
- // .selectAll<SVGGElement, ComputedDatumGrid>('g')
144
- // .data(data, d => d.id)
145
- // .join(
146
- // enter => {
147
- // // enterDuration
148
- // enterDuration = createEnterDuration(enter)
149
-
150
- // return enter
151
- // .append('g')
152
- // .classed(circleGClassName, true)
153
- // },
154
- // update => update,
155
- // exit => exit.remove()
156
- // )
157
- // .attr('transform', d => `translate(${d.axisX}, ${d.axisY})`)
158
- // .each((d, i, g) => {
159
- // const circle = d3.select(g[i])
160
- // .selectAll('circle')
161
- // .data([d])
162
- // .join(
163
- // enter => {
164
- // return enter
165
- // .append('circle')
166
- // .style('cursor', 'pointer')
167
- // .style('vector-effect', 'non-scaling-stroke')
168
- // .classed(circleClassName, true)
169
- // .attr('opacity', 0)
170
- // .transition()
171
- // .delay((_d, _i) => {
172
- // return i * enterDuration
173
- // })
174
- // .attr('opacity', 1)
175
- // },
176
- // update => {
177
- // return update
178
- // .transition()
179
- // .duration(50)
180
- // // .attr('cx', d => d.axisX)
181
- // // .attr('cy', d => d.axisY)
182
- // .attr('opacity', 1)
183
- // },
184
- // exit => exit.remove()
185
- // )
186
- // .attr('r', fullParams.radius)
187
- // .attr('fill', (d, i) => getDatumColor({ datum: d, colorType: fullParams.fillColorType, fullChartParams }))
188
- // .attr('stroke', (d, i) => getDatumColor({ datum: d, colorType: fullParams.strokeColorType, fullChartParams }))
189
- // .attr('stroke-width', fullParams.strokeWidth)
190
- // .attr('transform', `scale(${graphicReverseScale[0]}, ${graphicReverseScale[1]})`)
191
- // })
192
141
 
193
142
  const graphicCircleSelection: d3.Selection<SVGRectElement, ComputedDatumGrid, SVGGElement, unknown> = graphicGSelection.selectAll(`circle.${circleClassName}`)
194
143
 
@@ -13,7 +13,7 @@ import {
13
13
  import type {
14
14
  ColorType,
15
15
  ComputedDataGrid,
16
- GridContainerPosition,
16
+ ContainerPositionScaled,
17
17
  ComputedDatumGrid,
18
18
  DataFormatterGrid,
19
19
  ChartParams,
@@ -57,7 +57,7 @@ interface BaseGroupAxisContext {
57
57
  width: number;
58
58
  height: number;
59
59
  }>
60
- gridContainerPosition$: Observable<GridContainerPosition[]>
60
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
61
61
  isSeriesSeprate$: Observable<boolean>
62
62
  textSizePx$: Observable<number>
63
63
  }
@@ -498,7 +498,7 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
498
498
 
499
499
  // const padding = data.fullDataFormatter.grid.groupAxis.scalePadding
500
500
 
501
- // const groupScale = createAxisPointScale({
501
+ // const groupScale = createLabelToAxisScale({
502
502
  // axisLabels,
503
503
  // axisWidth: data.gridAxesSize.width,
504
504
  // padding
@@ -25,7 +25,7 @@ import { measureTextWidth } from '../utils/commonUtils'
25
25
  // backgroundStroke: ColorType
26
26
  // textColorType: ColorType
27
27
  // gap: number
28
- // seriesList: Array<{
28
+ // labelList: Array<{
29
29
  // listRectWidth: number
30
30
  // listRectHeight: number
31
31
  // listRectRadius: number
@@ -35,7 +35,7 @@ import { measureTextWidth } from '../utils/commonUtils'
35
35
 
36
36
  interface BaseLegendContext {
37
37
  rootSelection: d3.Selection<any, unknown, any, unknown>
38
- seriesLabels$: Observable<string[]>
38
+ legendLabels$: Observable<string[]>
39
39
  fullParams$: Observable<BaseLegendParams>
40
40
  layout$: Observable<Layout>
41
41
  fullChartParams$: Observable<ChartParams>
@@ -89,6 +89,8 @@ interface ListStyle {
89
89
  listRectRadius: number
90
90
  }
91
91
 
92
+ const noneLabelText = ' - ' // 沒有label時的預設文字
93
+
92
94
  const defaultListStyle: ListStyle = {
93
95
  listRectWidth: 14,
94
96
  listRectHeight: 14,
@@ -105,7 +107,7 @@ function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
105
107
 
106
108
  export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: string, {
107
109
  rootSelection,
108
- seriesLabels$,
110
+ legendLabels$,
109
111
  fullParams$,
110
112
  layout$,
111
113
  fullChartParams$,
@@ -119,7 +121,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
119
121
 
120
122
  const destroy$ = new Subject()
121
123
 
122
- // const seriesLabels$: Observable<string[]> = SeriesDataMap$.pipe(
124
+ // const legendLabels$: Observable<string[]> = SeriesDataMap$.pipe(
123
125
  // takeUntil(destroy$),
124
126
  // map(data => {
125
127
  // return Array.from(data.keys())
@@ -127,7 +129,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
127
129
  // )
128
130
 
129
131
  const SeriesLabelColorMap$ = combineLatest({
130
- seriesLabels: seriesLabels$,
132
+ legendLabels: legendLabels$,
131
133
  fullChartParams: fullChartParams$
132
134
  }).pipe(
133
135
  takeUntil(destroy$),
@@ -135,7 +137,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
135
137
  map(data => {
136
138
  const SeriesLabelColorMap: Map<string, string> = new Map()
137
139
  let accIndex = 0
138
- data.seriesLabels.forEach((label, i) => {
140
+ data.legendLabels.forEach((label, i) => {
139
141
  if (!SeriesLabelColorMap.has(label)) {
140
142
  const color = getSeriesColor(accIndex, data.fullChartParams)
141
143
  SeriesLabelColorMap.set(label, color)
@@ -146,8 +148,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
146
148
  })
147
149
  )
148
150
 
149
- // 對應seriesLabels是否顯示(只顯示不重覆的)
150
- const visibleList$ = seriesLabels$.pipe(
151
+ // 對應legendLabels是否顯示(只顯示不重覆的)
152
+ const visibleList$ = legendLabels$.pipe(
151
153
  takeUntil(destroy$),
152
154
  map(data => {
153
155
  const AccSeriesLabelSet = new Set()
@@ -305,7 +307,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
305
307
  const defaultListStyle$ = fullParams$.pipe(
306
308
  takeUntil(destroy$),
307
309
  map(data => {
308
- return data.seriesList[0] ? data.seriesList[0] : defaultListStyle
310
+ return data.labelList[0] ? data.labelList[0] : defaultListStyle
309
311
  })
310
312
  )
311
313
 
@@ -314,7 +316,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
314
316
  visibleList: visibleList$,
315
317
  fullParams: fullParams$,
316
318
  fullChartParams: fullChartParams$,
317
- seriesLabels: seriesLabels$,
319
+ legendLabels: legendLabels$,
318
320
  lineDirection: lineDirection$,
319
321
  lineMaxSize: lineMaxSize$,
320
322
  defaultListStyle: defaultListStyle$,
@@ -324,16 +326,18 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
324
326
  takeUntil(destroy$),
325
327
  switchMap(async d => d),
326
328
  map(data => {
327
- return data.seriesLabels.reduce((prev: LegendItem[][], current, currentIndex) => {
329
+ return data.legendLabels.reduce((prev: LegendItem[][], _current, currentIndex) => {
328
330
  // visible為flase則不加入
329
331
  if (!data.visibleList[currentIndex]) {
330
332
  return prev
331
333
  }
334
+
335
+ const currentText = _current !== '' ? _current : noneLabelText
332
336
 
333
- const textWidth = measureTextWidth(current, data.textSizePx)
337
+ const textWidth = measureTextWidth(currentText, data.textSizePx)
334
338
  const itemWidth = (data.textSizePx * 1.5) + textWidth
335
339
  // const color = getSeriesColor(currentIndex, data.fullChartParams)
336
- const color = data.SeriesLabelColorMap.get(current)
340
+ const color = data.SeriesLabelColorMap.get(_current)
337
341
  const lastItem: LegendItem | null = prev[0] && prev[0][0]
338
342
  ? prev[prev.length - 1][prev[prev.length - 1].length - 1]
339
343
  : null
@@ -389,15 +393,15 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
389
393
  prev[lineIndex] = []
390
394
  }
391
395
 
392
- const listStyle = data.fullParams.seriesList[itemIndex] ? data.fullParams.seriesList[itemIndex] : data.defaultListStyle
396
+ const listStyle = data.fullParams.labelList[itemIndex] ? data.fullParams.labelList[itemIndex] : data.defaultListStyle
393
397
 
394
398
  prev[lineIndex].push({
395
- id: current,
396
- seriesLabel: current,
399
+ id: currentText,
400
+ seriesLabel: currentText,
397
401
  seriesIndex: currentIndex,
398
402
  lineIndex,
399
403
  itemIndex,
400
- text: current,
404
+ text: currentText,
401
405
  itemWidth,
402
406
  translateX,
403
407
  translateY,
@@ -16,7 +16,7 @@ import type {
16
16
  ComputedLayoutDataGrid,
17
17
  DataFormatterGrid,
18
18
  EventGrid,
19
- GridContainerPosition,
19
+ ContainerPositionScaled,
20
20
  ChartParams,
21
21
  Layout,
22
22
  TransformData
@@ -52,8 +52,8 @@ interface BaseLineAreasContext {
52
52
  height: number;
53
53
  }>
54
54
  gridHighlight$: Observable<ComputedDatumGrid[]>
55
- gridContainerPosition$: Observable<GridContainerPosition[]>
56
- allContainerPosition$: Observable<GridContainerPosition[]>
55
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
56
+ allContainerPosition$: Observable<ContainerPositionScaled[]>
57
57
  layout$: Observable<Layout>
58
58
  event$: Subject<EventGrid>
59
59
  }
@@ -16,7 +16,7 @@ import type {
16
16
  ComputedLayoutDataGrid,
17
17
  DataFormatterGrid,
18
18
  EventGrid,
19
- GridContainerPosition,
19
+ ContainerPositionScaled,
20
20
  ChartParams,
21
21
  Layout,
22
22
  TransformData
@@ -58,8 +58,8 @@ interface BaseLinesContext {
58
58
  height: number;
59
59
  }>
60
60
  gridHighlight$: Observable<ComputedDatumGrid[]>
61
- gridContainerPosition$: Observable<GridContainerPosition[]>
62
- allContainerPosition$: Observable<GridContainerPosition[]>
61
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
62
+ allContainerPosition$: Observable<ContainerPositionScaled[]>
63
63
  layout$: Observable<Layout>
64
64
  event$: Subject<EventGrid>
65
65
  }
@@ -8,14 +8,14 @@ import {
8
8
  takeUntil,
9
9
  Observable,
10
10
  Subject } from 'rxjs'
11
- import { createAxisLinearScale } from '../../lib/core'
11
+ import { createValueToAxisScale } from '../../lib/core'
12
12
  import type { BasePluginFn } from './types'
13
13
  import type {
14
14
  ComputedDataGrid,
15
15
  DataFormatterGrid,
16
16
  ChartParams,
17
17
  ComputedDatumGrid,
18
- GridContainerPosition,
18
+ ContainerPositionScaled,
19
19
  TransformData,
20
20
  EventGrid,
21
21
  ColorType
@@ -43,6 +43,7 @@ import { getColor, getMinAndMaxValue, getClassName, getUniID } from '../utils/or
43
43
  interface BaseLinesContext {
44
44
  selection: d3.Selection<any, unknown, any, unknown>
45
45
  computedData$: Observable<ComputedDataGrid>
46
+ filteredMinMaxValue$: Observable<[number, number]>
46
47
  fullParams$: Observable<BaseValueAxisParams>
47
48
  fullDataFormatter$: Observable<DataFormatterGrid>
48
49
  fullChartParams$: Observable<ChartParams>
@@ -52,7 +53,7 @@ interface BaseLinesContext {
52
53
  width: number;
53
54
  height: number;
54
55
  }>
55
- gridContainerPosition$: Observable<GridContainerPosition[]>
56
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
56
57
  isSeriesSeprate$: Observable<boolean>
57
58
  }
58
59
 
@@ -149,7 +150,7 @@ function renderAxisLabel ({ selection, textClassName, fullParams, axisLabelAlign
149
150
 
150
151
  }
151
152
 
152
- function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, textReverseTransformWithRotate, minAndMax }: {
153
+ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, textReverseTransformWithRotate, filteredMinMaxValue }: {
153
154
  selection: d3.Selection<SVGGElement, any, any, any>,
154
155
  yAxisClassName: string
155
156
  fullParams: BaseValueAxisParams
@@ -159,7 +160,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
159
160
  fullChartParams: ChartParams
160
161
  valueScale: d3.ScaleLinear<number, number>
161
162
  textReverseTransformWithRotate: string,
162
- minAndMax: [number, number]
163
+ filteredMinMaxValue: [number, number]
163
164
  }) {
164
165
 
165
166
  const yAxisSelection = selection
@@ -168,7 +169,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
168
169
  .join('g')
169
170
  .classed(yAxisClassName, true)
170
171
 
171
- const valueLength = minAndMax[1] - minAndMax[0]
172
+ const valueLength = filteredMinMaxValue[1] - filteredMinMaxValue[0]
172
173
 
173
174
  // const _valueScale = d3.scaleLinear()
174
175
  // .domain([0, 150])
@@ -196,7 +197,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
196
197
  .scale(valueScale)
197
198
  .ticks(valueLength > fullParams.ticks
198
199
  ? fullParams.ticks
199
- : ((minAndMax[0] === 0 && minAndMax[1] === 0)
200
+ : ((filteredMinMaxValue[0] === 0 && filteredMinMaxValue[1] === 0)
200
201
  ? 1
201
202
  : Math.ceil(valueLength))) // 刻度分段數量
202
203
  .tickFormat(d => parseTickFormatValue(d, fullParams.tickFormat))
@@ -231,6 +232,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
231
232
  .attr('dominant-baseline', tickTextAlign.dominantBaseline)
232
233
  // .attr('dy', 0)
233
234
  .attr('y', textY)
235
+ .attr('dy', 0)
234
236
  yText.style('transform', textReverseTransformWithRotate)
235
237
 
236
238
  // 抵消掉預設的偏移
@@ -246,6 +248,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
246
248
  export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName: string, {
247
249
  selection,
248
250
  computedData$,
251
+ filteredMinMaxValue$,
249
252
  fullParams$,
250
253
  fullDataFormatter$,
251
254
  fullChartParams$,
@@ -410,52 +413,52 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
410
413
  })
411
414
  )
412
415
 
413
- const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
414
- combineLatest({
415
- fullDataFormatter: fullDataFormatter$,
416
- gridAxesSize: gridAxesSize$,
417
- computedData: computedData$
418
- }).pipe(
419
- takeUntil(destroy$),
420
- switchMap(async (d) => d),
421
- ).subscribe(data => {
422
- const groupMin = 0
423
- const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
424
- // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
425
- // ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
426
- // : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
427
- const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] - data.fullDataFormatter.grid.groupAxis.scalePadding
428
- const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
429
- ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
430
- : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
416
+ // const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
417
+ // combineLatest({
418
+ // fullDataFormatter: fullDataFormatter$,
419
+ // computedData: computedData$
420
+ // }).pipe(
421
+ // takeUntil(destroy$),
422
+ // switchMap(async (d) => d),
423
+ // ).subscribe(data => {
424
+ // const groupMin = 0
425
+ // const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
426
+ // // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
427
+ // // ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
428
+ // // : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
429
+ // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] - data.fullDataFormatter.grid.groupAxis.scalePadding
430
+ // const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
431
+ // ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
432
+ // : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
431
433
 
432
- const filteredData = data.computedData.map((d, i) => {
433
- return d.filter((_d, _i) => {
434
- return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
435
- })
436
- })
434
+ // const filteredData = data.computedData.map((d, i) => {
435
+ // return d.filter((_d, _i) => {
436
+ // return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
437
+ // })
438
+ // })
437
439
 
438
- const filteredMinAndMax = getMinAndMaxValue(filteredData.flat())
439
- if (filteredMinAndMax[0] === filteredMinAndMax[1]) {
440
- filteredMinAndMax[0] = filteredMinAndMax[1] - 1 // 避免最大及最小值相同造成無法計算scale
441
- }
442
- subscriber.next(filteredMinAndMax)
443
- })
444
- })
440
+ // const filteredMinAndMax = getMinAndMaxValue(filteredData.flat())
441
+ // if (filteredMinAndMax[0] === filteredMinAndMax[1]) {
442
+ // filteredMinAndMax[0] = filteredMinAndMax[1] - 1 // 避免最大及最小值相同造成無法計算scale
443
+ // }
444
+ // subscriber.next(filteredMinAndMax)
445
+ // })
446
+ // })
445
447
 
446
448
  const valueScale$: Observable<d3.ScaleLinear<number, number>> = new Observable(subscriber => {
447
449
  combineLatest({
448
450
  fullDataFormatter: fullDataFormatter$,
449
451
  gridAxesSize: gridAxesSize$,
450
- minAndMax: minAndMax$
452
+ // minAndMax: minAndMax$
453
+ filteredMinMaxValue: filteredMinMaxValue$
451
454
  }).pipe(
452
455
  takeUntil(destroy$),
453
456
  switchMap(async (d) => d),
454
457
  ).subscribe(data => {
455
458
 
456
- const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
457
- maxValue: data.minAndMax[1],
458
- minValue: data.minAndMax[0],
459
+ const valueScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
460
+ maxValue: data.filteredMinMaxValue[1],
461
+ minValue: data.filteredMinMaxValue[0],
459
462
  axisWidth: data.gridAxesSize.height,
460
463
  scaleDomain: data.fullDataFormatter.grid.valueAxis.scaleDomain,
461
464
  scaleRange: data.fullDataFormatter.grid.valueAxis.scaleRange
@@ -543,7 +546,7 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
543
546
  valueScale: valueScale$,
544
547
  textReverseTransform: textReverseTransform$,
545
548
  textReverseTransformWithRotate: textReverseTransformWithRotate$,
546
- minAndMax: minAndMax$
549
+ filteredMinMaxValue: filteredMinMaxValue$
547
550
  }).pipe(
548
551
  takeUntil(destroy$),
549
552
  switchMap(async (d) => d),
@@ -559,7 +562,7 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
559
562
  fullChartParams: data.fullChartParams,
560
563
  valueScale: data.valueScale,
561
564
  textReverseTransformWithRotate: data.textReverseTransformWithRotate,
562
- minAndMax: data.minAndMax
565
+ filteredMinMaxValue: data.filteredMinMaxValue
563
566
  })
564
567
 
565
568
  renderAxisLabel({
@@ -13,7 +13,7 @@ import type {
13
13
  GridZoomParams,
14
14
  GridLegendParams
15
15
  } from '../../lib/plugins-basic-types'
16
- import { measureTextWidth } from '../utils/commonUtils'
16
+ // import { measureTextWidth } from '../utils/commonUtils'
17
17
 
18
18
  export const DEFAULT_LINES_PARAMS: LinesParams = {
19
19
  lineCurve: 'curveLinear',
@@ -34,7 +34,7 @@ export const DEFAULT_DOTS_PARAMS: DotsParams = {
34
34
  onlyShowHighlighted: false
35
35
  }
36
36
 
37
- export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
37
+ export const DEFAULT_GROUP_AUX_PARAMS: GroupAuxParams = {
38
38
  showLine: true,
39
39
  showLabel: true,
40
40
  lineDashArray: '3, 3',
@@ -45,7 +45,7 @@ export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
45
45
  labelPadding: 20,
46
46
  labelRotate: 0
47
47
  }
48
- DEFAULT_GROUP_AREA_PARAMS.labelTextFormat.toString = () => `text => text`
48
+ DEFAULT_GROUP_AUX_PARAMS.labelTextFormat.toString = () => `text => text`
49
49
 
50
50
  export const DEFAULT_BARS_PARAMS: BarsParams = {
51
51
  // barType: 'rect',