@orbcharts/plugins-basic 3.0.0-beta.1 → 3.0.0-beta.11

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 (181) hide show
  1. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
  8. package/dist/{src/base/BaseBarStack.d.ts → orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts} +6 -6
  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 +4 -4
  11. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
  12. package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +2 -2
  13. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +1 -0
  14. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +1 -0
  15. package/dist/orbcharts-plugins-basic/src/index.d.ts +7 -0
  16. package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +4 -4
  17. package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +3 -3
  18. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +1 -0
  19. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
  20. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
  21. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
  22. package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
  23. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
  24. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  25. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  26. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
  27. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  28. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
  29. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
  30. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
  31. package/dist/orbcharts-plugins-basic/src/relationship/defaults.d.ts +6 -0
  32. package/dist/orbcharts-plugins-basic/src/relationship/index.d.ts +5 -0
  33. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +3 -0
  34. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
  35. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
  36. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
  37. package/dist/orbcharts-plugins-basic/src/relationship/relationshipObservables.d.ts +1 -0
  38. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
  39. package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +1 -1
  40. package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +2 -2
  41. package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
  42. package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
  43. package/dist/orbcharts-plugins-basic.es.js +13327 -10361
  44. package/dist/orbcharts-plugins-basic.umd.js +99 -49
  45. package/dist/src/index.d.ts +1 -5
  46. package/package.json +4 -4
  47. package/src/base/BaseBars.ts +5 -5
  48. package/src/base/BaseBarsTriangle.ts +6 -4
  49. package/src/base/BaseDots.ts +3 -54
  50. package/src/base/BaseGroupAxis.ts +50 -50
  51. package/src/base/BaseLegend.ts +25 -21
  52. package/src/base/BaseLineAreas.ts +4 -4
  53. package/src/base/BaseLines.ts +3 -3
  54. package/src/base/{BaseBarStack.ts → BaseStackedBar.ts} +22 -20
  55. package/src/base/BaseTooltip.ts +5 -2
  56. package/src/base/BaseValueAxis.ts +84 -81
  57. package/src/grid/defaults.ts +15 -13
  58. package/src/grid/gridObservables.ts +56 -47
  59. package/src/grid/index.ts +2 -2
  60. package/src/grid/plugins/GridLegend.ts +2 -2
  61. package/src/grid/plugins/GridZoom.ts +20 -20
  62. package/src/grid/plugins/GroupAux.ts +216 -211
  63. package/src/grid/plugins/{BarStack.ts → StackedBar.ts} +7 -7
  64. package/src/grid/plugins/{ValueStackAxis.ts → StackedValueAxis.ts} +6 -5
  65. package/src/grid/plugins/ValueAxis.ts +1 -0
  66. package/src/index.ts +2 -5
  67. package/src/multiGrid/defaults.ts +11 -11
  68. package/src/multiGrid/index.ts +3 -3
  69. package/src/multiGrid/plugins/MultiBars.ts +1 -1
  70. package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
  71. package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
  72. package/src/multiGrid/plugins/MultiGroupAxis.ts +1 -1
  73. package/src/multiGrid/plugins/{MultiBarStack.ts → MultiStackedBar.ts} +8 -8
  74. package/src/multiGrid/plugins/{MultiValueStackAxis.ts → MultiStackedValueAxis.ts} +4 -3
  75. package/src/multiGrid/plugins/MultiValueAxis.ts +2 -1
  76. package/src/multiGrid/plugins/{OverlappingValueStackAxes.ts → OverlappingStackedValueAxes.ts} +9 -8
  77. package/src/multiGrid/plugins/OverlappingValueAxes.ts +4 -3
  78. package/src/multiValue/defaults.ts +167 -0
  79. package/src/multiValue/index.ts +9 -0
  80. package/src/multiValue/multiValueObservables.ts +297 -0
  81. package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
  82. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
  83. package/src/multiValue/plugins/Scatter.ts +426 -0
  84. package/src/multiValue/plugins/ScatterBubbles.ts +554 -0
  85. package/src/multiValue/plugins/XYAux.ts +682 -0
  86. package/src/multiValue/plugins/XYAxes.ts +685 -0
  87. package/src/multiValue/plugins/XYZoom.ts +300 -0
  88. package/src/noneData/plugins/Container.ts +23 -23
  89. package/src/noneData/plugins/Tooltip.ts +365 -365
  90. package/src/relationship/defaults.ts +197 -0
  91. package/src/relationship/index.ts +5 -0
  92. package/src/relationship/plugins/ForceDirected.ts +1169 -0
  93. package/src/relationship/plugins/ForceDirectedBubbles.ts +1394 -0
  94. package/src/relationship/plugins/RelationshipLegend.ts +100 -0
  95. package/src/relationship/plugins/RelationshipTooltip.ts +66 -0
  96. package/src/relationship/relationshipObservables.ts +50 -0
  97. package/src/series/defaults.ts +13 -12
  98. package/src/series/plugins/Bubbles.ts +22 -22
  99. package/src/series/plugins/Pie.ts +2 -2
  100. package/src/series/plugins/PieEventTexts.ts +22 -21
  101. package/src/series/plugins/PieLabels.ts +2 -2
  102. package/src/series/plugins/Rose.ts +2 -2
  103. package/src/series/plugins/RoseLabels.ts +2 -2
  104. package/src/series/plugins/SeriesLegend.ts +4 -4
  105. package/src/series/seriesObservables.ts +3 -3
  106. package/src/tree/defaults.ts +3 -3
  107. package/src/tree/plugins/TreeLegend.ts +3 -10
  108. package/src/utils/commonUtils.ts +5 -5
  109. package/src/utils/d3Utils.ts +4 -3
  110. package/src/utils/observables.ts +2 -2
  111. package/src/utils/orbchartsUtils.ts +28 -12
  112. package/dist/src/grid/plugins/BarStack.d.ts +0 -1
  113. package/dist/src/grid/plugins/ValueStackAxis.d.ts +0 -1
  114. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +0 -1
  115. package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -1
  116. package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -1
  117. package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
  118. package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
  119. package/dist/src/noneData/plugins/Container.d.ts +0 -1
  120. package/dist/src/noneData/plugins/Tooltip.d.ts +0 -3
  121. package/dist/src/relationship/index.d.ts +0 -0
  122. package/dist/src/relationship/plugins/Relationship.d.ts +0 -0
  123. package/src/base/BaseGroupArea.ts +0 -0
  124. package/src/multiValue/plugins/ScatterAxes.ts +0 -0
  125. package/src/relationship/plugins/Relationship.ts +0 -0
  126. /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
  127. /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
  128. /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
  129. /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
  130. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  131. /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
  132. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  133. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
  134. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  135. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  136. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  137. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
  138. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
  139. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  140. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  141. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  142. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  143. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  144. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
  145. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  146. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  147. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  148. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  149. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
  150. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  151. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  152. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  153. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  154. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  155. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
  156. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
  157. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  158. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
  159. /package/dist/{src/base/BaseGroupArea.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts} +0 -0
  160. /package/dist/{src/multiValue/index.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts} +0 -0
  161. /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
  162. /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
  163. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  164. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  165. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
  166. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  167. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
  168. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
  169. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  170. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
  171. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  172. /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
  173. /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
  174. /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
  175. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  176. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  177. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
  178. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  179. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
  180. /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
  181. /package/src/{grid → multiValue}/plugins/RankingAxis.ts +0 -0
