@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.
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
- package/dist/{src/base/BaseBarStack.d.ts → orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts} +6 -6
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
- package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +4 -4
- package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
- package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +2 -2
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/index.d.ts +7 -0
- package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +4 -4
- package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +3 -3
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/defaults.d.ts +6 -0
- package/dist/orbcharts-plugins-basic/src/relationship/index.d.ts +5 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/relationshipObservables.d.ts +1 -0
- package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
- package/dist/orbcharts-plugins-basic.es.js +13327 -10361
- package/dist/orbcharts-plugins-basic.umd.js +99 -49
- package/dist/src/index.d.ts +1 -5
- package/package.json +4 -4
- package/src/base/BaseBars.ts +5 -5
- package/src/base/BaseBarsTriangle.ts +6 -4
- package/src/base/BaseDots.ts +3 -54
- package/src/base/BaseGroupAxis.ts +50 -50
- package/src/base/BaseLegend.ts +25 -21
- package/src/base/BaseLineAreas.ts +4 -4
- package/src/base/BaseLines.ts +3 -3
- package/src/base/{BaseBarStack.ts → BaseStackedBar.ts} +22 -20
- package/src/base/BaseTooltip.ts +5 -2
- package/src/base/BaseValueAxis.ts +84 -81
- package/src/grid/defaults.ts +15 -13
- package/src/grid/gridObservables.ts +56 -47
- package/src/grid/index.ts +2 -2
- package/src/grid/plugins/GridLegend.ts +2 -2
- package/src/grid/plugins/GridZoom.ts +20 -20
- package/src/grid/plugins/GroupAux.ts +216 -211
- package/src/grid/plugins/{BarStack.ts → StackedBar.ts} +7 -7
- package/src/grid/plugins/{ValueStackAxis.ts → StackedValueAxis.ts} +6 -5
- package/src/grid/plugins/ValueAxis.ts +1 -0
- package/src/index.ts +2 -5
- package/src/multiGrid/defaults.ts +11 -11
- package/src/multiGrid/index.ts +3 -3
- package/src/multiGrid/plugins/MultiBars.ts +1 -1
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
- package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
- package/src/multiGrid/plugins/MultiGroupAxis.ts +1 -1
- package/src/multiGrid/plugins/{MultiBarStack.ts → MultiStackedBar.ts} +8 -8
- package/src/multiGrid/plugins/{MultiValueStackAxis.ts → MultiStackedValueAxis.ts} +4 -3
- package/src/multiGrid/plugins/MultiValueAxis.ts +2 -1
- package/src/multiGrid/plugins/{OverlappingValueStackAxes.ts → OverlappingStackedValueAxes.ts} +9 -8
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +4 -3
- package/src/multiValue/defaults.ts +167 -0
- package/src/multiValue/index.ts +9 -0
- package/src/multiValue/multiValueObservables.ts +297 -0
- package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
- package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
- package/src/multiValue/plugins/Scatter.ts +426 -0
- package/src/multiValue/plugins/ScatterBubbles.ts +554 -0
- package/src/multiValue/plugins/XYAux.ts +682 -0
- package/src/multiValue/plugins/XYAxes.ts +685 -0
- package/src/multiValue/plugins/XYZoom.ts +300 -0
- package/src/noneData/plugins/Container.ts +23 -23
- package/src/noneData/plugins/Tooltip.ts +365 -365
- package/src/relationship/defaults.ts +197 -0
- package/src/relationship/index.ts +5 -0
- package/src/relationship/plugins/ForceDirected.ts +1169 -0
- package/src/relationship/plugins/ForceDirectedBubbles.ts +1394 -0
- package/src/relationship/plugins/RelationshipLegend.ts +100 -0
- package/src/relationship/plugins/RelationshipTooltip.ts +66 -0
- package/src/relationship/relationshipObservables.ts +50 -0
- package/src/series/defaults.ts +13 -12
- package/src/series/plugins/Bubbles.ts +22 -22
- package/src/series/plugins/Pie.ts +2 -2
- package/src/series/plugins/PieEventTexts.ts +22 -21
- package/src/series/plugins/PieLabels.ts +2 -2
- package/src/series/plugins/Rose.ts +2 -2
- package/src/series/plugins/RoseLabels.ts +2 -2
- package/src/series/plugins/SeriesLegend.ts +4 -4
- package/src/series/seriesObservables.ts +3 -3
- package/src/tree/defaults.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +3 -10
- package/src/utils/commonUtils.ts +5 -5
- package/src/utils/d3Utils.ts +4 -3
- package/src/utils/observables.ts +2 -2
- package/src/utils/orbchartsUtils.ts +28 -12
- package/dist/src/grid/plugins/BarStack.d.ts +0 -1
- package/dist/src/grid/plugins/ValueStackAxis.d.ts +0 -1
- package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +0 -1
- package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -1
- package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -1
- package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
- package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
- package/dist/src/noneData/plugins/Container.d.ts +0 -1
- package/dist/src/noneData/plugins/Tooltip.d.ts +0 -3
- package/dist/src/relationship/index.d.ts +0 -0
- package/dist/src/relationship/plugins/Relationship.d.ts +0 -0
- package/src/base/BaseGroupArea.ts +0 -0
- package/src/multiValue/plugins/ScatterAxes.ts +0 -0
- package/src/relationship/plugins/Relationship.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
- /package/dist/{src/base/BaseGroupArea.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts} +0 -0
- /package/dist/{src/multiValue/index.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts} +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
- /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
- /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
- /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
|
-
|
20
|
+
ContainerPositionScaled,
|
21
21
|
Layout,
|
22
22
|
TransformData } from '../../lib/core-types'
|
23
|
-
import type {
|
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
|
29
|
+
// export interface BaseStackedBarParams {
|
30
30
|
// barWidth: number
|
31
31
|
// barGroupPadding: number
|
32
32
|
// barRadius: number | boolean
|
33
33
|
// }
|
34
34
|
|
35
|
-
interface
|
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<
|
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<
|
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:
|
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 = '
|
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 =
|
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:
|
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 =>
|
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
|
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.
|
490
|
-
// ? groupMin // - data.dataFormatter.
|
491
|
-
// : data.dataFormatter.
|
492
|
-
const groupScaleDomainMin = data.dataFormatter.
|
493
|
-
const groupScaleDomainMax = data.dataFormatter.
|
494
|
-
? groupMax // + data.dataFormatter.
|
495
|
-
: data.dataFormatter.
|
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
|
})
|
package/src/base/BaseTooltip.ts
CHANGED
@@ -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].
|
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 {
|
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
|
-
|
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,
|
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<
|
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.
|
86
|
+
if (fullDataFormatter.groupAxis.position === 'bottom') {
|
86
87
|
// labelY = - gridAxesSize.height - offsetY
|
87
88
|
labelY = - offsetY
|
88
|
-
if (fullDataFormatter.
|
89
|
+
if (fullDataFormatter.valueAxis.position === 'left') {
|
89
90
|
labelX = - offsetX
|
90
|
-
} else if (fullDataFormatter.
|
91
|
+
} else if (fullDataFormatter.valueAxis.position === 'right') {
|
91
92
|
labelX = offsetX
|
92
93
|
}
|
93
|
-
} else if (fullDataFormatter.
|
94
|
+
} else if (fullDataFormatter.groupAxis.position === 'top') {
|
94
95
|
// labelY = gridAxesSize.height + offsetY
|
95
96
|
labelY = offsetY
|
96
|
-
if (fullDataFormatter.
|
97
|
+
if (fullDataFormatter.valueAxis.position === 'left') {
|
97
98
|
labelX = - offsetX
|
98
|
-
} else if (fullDataFormatter.
|
99
|
+
} else if (fullDataFormatter.valueAxis.position === 'right') {
|
99
100
|
labelX = offsetX
|
100
101
|
}
|
101
|
-
} else if (fullDataFormatter.
|
102
|
+
} else if (fullDataFormatter.groupAxis.position === 'left') {
|
102
103
|
// labelX = gridAxesSize.width + offsetX
|
103
104
|
labelX = offsetX
|
104
|
-
if (fullDataFormatter.
|
105
|
+
if (fullDataFormatter.valueAxis.position === 'bottom') {
|
105
106
|
labelY = offsetY
|
106
|
-
} else if (fullDataFormatter.
|
107
|
+
} else if (fullDataFormatter.valueAxis.position === 'top') {
|
107
108
|
labelY = - offsetY
|
108
109
|
}
|
109
|
-
} else if (fullDataFormatter.
|
110
|
+
} else if (fullDataFormatter.groupAxis.position === 'right') {
|
110
111
|
labelX = - offsetX
|
111
|
-
if (fullDataFormatter.
|
112
|
+
if (fullDataFormatter.valueAxis.position === 'bottom') {
|
112
113
|
labelY = offsetY
|
113
|
-
} else if (fullDataFormatter.
|
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.
|
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,
|
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
|
-
|
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.
|
179
|
+
if (fullDataFormatter.valueAxis.position === 'left') {
|
181
180
|
tickPadding = fullParams.tickPadding
|
182
181
|
textY = 0
|
183
|
-
} else if (fullDataFormatter.
|
182
|
+
} else if (fullDataFormatter.valueAxis.position === 'right') {
|
184
183
|
tickPadding = - fullParams.tickPadding
|
185
184
|
textY = 0
|
186
|
-
} else if (fullDataFormatter.
|
185
|
+
} else if (fullDataFormatter.valueAxis.position === 'bottom') {
|
187
186
|
tickPadding = 0
|
188
187
|
textY = fullParams.tickPadding
|
189
|
-
} else if (fullDataFormatter.
|
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(
|
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.
|
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
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
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
|
-
|
433
|
-
|
434
|
-
|
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
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
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
|
-
|
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> =
|
457
|
-
maxValue
|
458
|
-
minValue
|
459
|
+
const valueScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
|
460
|
+
maxValue,
|
461
|
+
minValue,
|
459
462
|
axisWidth: data.gridAxesSize.height,
|
460
|
-
scaleDomain: data.fullDataFormatter.
|
461
|
-
scaleRange: data.fullDataFormatter.
|
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.
|
481
|
+
if (data.fullDataFormatter.valueAxis.position === 'left') {
|
479
482
|
textAnchor = 'end'
|
480
483
|
dominantBaseline = 'middle'
|
481
|
-
} else if (data.fullDataFormatter.
|
484
|
+
} else if (data.fullDataFormatter.valueAxis.position === 'right') {
|
482
485
|
textAnchor = 'start'
|
483
486
|
dominantBaseline = 'middle'
|
484
|
-
} else if (data.fullDataFormatter.
|
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.
|
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.
|
511
|
+
if (d.groupAxis.position === 'bottom') {
|
509
512
|
dominantBaseline = 'auto'
|
510
|
-
} else if (d.
|
513
|
+
} else if (d.groupAxis.position === 'top') {
|
511
514
|
dominantBaseline = 'hanging'
|
512
|
-
} else if (d.
|
515
|
+
} else if (d.groupAxis.position === 'left') {
|
513
516
|
textAnchor = 'start'
|
514
|
-
} else if (d.
|
517
|
+
} else if (d.groupAxis.position === 'right') {
|
515
518
|
textAnchor = 'end'
|
516
519
|
}
|
517
|
-
if (d.
|
520
|
+
if (d.valueAxis.position === 'left') {
|
518
521
|
textAnchor = 'end'
|
519
|
-
} else if (d.
|
522
|
+
} else if (d.valueAxis.position === 'right') {
|
520
523
|
textAnchor = 'start'
|
521
|
-
} else if (d.
|
524
|
+
} else if (d.valueAxis.position === 'bottom') {
|
522
525
|
dominantBaseline = 'hanging'
|
523
|
-
} else if (d.
|
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
|
-
|
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
|
-
|
565
|
+
filteredMinMaxValue: data.filteredMinMaxValue
|
563
566
|
})
|
564
567
|
|
565
568
|
renderAxisLabel({
|
package/src/grid/defaults.ts
CHANGED
@@ -4,16 +4,16 @@ import type {
|
|
4
4
|
GroupAuxParams,
|
5
5
|
DotsParams,
|
6
6
|
BarsParams,
|
7
|
-
|
7
|
+
StackedBarParams,
|
8
8
|
BarsTriangleParams,
|
9
9
|
GroupAxisParams,
|
10
10
|
ValueAxisParams,
|
11
|
-
|
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: '
|
31
|
+
strokeColorType: 'label',
|
32
32
|
strokeWidth: 2,
|
33
33
|
// strokeWidthWhileHighlight: 3,
|
34
34
|
onlyShowHighlighted: false
|
35
35
|
}
|
36
36
|
|
37
|
-
export const
|
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
|
-
|
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
|
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
|
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) => {
|