@@ -17,22 +17,22 @@ 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
- import type { BaseBarStackParams } from '../../lib/plugins-basic-types'
23
+ import type { BaseStackedBarParams } from '../../lib/plugins-basic-types'
24
24
  import { getD3TransitionEase } from '../utils/d3Utils'
25
25
  import { getClassName, getUniID } from '../utils/orbchartsUtils'
26
26
  import { gridSelectionsObservable } from '../grid/gridObservables'
27
27
  import { shareReplay } from 'rxjs/operators'
28
28
 
29
- // export interface BaseBarStackParams {
29
+ // export interface BaseStackedBarParams {
30
30
  // barWidth: number
31
31
  // barGroupPadding: number
32
32
  // barRadius: number | boolean
33
33
  // }
34
34
 
35
- interface BaseBarStackContext {
35
+ interface BaseStackedBarContext {
36
36
  selection: d3.Selection<any, unknown, any, unknown>
37
37
  computedData$: Observable<ComputedDataGrid>
38
38
  computedLayoutData$: Observable<ComputedLayoutDataGrid>
@@ -41,7 +41,7 @@ interface BaseBarStackContext {
41
41
  seriesLabels$: Observable<string[]>
42
42
  SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
43
43
  GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
44
- fullParams$: Observable<BaseBarStackParams>
44
+ fullParams$: Observable<BaseStackedBarParams>
45
45
  fullDataFormatter$: Observable<DataFormatterGrid>
46
46
  fullChartParams$: Observable<ChartParams>
47
47
  gridAxesTransform$: Observable<TransformData>
@@ -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
  }
@@ -70,7 +70,7 @@ interface RenderBarParams {
70
70
  zeroY: number
71
71
  groupLabels: string[]
72
72
  // barScale: d3.ScalePoint<string>
73
- params: BaseBarStackParams
73
+ params: BaseStackedBarParams
74
74
  chartParams: ChartParams
75
75
  barWidth: number
76
76
  transformedBarRadius: [number, number][]
@@ -87,7 +87,7 @@ type ClipPathDatum = {
87
87
  height: number;
88
88
  }
89
89
 
90
- // const pluginName = 'BarStack'
90
+ // const pluginName = 'StackedBar'
91
91
  // const rectClassName = getClassName(pluginName, 'rect')
92
92
  // group的delay在動畫中的佔比(剩餘部份的時間為圖形本身的動畫時間,因為delay時間和最後一個group的動畫時間加總為1)
93
93
  const groupDelayProportionOfDuration = 0.3
@@ -97,13 +97,15 @@ function calcBarWidth ({ axisWidth, groupAmount, barGroupPadding = 0 }: {
97
97
  groupAmount: number
98
98
  barGroupPadding: number
99
99
  }) {
100
- const eachGroupWidth = axisWidth / (groupAmount - 1)
100
+ const eachGroupWidth = groupAmount > 1 // 等於 1 時會算出 Infinity
101
+ ? axisWidth / (groupAmount - 1) // -1是因為要扣掉兩側的padding
102
+ : axisWidth
101
103
  const width = eachGroupWidth - barGroupPadding
102
104
  return width > 1 ? width : 1
103
105
 
104
106
  }
105
107
 
106
- // function makeBarScale (barWidth: number, seriesLabels: string[], params: BarStackParams) {
108
+ // function makeBarScale (barWidth: number, seriesLabels: string[], params: StackedBarParams) {
107
109
  // const barHalfWidth = barWidth! / 2
108
110
  // const barGroupWidth = barWidth * seriesLabels.length + params.barPadding! * seriesLabels.length
109
111
  // return d3.scalePoint()
@@ -143,7 +145,7 @@ function renderRectBars ({ graphicGSelection, rectClassName, barData, zeroY, gro
143
145
  .append('rect')
144
146
  .classed(rectClassName, true)
145
147
  .attr('cursor', 'pointer')
146
- .attr('height', d => 0)
148
+ .attr('height', d => 1)
147
149
  },
148
150
  update => update,
149
151
  exit => exit.remove()
@@ -160,7 +162,7 @@ function renderRectBars ({ graphicGSelection, rectClassName, barData, zeroY, gro
160
162
  .ease(getD3TransitionEase(chartParams.transitionEase))
161
163
  .delay((d, i) => d.groupIndex * delayGroup)
162
164
  .attr('y', d => d._barStartY)
163
- .attr('height', d => Math.abs(d._barHeight))
165
+ .attr('height', d => Math.abs(d._barHeight) || 1) // 無值還是給一個 1 的高度
164
166
  })
165
167
 
166
168
  // const barGroup = graphicGSelection
@@ -290,7 +292,7 @@ function highlight ({ selection, ids, fullChartParams }: {
290
292
  }
291
293
 
292
294
 
293
- export const createBaseBarStack: BasePluginFn<BaseBarStackContext> = (pluginName: string, {
295
+ export const createBaseStackedBar: BasePluginFn<BaseStackedBarContext> = (pluginName: string, {
294
296
  selection,
295
297
  computedData$,
296
298
  computedLayoutData$,
@@ -486,13 +488,13 @@ export const createBaseBarStack: BasePluginFn<BaseBarStackContext> = (pluginName
486
488
  map(data => {
487
489
  const groupMin = 0
488
490
  const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
489
- // const groupScaleDomainMin = data.dataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
490
- // ? groupMin // - data.dataFormatter.grid.groupAxis.scalePadding
491
- // : data.dataFormatter.grid.groupAxis.scaleDomain[0] as number // - data.dataFormatter.grid.groupAxis.scalePadding
492
- const groupScaleDomainMin = data.dataFormatter.grid.groupAxis.scaleDomain[0]
493
- const groupScaleDomainMax = data.dataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
494
- ? groupMax // + data.dataFormatter.grid.groupAxis.scalePadding
495
- : data.dataFormatter.grid.groupAxis.scaleDomain[1] as number // + data.dataFormatter.grid.groupAxis.scalePadding
491
+ // const groupScaleDomainMin = data.dataFormatter.groupAxis.scaleDomain[0] === 'auto'
492
+ // ? groupMin // - data.dataFormatter.groupAxis.scalePadding
493
+ // : data.dataFormatter.groupAxis.scaleDomain[0] as number // - data.dataFormatter.groupAxis.scalePadding
494
+ const groupScaleDomainMin = data.dataFormatter.groupAxis.scaleDomain[0]
495
+ const groupScaleDomainMax = data.dataFormatter.groupAxis.scaleDomain[1] === 'max'
496
+ ? groupMax // + data.dataFormatter.groupAxis.scalePadding
497
+ : data.dataFormatter.groupAxis.scaleDomain[1] as number // + data.dataFormatter.groupAxis.scalePadding
496
498
 
497
499
  return [groupScaleDomainMin, groupScaleDomainMax]
498
500
  })
@@ -23,7 +23,7 @@ import type { BasePluginFn } from './types'
23
23
  import { defineNoneDataPlugin, textSizePxObservable } from '../../lib/core'
24
24
  import { getSvgGElementSize, appendSvg } from '../utils/d3Utils'
25
25
  import { getColor, getClassName } from '../utils/orbchartsUtils'
26
-
26
+ import { measureTextWidth } from '../utils/commonUtils'
27
27
 
28
28
  interface BaseTooltipContext {
29
29
  rootSelection: d3.Selection<any, unknown, any, unknown>
@@ -259,7 +259,7 @@ export const createBaseTooltip: BasePluginFn<BaseTooltipContext> = (pluginName:
259
259
  textSize: data.fullChartParams.styles.textSize,
260
260
  textSizePx: data.textSizePx,
261
261
  textColor: getColor(data.fullParams.textColorType, data.fullChartParams),
262
- seriesColors: data.fullChartParams.colors[data.fullChartParams.colorScheme].series
262
+ seriesColors: data.fullChartParams.colors[data.fullChartParams.colorScheme].label
263
263
  }
264
264
  })
265
265
  )
@@ -287,6 +287,9 @@ export const createBaseTooltip: BasePluginFn<BaseTooltipContext> = (pluginName:
287
287
  eventData,
288
288
  // context
289
289
  {
290
+ utils: {
291
+ measureTextWidth
292
+ },
290
293
  styles: data.tooltipStyle
291
294
  }
292
295
  )
@@ -8,21 +8,21 @@ 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
22
22
  } from '../../lib/core-types'
23
23
  import type { BaseValueAxisParams } from '../../lib/plugins-basic-types'
24
24
  import { parseTickFormatValue } from '../utils/d3Utils'
25
- import { getColor, getMinAndMaxValue, getClassName, getUniID } from '../utils/orbchartsUtils'
25
+ import { getColor, getMinMaxValue, getClassName, getUniID } from '../utils/orbchartsUtils'
26
26
 
27
27
  // export interface BaseValueAxisParams {
28
28
  // labelOffset: [number, number]
@@ -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
 
@@ -82,35 +83,35 @@ function renderAxisLabel ({ selection, textClassName, fullParams, axisLabelAlign
82
83
  const offsetY = fullParams.tickPadding + fullParams.labelOffset[1]
83
84
  let labelX = 0
84
85
  let labelY = 0
85
- if (fullDataFormatter.grid.groupAxis.position === 'bottom') {
86
+ if (fullDataFormatter.groupAxis.position === 'bottom') {
86
87
  // labelY = - gridAxesSize.height - offsetY
87
88
  labelY = - offsetY
88
- if (fullDataFormatter.grid.valueAxis.position === 'left') {
89
+ if (fullDataFormatter.valueAxis.position === 'left') {
89
90
  labelX = - offsetX
90
- } else if (fullDataFormatter.grid.valueAxis.position === 'right') {
91
+ } else if (fullDataFormatter.valueAxis.position === 'right') {
91
92
  labelX = offsetX
92
93
  }
93
- } else if (fullDataFormatter.grid.groupAxis.position === 'top') {
94
+ } else if (fullDataFormatter.groupAxis.position === 'top') {
94
95
  // labelY = gridAxesSize.height + offsetY
95
96
  labelY = offsetY
96
- if (fullDataFormatter.grid.valueAxis.position === 'left') {
97
+ if (fullDataFormatter.valueAxis.position === 'left') {
97
98
  labelX = - offsetX
98
- } else if (fullDataFormatter.grid.valueAxis.position === 'right') {
99
+ } else if (fullDataFormatter.valueAxis.position === 'right') {
99
100
  labelX = offsetX
100
101
  }
101
- } else if (fullDataFormatter.grid.groupAxis.position === 'left') {
102
+ } else if (fullDataFormatter.groupAxis.position === 'left') {
102
103
  // labelX = gridAxesSize.width + offsetX
103
104
  labelX = offsetX
104
- if (fullDataFormatter.grid.valueAxis.position === 'bottom') {
105
+ if (fullDataFormatter.valueAxis.position === 'bottom') {
105
106
  labelY = offsetY
106
- } else if (fullDataFormatter.grid.valueAxis.position === 'top') {
107
+ } else if (fullDataFormatter.valueAxis.position === 'top') {
107
108
  labelY = - offsetY
108
109
  }
109
- } else if (fullDataFormatter.grid.groupAxis.position === 'right') {
110
+ } else if (fullDataFormatter.groupAxis.position === 'right') {
110
111
  labelX = - offsetX
111
- if (fullDataFormatter.grid.valueAxis.position === 'bottom') {
112
+ if (fullDataFormatter.valueAxis.position === 'bottom') {
112
113
  labelY = offsetY
113
- } else if (fullDataFormatter.grid.valueAxis.position === 'top') {
114
+ } else if (fullDataFormatter.valueAxis.position === 'top') {
114
115
  labelY = - offsetY
115
116
  }
116
117
  }
@@ -141,7 +142,7 @@ function renderAxisLabel ({ selection, textClassName, fullParams, axisLabelAlign
141
142
  // 偏移使用 x, y 而非 transform 才不會受到外層 scale 變形影響
142
143
  .attr('x', labelX)
143
144
  .attr('y', labelY)
144
- .text(d => fullDataFormatter.grid.valueAxis.label)
145
+ .text(d => fullDataFormatter.valueAxis.label)
145
146
  })
146
147
  .attr('transform', d => `translate(0, ${gridAxesSize.height})`)
147
148
  // .attr('transform', d => `translate(${- fullParams.tickPadding + fullParams.labelOffset[0]}, ${gridAxesSize.height + fullParams.tickPadding + fullParams.labelOffset[1]})`)
@@ -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,8 +169,6 @@ 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
-
173
172
  // const _valueScale = d3.scaleLinear()
174
173
  // .domain([0, 150])
175
174
  // .range([416.5, 791.349])
@@ -177,16 +176,16 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
177
176
  // 刻度文字偏移
178
177
  let tickPadding = 0
179
178
  let textY = 0
180
- if (fullDataFormatter.grid.valueAxis.position === 'left') {
179
+ if (fullDataFormatter.valueAxis.position === 'left') {
181
180
  tickPadding = fullParams.tickPadding
182
181
  textY = 0
183
- } else if (fullDataFormatter.grid.valueAxis.position === 'right') {
182
+ } else if (fullDataFormatter.valueAxis.position === 'right') {
184
183
  tickPadding = - fullParams.tickPadding
185
184
  textY = 0
186
- } else if (fullDataFormatter.grid.valueAxis.position === 'bottom') {
185
+ } else if (fullDataFormatter.valueAxis.position === 'bottom') {
187
186
  tickPadding = 0
188
187
  textY = fullParams.tickPadding
189
- } else if (fullDataFormatter.grid.valueAxis.position === 'top') {
188
+ } else if (fullDataFormatter.valueAxis.position === 'top') {
190
189
  tickPadding = 0
191
190
  textY = - fullParams.tickPadding
192
191
  }
@@ -194,11 +193,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
194
193
  // 設定Y軸刻度
195
194
  const yAxis = d3.axisLeft(valueScale)
196
195
  .scale(valueScale)
197
- .ticks(valueLength > fullParams.ticks
198
- ? fullParams.ticks
199
- : ((minAndMax[0] === 0 && minAndMax[1] === 0)
200
- ? 1
201
- : Math.ceil(valueLength))) // 刻度分段數量
196
+ .ticks(fullParams.ticks) // 刻度分段數量
202
197
  .tickFormat(d => parseTickFormatValue(d, fullParams.tickFormat))
203
198
  .tickSize(fullParams.tickFullLine == true
204
199
  ? -gridAxesSize.width
@@ -231,10 +226,11 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
231
226
  .attr('dominant-baseline', tickTextAlign.dominantBaseline)
232
227
  // .attr('dy', 0)
233
228
  .attr('y', textY)
229
+ .attr('dy', 0)
234
230
  yText.style('transform', textReverseTransformWithRotate)
235
231
 
236
232
  // 抵消掉預設的偏移
237
- if (fullDataFormatter.grid.valueAxis.position === 'bottom' || fullDataFormatter.grid.valueAxis.position === 'top') {
233
+ if (fullDataFormatter.valueAxis.position === 'bottom' || fullDataFormatter.valueAxis.position === 'top') {
238
234
  yText.attr('dy', 0)
239
235
  }
240
236
 
@@ -246,6 +242,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
246
242
  export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName: string, {
247
243
  selection,
248
244
  computedData$,
245
+ filteredMinMaxValue$,
249
246
  fullParams$,
250
247
  fullDataFormatter$,
251
248
  fullChartParams$,
@@ -410,55 +407,61 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
410
407
  })
411
408
  )
412
409
 
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
410
+ // const minMax$: Observable<[number, number]> = new Observable(subscriber => {
411
+ // combineLatest({
412
+ // fullDataFormatter: fullDataFormatter$,
413
+ // computedData: computedData$
414
+ // }).pipe(
415
+ // takeUntil(destroy$),
416
+ // switchMap(async (d) => d),
417
+ // ).subscribe(data => {
418
+ // const groupMin = 0
419
+ // const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
420
+ // // const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
421
+ // // ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
422
+ // // : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
423
+ // const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] - data.fullDataFormatter.groupAxis.scalePadding
424
+ // const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'max'
425
+ // ? groupMax + data.fullDataFormatter.groupAxis.scalePadding
426
+ // : data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
431
427
 
432
- const filteredData = data.computedData.map((d, i) => {
433
- return d.filter((_d, _i) => {
434
- return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
435
- })
436
- })
428
+ // const filteredData = data.computedData.map((d, i) => {
429
+ // return d.filter((_d, _i) => {
430
+ // return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
431
+ // })
432
+ // })
437
433
 
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
- })
434
+ // const filteredMinMax = getMinMaxValue(filteredData.flat())
435
+ // if (filteredMinMax[0] === filteredMinMax[1]) {
436
+ // filteredMinMax[0] = filteredMinMax[1] - 1 // 避免最大及最小值相同造成無法計算scale
437
+ // }
438
+ // subscriber.next(filteredMinMax)
439
+ // })
440
+ // })
445
441
 
446
442
  const valueScale$: Observable<d3.ScaleLinear<number, number>> = new Observable(subscriber => {
447
443
  combineLatest({
448
444
  fullDataFormatter: fullDataFormatter$,
449
445
  gridAxesSize: gridAxesSize$,
450
- minAndMax: minAndMax$
446
+ // minMax: minMax$
447
+ filteredMinMaxValue: filteredMinMaxValue$
451
448
  }).pipe(
452
449
  takeUntil(destroy$),
453
450
  switchMap(async (d) => d),
454
451
  ).subscribe(data => {
452
+ let maxValue = data.filteredMinMaxValue[1]
453
+ let minValue = data.filteredMinMaxValue[0]
454
+ if (maxValue === minValue && maxValue === 0) {
455
+ // 避免最大及最小值同等於 0 造成無法計算scale
456
+ maxValue = 1
457
+ }
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,
461
+ minValue,
459
462
  axisWidth: data.gridAxesSize.height,
460
- scaleDomain: data.fullDataFormatter.grid.valueAxis.scaleDomain,
461
- scaleRange: data.fullDataFormatter.grid.valueAxis.scaleRange
463
+ scaleDomain: data.fullDataFormatter.valueAxis.scaleDomain,
464
+ scaleRange: data.fullDataFormatter.valueAxis.scaleRange
462
465
  })
463
466
 
464
467
  subscriber.next(valueScale)
@@ -475,18 +478,18 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
475
478
  let textAnchor: 'start' | 'middle' | 'end' = 'start'
476
479
  let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
477
480
 
478
- if (data.fullDataFormatter.grid.valueAxis.position === 'left') {
481
+ if (data.fullDataFormatter.valueAxis.position === 'left') {
479
482
  textAnchor = 'end'
480
483
  dominantBaseline = 'middle'
481
- } else if (data.fullDataFormatter.grid.valueAxis.position === 'right') {
484
+ } else if (data.fullDataFormatter.valueAxis.position === 'right') {
482
485
  textAnchor = 'start'
483
486
  dominantBaseline = 'middle'
484
- } else if (data.fullDataFormatter.grid.valueAxis.position === 'bottom') {
487
+ } else if (data.fullDataFormatter.valueAxis.position === 'bottom') {
485
488
  textAnchor = data.fullParams.tickTextRotate
486
489
  ? 'end'
487
490
  : 'middle'
488
491
  dominantBaseline = 'hanging'
489
- } else if (data.fullDataFormatter.grid.valueAxis.position === 'top') {
492
+ } else if (data.fullDataFormatter.valueAxis.position === 'top') {
490
493
  textAnchor = data.fullParams.tickTextRotate
491
494
  ? 'start'
492
495
  : 'middle'
@@ -505,22 +508,22 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
505
508
  let textAnchor: 'start' | 'middle' | 'end' = 'start'
506
509
  let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
507
510
 
508
- if (d.grid.groupAxis.position === 'bottom') {
511
+ if (d.groupAxis.position === 'bottom') {
509
512
  dominantBaseline = 'auto'
510
- } else if (d.grid.groupAxis.position === 'top') {
513
+ } else if (d.groupAxis.position === 'top') {
511
514
  dominantBaseline = 'hanging'
512
- } else if (d.grid.groupAxis.position === 'left') {
515
+ } else if (d.groupAxis.position === 'left') {
513
516
  textAnchor = 'start'
514
- } else if (d.grid.groupAxis.position === 'right') {
517
+ } else if (d.groupAxis.position === 'right') {
515
518
  textAnchor = 'end'
516
519
  }
517
- if (d.grid.valueAxis.position === 'left') {
520
+ if (d.valueAxis.position === 'left') {
518
521
  textAnchor = 'end'
519
- } else if (d.grid.valueAxis.position === 'right') {
522
+ } else if (d.valueAxis.position === 'right') {
520
523
  textAnchor = 'start'
521
- } else if (d.grid.valueAxis.position === 'bottom') {
524
+ } else if (d.valueAxis.position === 'bottom') {
522
525
  dominantBaseline = 'hanging'
523
- } else if (d.grid.valueAxis.position === 'top') {
526
+ } else if (d.valueAxis.position === 'top') {
524
527
  dominantBaseline = 'auto'
525
528
  }
526
529
  return {
@@ -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({
@@ -4,16 +4,16 @@ import type {
4
4
  GroupAuxParams,
5
5
  DotsParams,
6
6
  BarsParams,
7
- BarStackParams,
7
+ StackedBarParams,
8
8
  BarsTriangleParams,
9
9
  GroupAxisParams,
10
10
  ValueAxisParams,
11
- ValueStackAxisParams,
11
+ StackedValueAxisParams,
12
12
  GridTooltipParams,
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',
@@ -28,13 +28,13 @@ export const DEFAULT_LINE_AREAS_PARAMS: LineAreasParams = {
28
28
  export const DEFAULT_DOTS_PARAMS: DotsParams = {
29
29
  radius: 4,
30
30
  fillColorType: 'white',
31
- strokeColorType: 'series',
31
+ strokeColorType: 'label',
32
32
  strokeWidth: 2,
33
33
  // strokeWidthWhileHighlight: 3,
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',
@@ -59,7 +59,7 @@ export const DEFAULT_BARS_DIVERGING_PARAMS: BarsParams = {
59
59
  ...DEFAULT_BARS_PARAMS
60
60
  }
61
61
 
62
- export const DEFAULT_BAR_STACK_PARAMS: BarStackParams = {
62
+ export const DEFAULT_STACKED_BAR_PARAMS: StackedBarParams = {
63
63
  barWidth: 0,
64
64
  barGroupPadding: 10,
65
65
  barRadius: false,
@@ -97,7 +97,8 @@ export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
97
97
  axisLineVisible: false,
98
98
  axisLineColorType: 'primary',
99
99
  ticks: null,
100
- tickFormat: ',.0f',
100
+ // tickFormat: ',.0f',
101
+ tickFormat: v => v,
101
102
  tickLineVisible: true,
102
103
  tickPadding: 20,
103
104
  tickFullLine: true,
@@ -106,8 +107,9 @@ export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
106
107
  tickTextRotate: 0,
107
108
  tickTextColorType: 'primary'
108
109
  }
110
+ DEFAULT_VALUE_AXIS_PARAMS.tickFormat.toString = () => 'v => v'
109
111
 
110
- export const DEFAULT_VALUE_STACK_AXIS_PARAMS: ValueStackAxisParams = {
112
+ export const DEFAULT_STACKED_VALUE_AXIS_PARAMS: StackedValueAxisParams = {
111
113
  ...DEFAULT_VALUE_AXIS_PARAMS
112
114
  }
113
115
 
@@ -188,7 +190,7 @@ export const DEFAULT_GRID_TOOLTIP_PARAMS: GridTooltipParams = {
188
190
  // </g>`
189
191
  // }
190
192
  // },
191
- renderFn: (eventData, { styles }) => {
193
+ renderFn: (eventData, { styles, utils }) => {
192
194
  const bulletWidth = styles.textSizePx * 0.7
193
195
  const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
194
196
 
@@ -197,7 +199,7 @@ export const DEFAULT_GRID_TOOLTIP_PARAMS: GridTooltipParams = {
197
199
  const text = `${group.seriesLabel}${group.value}`
198
200
  return text.length > acc.length ? text : acc
199
201
  }, '')
200
- const maxTextWidth = measureTextWidth(maxLengthText, styles.textSizePx)
202
+ const maxTextWidth = utils.measureTextWidth(maxLengthText, styles.textSizePx)
201
203
  const lineEndX = maxTextWidth + styles.textSizePx * 2
202
204
  const contentSvg = eventData.groups
203
205
  .map((group, i) => {
@@ -216,7 +218,7 @@ export const DEFAULT_GRID_TOOLTIP_PARAMS: GridTooltipParams = {
216
218
  ${contentSvg}`
217
219
  }
218
220
  }
219
- DEFAULT_GRID_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles }) => {
221
+ DEFAULT_GRID_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles, utils }) => {
220
222
  const bulletWidth = styles.textSizePx * 0.7
221
223
  const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
222
224
 
@@ -225,7 +227,7 @@ DEFAULT_GRID_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles }) =
225
227
  const text = \`\${group.seriesLabel}\${group.value}\`
226
228
  return text.length > acc.length ? text : acc
227
229
  }, '')
228
- const maxTextWidth = measureTextWidth(maxLengthText, styles.textSizePx)
230
+ const maxTextWidth = utils.measureTextWidth(maxLengthText, styles.textSizePx)
229
231
  const lineEndX = maxTextWidth + styles.textSizePx * 2
230
232
  const contentSvg = eventData.groups
231
233
  .map((group, i) => {