@orbcharts/plugins-basic 3.0.0-alpha.27 → 3.0.0-alpha.29
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-plugins-basic.es.js +2 -2
- package/dist/orbcharts-plugins-basic.umd.js +1 -1
- package/dist/src/grid/defaults.d.ts +8 -8
- package/dist/src/grid/plugins/BarStack.d.ts +2 -2
- package/dist/src/grid/plugins/Bars.d.ts +2 -2
- package/dist/src/grid/plugins/BarsTriangle.d.ts +2 -2
- package/dist/src/grid/plugins/Dots.d.ts +2 -2
- package/dist/src/grid/plugins/GroupArea.d.ts +2 -2
- package/dist/src/grid/plugins/GroupAxis.d.ts +2 -2
- package/dist/src/grid/plugins/Lines.d.ts +2 -2
- package/dist/src/grid/types.d.ts +7 -7
- package/dist/src/series/defaults.d.ts +5 -5
- package/dist/src/series/plugins/Bubbles.d.ts +2 -2
- package/dist/src/series/plugins/Pie.d.ts +2 -2
- package/dist/src/series/plugins/PieEventTexts.d.ts +1 -1
- package/dist/src/series/plugins/PieLabels.d.ts +2 -2
- package/dist/src/series/types.d.ts +6 -6
- package/package.json +2 -2
- package/src/grid/defaults.ts +14 -14
- package/src/grid/plugins/BarStack.ts +3 -3
- package/src/grid/plugins/Bars.ts +3 -3
- package/src/grid/plugins/BarsTriangle.ts +4 -4
- package/src/grid/plugins/Dots.ts +2 -2
- package/src/grid/plugins/GroupArea.ts +5 -5
- package/src/grid/plugins/GroupAxis.ts +5 -5
- package/src/grid/plugins/Lines.ts +2 -2
- package/src/grid/types.ts +7 -7
- package/src/series/defaults.ts +9 -9
- package/src/series/plugins/Bubbles.ts +7 -7
- package/src/series/plugins/Pie.ts +2 -2
- package/src/series/plugins/PieLabels.ts +2 -2
- package/src/series/types.ts +6 -6
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { BubblesParams, PieParams, PieEventTextsParams, PieLabelsParams, SeriesLegendParams } from './types';
|
2
2
|
|
3
|
-
export declare const DEFAULT_BUBBLES_PLUGIN_PARAMS:
|
4
|
-
export declare const DEFAULT_PIE_PLUGIN_PARAMS:
|
5
|
-
export declare const DEFAULT_PIE_EVENT_TEXTS_PARAMS:
|
6
|
-
export declare const DEFAULT_PIE_LABELS_PARAMS:
|
3
|
+
export declare const DEFAULT_BUBBLES_PLUGIN_PARAMS: BubblesParams;
|
4
|
+
export declare const DEFAULT_PIE_PLUGIN_PARAMS: PieParams;
|
5
|
+
export declare const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsParams;
|
6
|
+
export declare const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams;
|
7
7
|
export declare const DEFAULT_SERIES_LEGEND_PARAMS: SeriesLegendParams;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
1
|
+
import { BubblesParams } from '../types';
|
2
2
|
|
3
|
-
export declare const Bubbles: import('@orbcharts/core').PluginConstructor<"series", string,
|
3
|
+
export declare const Bubbles: import('@orbcharts/core').PluginConstructor<"series", string, BubblesParams>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
1
|
+
import { PieParams } from '../types';
|
2
2
|
|
3
|
-
export declare const Pie: import('@orbcharts/core').PluginConstructor<"series", string,
|
3
|
+
export declare const Pie: import('@orbcharts/core').PluginConstructor<"series", string, PieParams>;
|
@@ -1 +1 @@
|
|
1
|
-
export declare const PieEventTexts: import('@orbcharts/core').PluginConstructor<"series", string, import('..').
|
1
|
+
export declare const PieEventTexts: import('@orbcharts/core').PluginConstructor<"series", string, import('..').PieEventTextsParams>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
1
|
+
import { PieLabelsParams } from '../types';
|
2
2
|
|
3
|
-
export declare const PieLabels: import('@orbcharts/core').PluginConstructor<"series", string,
|
3
|
+
export declare const PieLabels: import('@orbcharts/core').PluginConstructor<"series", string, PieLabelsParams>;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { ComputedDatumSeries, EventSeries, EventName, ColorType } from '@orbcharts/core';
|
2
2
|
import { BaseLegendParams } from '../base/BaseLegend';
|
3
3
|
|
4
|
-
export type
|
5
|
-
export interface
|
4
|
+
export type BubbleScaleType = 'area' | 'radius';
|
5
|
+
export interface BubblesParams {
|
6
6
|
force: {
|
7
7
|
strength: number;
|
8
8
|
velocityDecay: number;
|
@@ -14,9 +14,9 @@ export interface BubblesPluginParams {
|
|
14
14
|
lineLengthMin: number;
|
15
15
|
};
|
16
16
|
highlightRIncrease: number;
|
17
|
-
|
17
|
+
bubbleScaleType: BubbleScaleType;
|
18
18
|
}
|
19
|
-
export interface
|
19
|
+
export interface PieParams {
|
20
20
|
outerRadius: number;
|
21
21
|
innerRadius: number;
|
22
22
|
outerMouseoverRadius: number;
|
@@ -26,7 +26,7 @@ export interface PiePluginParams {
|
|
26
26
|
padAngle: number;
|
27
27
|
cornerRadius: number;
|
28
28
|
}
|
29
|
-
export interface
|
29
|
+
export interface PieEventTextsParams {
|
30
30
|
eventFn: (d: EventSeries, eventName: EventName, t: number) => string[];
|
31
31
|
textAttrs: Array<{
|
32
32
|
[key: string]: string | number;
|
@@ -35,7 +35,7 @@ export interface PieEventTextsPluginParams {
|
|
35
35
|
[key: string]: string | number;
|
36
36
|
}>;
|
37
37
|
}
|
38
|
-
export interface
|
38
|
+
export interface PieLabelsParams {
|
39
39
|
outerRadius: number;
|
40
40
|
outerMouseoverRadius: number;
|
41
41
|
startAngle: number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/plugins-basic",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.29",
|
4
4
|
"description": "plugins for OrbCharts",
|
5
5
|
"author": "Blue Planet Inc.",
|
6
6
|
"license": "Apache-2.0",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"vite-plugin-dts": "^3.7.3"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@orbcharts/core": "^3.0.0-alpha.
|
38
|
+
"@orbcharts/core": "^3.0.0-alpha.25",
|
39
39
|
"d3": "^7.8.5",
|
40
40
|
"rxjs": "^7.8.1"
|
41
41
|
}
|
package/src/grid/defaults.ts
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
LinesParams,
|
3
|
+
GroupAreaParams,
|
4
|
+
DotsParams,
|
5
|
+
BarsParams,
|
6
|
+
BarStackParams,
|
7
|
+
BarsTriangleParams,
|
8
|
+
GroupAxisParams,
|
9
9
|
ValueAxisParams,
|
10
10
|
ValueStackAxisParams,
|
11
11
|
ScalingAreaParams,
|
12
12
|
GridLegendParams } from './types'
|
13
13
|
|
14
|
-
export const DEFAULT_LINES_PLUGIN_PARAMS:
|
14
|
+
export const DEFAULT_LINES_PLUGIN_PARAMS: LinesParams = {
|
15
15
|
lineCurve: 'curveLinear',
|
16
16
|
lineWidth: 2
|
17
17
|
}
|
18
18
|
|
19
|
-
export const DEFAULT_DOTS_PLUGIN_PARAMS:
|
19
|
+
export const DEFAULT_DOTS_PLUGIN_PARAMS: DotsParams = {
|
20
20
|
radius: 4,
|
21
21
|
fillColorType: 'white',
|
22
22
|
strokeColorType: 'series',
|
@@ -24,7 +24,7 @@ export const DEFAULT_DOTS_PLUGIN_PARAMS: DotsPluginParams = {
|
|
24
24
|
onlyShowHighlighted: false
|
25
25
|
}
|
26
26
|
|
27
|
-
export const DEFAULT_GROUP_AREA_PLUGIN_PARAMS:
|
27
|
+
export const DEFAULT_GROUP_AREA_PLUGIN_PARAMS: GroupAreaParams = {
|
28
28
|
showLine: true,
|
29
29
|
showLabel: true,
|
30
30
|
lineDashArray: '3, 3',
|
@@ -35,7 +35,7 @@ export const DEFAULT_GROUP_AREA_PLUGIN_PARAMS: GroupAreaPluginParams = {
|
|
35
35
|
labelPadding: 24,
|
36
36
|
}
|
37
37
|
|
38
|
-
export const DEFAULT_BARS_PLUGIN_PARAMS:
|
38
|
+
export const DEFAULT_BARS_PLUGIN_PARAMS: BarsParams = {
|
39
39
|
// barType: 'rect',
|
40
40
|
barWidth: 0,
|
41
41
|
barPadding: 1,
|
@@ -43,20 +43,20 @@ export const DEFAULT_BARS_PLUGIN_PARAMS: BarsPluginParams = {
|
|
43
43
|
barRadius: false,
|
44
44
|
}
|
45
45
|
|
46
|
-
export const DEFAULT_BAR_STACK_PLUGIN_PARAMS:
|
46
|
+
export const DEFAULT_BAR_STACK_PLUGIN_PARAMS: BarStackParams = {
|
47
47
|
barWidth: 0,
|
48
48
|
barGroupPadding: 10,
|
49
49
|
barRadius: false,
|
50
50
|
}
|
51
51
|
|
52
|
-
export const DEFAULT_BARS_TRIANGLE_PLUGIN_PARAMS:
|
52
|
+
export const DEFAULT_BARS_TRIANGLE_PLUGIN_PARAMS: BarsTriangleParams = {
|
53
53
|
barWidth: 0,
|
54
54
|
barPadding: 1,
|
55
55
|
barGroupPadding: 20,
|
56
56
|
linearGradientOpacity: [1, 0]
|
57
57
|
}
|
58
58
|
|
59
|
-
export const DEFAULT_GROUPING_AXIS_PLUGIN_PARAMS:
|
59
|
+
export const DEFAULT_GROUPING_AXIS_PLUGIN_PARAMS: GroupAxisParams = {
|
60
60
|
// labelAnchor: 'start',
|
61
61
|
labelOffset: [0, 0],
|
62
62
|
labelColorType: 'primary',
|
@@ -17,7 +17,7 @@ import type {
|
|
17
17
|
ChartParams,
|
18
18
|
DataSeriesDatum,
|
19
19
|
Layout } from '@orbcharts/core'
|
20
|
-
import type {
|
20
|
+
import type { BarStackParams } from '../types'
|
21
21
|
import { DEFAULT_BAR_STACK_PLUGIN_PARAMS } from '../defaults'
|
22
22
|
import { getD3TransitionEase } from '../../utils/d3Utils'
|
23
23
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
@@ -33,7 +33,7 @@ interface RenderBarParams {
|
|
33
33
|
zeroY: number
|
34
34
|
groupLabels: string[]
|
35
35
|
// barScale: d3.ScalePoint<string>
|
36
|
-
params:
|
36
|
+
params: BarStackParams
|
37
37
|
chartParams: ChartParams
|
38
38
|
barWidth: number
|
39
39
|
transformedBarRadius: [number, number]
|
@@ -66,7 +66,7 @@ function calcBarWidth ({ axisWidth, groupAmount, barGroupPadding = 0 }: {
|
|
66
66
|
|
67
67
|
}
|
68
68
|
|
69
|
-
// function makeBarScale (barWidth: number, seriesLabels: string[], params:
|
69
|
+
// function makeBarScale (barWidth: number, seriesLabels: string[], params: BarStackParams) {
|
70
70
|
// const barHalfWidth = barWidth! / 2
|
71
71
|
// const barGroupWidth = barWidth * seriesLabels.length + params.barPadding! * seriesLabels.length
|
72
72
|
// return d3.scalePoint()
|
package/src/grid/plugins/Bars.ts
CHANGED
@@ -19,7 +19,7 @@ import type {
|
|
19
19
|
EventGrid,
|
20
20
|
ChartParams,
|
21
21
|
Layout } from '@orbcharts/core'
|
22
|
-
import type {
|
22
|
+
import type { BarsParams } from '../types'
|
23
23
|
import { DEFAULT_BARS_PLUGIN_PARAMS } from '../defaults'
|
24
24
|
import { getD3TransitionEase } from '../../utils/d3Utils'
|
25
25
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
@@ -30,7 +30,7 @@ interface RenderBarParams {
|
|
30
30
|
zeroY: number
|
31
31
|
groupLabels: string[]
|
32
32
|
barScale: d3.ScalePoint<string>
|
33
|
-
params:
|
33
|
+
params: BarsParams
|
34
34
|
chartParams: ChartParams
|
35
35
|
barWidth: number
|
36
36
|
transformedBarRadius: [number, number]
|
@@ -64,7 +64,7 @@ function calcBarWidth ({ axisWidth, groupAmount, barAmountOfGroup, barPadding =
|
|
64
64
|
return width > 1 ? width : 1
|
65
65
|
}
|
66
66
|
|
67
|
-
function makeBarScale (barWidth: number, seriesLabels: string[], params:
|
67
|
+
function makeBarScale (barWidth: number, seriesLabels: string[], params: BarsParams) {
|
68
68
|
const barHalfWidth = barWidth! / 2
|
69
69
|
const barGroupWidth = barWidth * seriesLabels.length + params.barPadding! * seriesLabels.length
|
70
70
|
return d3.scalePoint()
|
@@ -16,7 +16,7 @@ import type {
|
|
16
16
|
ChartParams,
|
17
17
|
DataSeriesDatum,
|
18
18
|
Layout } from '@orbcharts/core'
|
19
|
-
import type {
|
19
|
+
import type { BarsTriangleParams } from '../types'
|
20
20
|
import { DEFAULT_BARS_TRIANGLE_PLUGIN_PARAMS } from '../defaults'
|
21
21
|
import { getD3TransitionEase } from '../../utils/d3Utils'
|
22
22
|
import {
|
@@ -29,7 +29,7 @@ interface RenderBarParams {
|
|
29
29
|
zeroY: number
|
30
30
|
groupLabels: string[]
|
31
31
|
barScale: d3.ScalePoint<string>
|
32
|
-
params:
|
32
|
+
params: BarsTriangleParams
|
33
33
|
chartParams: ChartParams
|
34
34
|
barWidth: number
|
35
35
|
delayGroup: number
|
@@ -65,7 +65,7 @@ function calcBarWidth ({ axisWidth, groupAmount, barAmountOfGroup, barPadding =
|
|
65
65
|
return width > 1 ? width : 1
|
66
66
|
}
|
67
67
|
|
68
|
-
function makeBarScale (barWidth: number, seriesLabels: string[], params:
|
68
|
+
function makeBarScale (barWidth: number, seriesLabels: string[], params: BarsTriangleParams) {
|
69
69
|
const barHalfWidth = barWidth! / 2
|
70
70
|
const barGroupWidth = barWidth * seriesLabels.length + params.barPadding! * seriesLabels.length
|
71
71
|
return d3.scalePoint()
|
@@ -165,7 +165,7 @@ function renderTriangleBars ({ selection, barData, zeroY, groupLabels, barScale,
|
|
165
165
|
function renderLinearGradient ({ defsSelection, barData, params }: {
|
166
166
|
defsSelection: d3.Selection<SVGDefsElement, ComputedDatumGrid, any, any>
|
167
167
|
barData: BarDatumGrid[][]
|
168
|
-
params:
|
168
|
+
params: BarsTriangleParams
|
169
169
|
}) {
|
170
170
|
const linearGradientUpdate = defsSelection!
|
171
171
|
.selectAll<SVGLinearGradientElement, ComputedDatumGrid>('linearGradient')
|
package/src/grid/plugins/Dots.ts
CHANGED
@@ -15,7 +15,7 @@ import type {
|
|
15
15
|
ChartParams,
|
16
16
|
ComputedDatumGrid,
|
17
17
|
Layout } from '@orbcharts/core'
|
18
|
-
import type {
|
18
|
+
import type { DotsParams } from '../types'
|
19
19
|
import { DEFAULT_DOTS_PLUGIN_PARAMS } from '../defaults'
|
20
20
|
import { getDatumColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
|
21
21
|
|
@@ -34,7 +34,7 @@ const circleClassName = getClassName(pluginName, 'circle')
|
|
34
34
|
function renderDots ({ selection, data, fullParams, fullChartParams, graphicOppositeScale }: {
|
35
35
|
selection: d3.Selection<SVGGElement, any, any, any>
|
36
36
|
data: ComputedDatumGrid[]
|
37
|
-
fullParams:
|
37
|
+
fullParams: DotsParams
|
38
38
|
fullChartParams: ChartParams
|
39
39
|
graphicOppositeScale: [number, number]
|
40
40
|
}) {
|
@@ -24,7 +24,7 @@ import { getColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
|
|
24
24
|
import { d3EventObservable } from '../../utils/observables'
|
25
25
|
import { gridGroupPositionFnObservable } from '../gridObservables'
|
26
26
|
import { createAxisPointScale } from '@orbcharts/core'
|
27
|
-
import type {
|
27
|
+
import type { GroupAreaParams } from '../types'
|
28
28
|
|
29
29
|
interface LineDatum {
|
30
30
|
id: string
|
@@ -48,7 +48,7 @@ function createLineData ({ groupLabel, axisX, axisHeight, fullParams }: {
|
|
48
48
|
groupLabel: string
|
49
49
|
axisX: number
|
50
50
|
axisHeight: number
|
51
|
-
fullParams:
|
51
|
+
fullParams: GroupAreaParams
|
52
52
|
}): LineDatum[] {
|
53
53
|
return fullParams.showLine && groupLabel
|
54
54
|
? [{
|
@@ -65,7 +65,7 @@ function renderLine ({ selection, pluginName, lineData, fullParams, fullChartPar
|
|
65
65
|
selection: d3.Selection<any, unknown, any, unknown>
|
66
66
|
pluginName: string
|
67
67
|
lineData: LineDatum[]
|
68
|
-
fullParams:
|
68
|
+
fullParams: GroupAreaParams
|
69
69
|
fullChartParams: ChartParams
|
70
70
|
}) {
|
71
71
|
const gClassName = getClassName(pluginName, 'auxline')
|
@@ -114,7 +114,7 @@ function removeLine (selection: d3.Selection<any, unknown, any, unknown>) {
|
|
114
114
|
function createLabelData ({ groupLabel, axisX, fullParams }: {
|
115
115
|
groupLabel: string
|
116
116
|
axisX: number
|
117
|
-
fullParams:
|
117
|
+
fullParams: GroupAreaParams
|
118
118
|
}) {
|
119
119
|
return fullParams.showLabel && groupLabel
|
120
120
|
? [{
|
@@ -129,7 +129,7 @@ function createLabelData ({ groupLabel, axisX, fullParams }: {
|
|
129
129
|
function renderLabel ({ selection, labelData, fullParams, fullChartParams, gridAxesOppositeTransformValue }: {
|
130
130
|
selection: d3.Selection<any, unknown, any, unknown>
|
131
131
|
labelData: LabelDatum[]
|
132
|
-
fullParams:
|
132
|
+
fullParams: GroupAreaParams
|
133
133
|
fullChartParams: ChartParams
|
134
134
|
gridAxesOppositeTransformValue: string
|
135
135
|
}) {
|
@@ -15,7 +15,7 @@ import type {
|
|
15
15
|
DataFormatterGrid,
|
16
16
|
ChartParams,
|
17
17
|
TransformData } from '@orbcharts/core'
|
18
|
-
import type {
|
18
|
+
import type { GroupAxisParams } from '../types'
|
19
19
|
import { DEFAULT_GROUPING_AXIS_PLUGIN_PARAMS } from '../defaults'
|
20
20
|
import { parseTickFormatValue } from '../../utils/d3Utils'
|
21
21
|
import { getColor, getClassName } from '../../utils/orbchartsUtils'
|
@@ -32,7 +32,7 @@ const defaultTickSize = 6
|
|
32
32
|
|
33
33
|
function renderPointAxis ({ selection, params, tickTextAlign, axisLabelAlign, gridAxesSize, fullDataFormatter, chartParams, groupScale, contentTransform }: {
|
34
34
|
selection: d3.Selection<SVGGElement, any, any, any>,
|
35
|
-
params:
|
35
|
+
params: GroupAxisParams
|
36
36
|
tickTextAlign: TextAlign
|
37
37
|
axisLabelAlign: TextAlign
|
38
38
|
gridAxesSize: { width: number, height: number }
|
@@ -44,19 +44,19 @@ function renderPointAxis ({ selection, params, tickTextAlign, axisLabelAlign, gr
|
|
44
44
|
}) {
|
45
45
|
|
46
46
|
const xAxisSelection = selection
|
47
|
-
.selectAll<SVGGElement,
|
47
|
+
.selectAll<SVGGElement, GroupAxisParams>(`g.${xAxisClassName}`)
|
48
48
|
.data([params])
|
49
49
|
.join('g')
|
50
50
|
.classed(xAxisClassName, true)
|
51
51
|
|
52
52
|
const axisLabelSelection = selection
|
53
|
-
.selectAll<SVGGElement,
|
53
|
+
.selectAll<SVGGElement, GroupAxisParams>(`g.${groupingLabelClassName}`)
|
54
54
|
.data([params])
|
55
55
|
.join('g')
|
56
56
|
.classed(groupingLabelClassName, true)
|
57
57
|
.each((d, i, g) => {
|
58
58
|
const text = d3.select(g[i])
|
59
|
-
.selectAll<SVGTextElement,
|
59
|
+
.selectAll<SVGTextElement, GroupAxisParams>('text')
|
60
60
|
.data([d])
|
61
61
|
.join(
|
62
62
|
enter => {
|
@@ -17,7 +17,7 @@ import type {
|
|
17
17
|
ComputedDatumGrid,
|
18
18
|
ChartParams,
|
19
19
|
Layout } from '@orbcharts/core'
|
20
|
-
import type {
|
20
|
+
import type { LinesParams } from '../types'
|
21
21
|
import { DEFAULT_LINES_PLUGIN_PARAMS } from '../defaults'
|
22
22
|
import { getD3TransitionEase } from '../../utils/d3Utils'
|
23
23
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
@@ -71,7 +71,7 @@ function renderLine ({ selection, segmentData, linePath, params }: {
|
|
71
71
|
selection: d3.Selection<SVGGElement, unknown, any, unknown>
|
72
72
|
segmentData: ComputedDatumGrid[][]
|
73
73
|
linePath: d3.Line<ComputedDatumGrid>
|
74
|
-
params:
|
74
|
+
params: LinesParams
|
75
75
|
}): d3.Selection<SVGPathElement, ComputedDatumGrid[], any, any> {
|
76
76
|
// if (!data[0]) {
|
77
77
|
// return undefined
|
package/src/grid/types.ts
CHANGED
@@ -4,7 +4,7 @@ import type { BaseLegendParams } from '../base/BaseLegend'
|
|
4
4
|
// export type LineType = 'line' | 'area' | 'gradientArea'
|
5
5
|
// export type BarType = 'rect' | 'triangle'
|
6
6
|
|
7
|
-
export interface
|
7
|
+
export interface LinesParams {
|
8
8
|
// lineType: LineType
|
9
9
|
lineCurve: string
|
10
10
|
lineWidth: number
|
@@ -16,7 +16,7 @@ export interface LinesPluginParams {
|
|
16
16
|
// labelPadding: number
|
17
17
|
}
|
18
18
|
|
19
|
-
export interface
|
19
|
+
export interface DotsParams {
|
20
20
|
radius: number
|
21
21
|
fillColorType: ColorType
|
22
22
|
strokeColorType: ColorType
|
@@ -24,7 +24,7 @@ export interface DotsPluginParams {
|
|
24
24
|
onlyShowHighlighted: boolean
|
25
25
|
}
|
26
26
|
|
27
|
-
export interface
|
27
|
+
export interface GroupAreaParams {
|
28
28
|
showLine: boolean
|
29
29
|
showLabel: boolean
|
30
30
|
lineDashArray: string
|
@@ -35,7 +35,7 @@ export interface GroupAreaPluginParams {
|
|
35
35
|
labelPadding: number
|
36
36
|
}
|
37
37
|
|
38
|
-
export interface
|
38
|
+
export interface BarsParams {
|
39
39
|
// barType: BarType
|
40
40
|
barWidth: number
|
41
41
|
barPadding: number
|
@@ -43,20 +43,20 @@ export interface BarsPluginParams {
|
|
43
43
|
barRadius: number | boolean
|
44
44
|
}
|
45
45
|
|
46
|
-
export interface
|
46
|
+
export interface BarStackParams {
|
47
47
|
barWidth: number
|
48
48
|
barGroupPadding: number
|
49
49
|
barRadius: number | boolean
|
50
50
|
}
|
51
51
|
|
52
|
-
export interface
|
52
|
+
export interface BarsTriangleParams {
|
53
53
|
barWidth: number
|
54
54
|
barPadding: number
|
55
55
|
barGroupPadding: number // 群組和群組間的間隔
|
56
56
|
linearGradientOpacity: [number, number]
|
57
57
|
}
|
58
58
|
|
59
|
-
export interface
|
59
|
+
export interface GroupAxisParams {
|
60
60
|
// xLabel: string
|
61
61
|
// labelAnchor: 'start' | 'end'
|
62
62
|
labelOffset: [number, number]
|
package/src/series/defaults.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import type { ComputedDatumSeries, EventSeries, EventName, ColorType } from '@orbcharts/core'
|
2
2
|
import type {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
BubblesParams,
|
4
|
+
PieParams,
|
5
|
+
PieEventTextsParams,
|
6
|
+
PieLabelsParams,
|
7
7
|
SeriesLegendParams } from './types'
|
8
8
|
|
9
9
|
|
10
|
-
export const DEFAULT_BUBBLES_PLUGIN_PARAMS:
|
10
|
+
export const DEFAULT_BUBBLES_PLUGIN_PARAMS: BubblesParams = {
|
11
11
|
force: {
|
12
12
|
strength: 0.03, // 泡泡引力
|
13
13
|
velocityDecay: 0.2, // 衰減數
|
@@ -19,10 +19,10 @@ export const DEFAULT_BUBBLES_PLUGIN_PARAMS: BubblesPluginParams = {
|
|
19
19
|
lineLengthMin: 4
|
20
20
|
},
|
21
21
|
highlightRIncrease: 0,
|
22
|
-
|
22
|
+
bubbleScaleType: 'area'
|
23
23
|
}
|
24
24
|
|
25
|
-
export const DEFAULT_PIE_PLUGIN_PARAMS:
|
25
|
+
export const DEFAULT_PIE_PLUGIN_PARAMS: PieParams = {
|
26
26
|
// padding: {
|
27
27
|
// top: 50,
|
28
28
|
// right: 70,
|
@@ -44,7 +44,7 @@ export const DEFAULT_PIE_PLUGIN_PARAMS: PiePluginParams = {
|
|
44
44
|
// highlightLabel: null,
|
45
45
|
}
|
46
46
|
|
47
|
-
export const DEFAULT_PIE_EVENT_TEXTS_PARAMS:
|
47
|
+
export const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsParams = {
|
48
48
|
eventFn: (d: EventSeries, eventName: EventName, t: number) => {
|
49
49
|
if (eventName === 'mouseover' || eventName === 'mousemove') {
|
50
50
|
return [String(d.datum!.value)]
|
@@ -68,7 +68,7 @@ export const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsPluginParams = {
|
|
68
68
|
]
|
69
69
|
}
|
70
70
|
|
71
|
-
export const DEFAULT_PIE_LABELS_PARAMS:
|
71
|
+
export const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams = {
|
72
72
|
// solidColor: undefined,
|
73
73
|
// colors: DEFAULT_COLORS,
|
74
74
|
outerRadius: 0.95,
|
@@ -17,7 +17,7 @@ import type {
|
|
17
17
|
ComputedDatumSeries } from '@orbcharts/core'
|
18
18
|
import {
|
19
19
|
defineSeriesPlugin } from '@orbcharts/core'
|
20
|
-
import type {
|
20
|
+
import type { BubblesParams, BubbleScaleType } from '../types'
|
21
21
|
import { DEFAULT_BUBBLES_PLUGIN_PARAMS } from '../defaults'
|
22
22
|
import { renderCircleText } from '../../utils/d3Graphics'
|
23
23
|
|
@@ -30,7 +30,7 @@ interface BubblesDatum extends ComputedDatumSeries {
|
|
30
30
|
|
31
31
|
let force: d3.Simulation<d3.SimulationNodeDatum, undefined> | undefined
|
32
32
|
|
33
|
-
function makeForce (bubblesSelection: d3.Selection<SVGGElement, any, any, any>, fullParams:
|
33
|
+
function makeForce (bubblesSelection: d3.Selection<SVGGElement, any, any, any>, fullParams: BubblesParams) {
|
34
34
|
return d3.forceSimulation()
|
35
35
|
.velocityDecay(fullParams.force!.velocityDecay!)
|
36
36
|
// .alphaDecay(0.2)
|
@@ -86,7 +86,7 @@ function createBubblesData ({ data, LastBubbleDataMap, graphicWidth, graphicHeig
|
|
86
86
|
LastBubbleDataMap: Map<string, BubblesDatum>
|
87
87
|
graphicWidth: number
|
88
88
|
graphicHeight: number
|
89
|
-
scaleType:
|
89
|
+
scaleType: BubbleScaleType
|
90
90
|
// highlightIds: string[]
|
91
91
|
}) {
|
92
92
|
const bubbleGroupR = Math.min(...[graphicWidth, graphicHeight]) / 2
|
@@ -140,7 +140,7 @@ function createBubblesData ({ data, LastBubbleDataMap, graphicWidth, graphicHeig
|
|
140
140
|
function renderBubbles ({ graphicSelection, bubblesData, fullParams }: {
|
141
141
|
graphicSelection: d3.Selection<SVGGElement, any, any, any>
|
142
142
|
bubblesData: BubblesDatum[]
|
143
|
-
fullParams:
|
143
|
+
fullParams: BubblesParams
|
144
144
|
}) {
|
145
145
|
let update = graphicSelection.selectAll<SVGGElement, BubblesDatum>("g")
|
146
146
|
.data(bubblesData, (d) => d.id)
|
@@ -203,7 +203,7 @@ function renderBubbles ({ graphicSelection, bubblesData, fullParams }: {
|
|
203
203
|
|
204
204
|
function setHighlightData ({ data, highlightRIncrease, highlightIds }: {
|
205
205
|
data: BubblesDatum[]
|
206
|
-
// fullParams:
|
206
|
+
// fullParams: BubblesParams
|
207
207
|
highlightRIncrease: number
|
208
208
|
highlightIds: string[]
|
209
209
|
}) {
|
@@ -254,7 +254,7 @@ function drag (): d3.DragBehavior<Element, unknown, unknown> {
|
|
254
254
|
// }
|
255
255
|
|
256
256
|
function groupBubbles ({ fullParams, graphicWidth, graphicHeight }: {
|
257
|
-
fullParams:
|
257
|
+
fullParams: BubblesParams
|
258
258
|
graphicWidth: number
|
259
259
|
graphicHeight: number
|
260
260
|
}) {
|
@@ -363,7 +363,7 @@ export const Bubbles = defineSeriesPlugin('Bubbles', DEFAULT_BUBBLES_PLUGIN_PARA
|
|
363
363
|
|
364
364
|
const scaleType$ = observer.fullParams$.pipe(
|
365
365
|
takeUntil(destroy$),
|
366
|
-
map(d => d.
|
366
|
+
map(d => d.bubbleScaleType),
|
367
367
|
distinctUntilChanged()
|
368
368
|
)
|
369
369
|
|
@@ -17,7 +17,7 @@ import {
|
|
17
17
|
defineSeriesPlugin } from '@orbcharts/core'
|
18
18
|
import type {
|
19
19
|
ChartParams } from '@orbcharts/core'
|
20
|
-
import type {
|
20
|
+
import type { PieParams } from '../types'
|
21
21
|
import type { PieDatum } from '../seriesUtils'
|
22
22
|
import { DEFAULT_PIE_PLUGIN_PARAMS } from '../defaults'
|
23
23
|
import { makePieData } from '../seriesUtils'
|
@@ -32,7 +32,7 @@ function makeTweenPieRenderDataFn ({ enter, exit, data, lastData, fullParams }:
|
|
32
32
|
exit: d3.Selection<SVGPathElement, unknown, any, any>
|
33
33
|
data: PieDatum[]
|
34
34
|
lastData: PieDatum[]
|
35
|
-
fullParams:
|
35
|
+
fullParams: PieParams
|
36
36
|
}): (t: number) => PieDatum[] {
|
37
37
|
// 無更新資料項目則只計算資料變化 (新資料 * t + 舊資料 * (1 - t))
|
38
38
|
if (!enter.size() && !exit.size()) {
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineSeriesPlugin } from '@orbcharts/core'
|
11
11
|
import type {
|
12
12
|
ChartParams } from '@orbcharts/core'
|
13
|
-
import type {
|
13
|
+
import type { PieLabelsParams } from '../types'
|
14
14
|
import type { PieDatum } from '../seriesUtils'
|
15
15
|
import { DEFAULT_PIE_LABELS_PARAMS } from '../defaults'
|
16
16
|
import { makePieData } from '../seriesUtils'
|
@@ -49,7 +49,7 @@ function makeRenderData (pieData: PieDatum[], arc: d3.Arc<any, d3.DefaultArcObje
|
|
49
49
|
}
|
50
50
|
|
51
51
|
// 繪製圓餅圖
|
52
|
-
function renderLabel (selection: d3.Selection<SVGGElement, undefined, any, any>, data: RenderDatum[], pluginParams:
|
52
|
+
function renderLabel (selection: d3.Selection<SVGGElement, undefined, any, any>, data: RenderDatum[], pluginParams: PieLabelsParams, fullChartParams: ChartParams) {
|
53
53
|
// console.log(data)
|
54
54
|
// let update = this.gSelection.selectAll('g').data(pieData)
|
55
55
|
let update: d3.Selection<SVGPathElement, RenderDatum, any, any> = selection
|
package/src/series/types.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { ComputedDatumSeries, EventSeries, EventName, ColorType } from '@orbcharts/core'
|
2
2
|
import type { BaseLegendParams } from '../base/BaseLegend'
|
3
3
|
|
4
|
-
export type
|
4
|
+
export type BubbleScaleType = 'area' | 'radius'
|
5
5
|
|
6
|
-
export interface
|
6
|
+
export interface BubblesParams {
|
7
7
|
force: {
|
8
8
|
strength: number; // 泡泡引力
|
9
9
|
velocityDecay: number; // 衰減數
|
@@ -15,10 +15,10 @@ export interface BubblesPluginParams {
|
|
15
15
|
lineLengthMin: number
|
16
16
|
}
|
17
17
|
highlightRIncrease: number
|
18
|
-
|
18
|
+
bubbleScaleType: BubbleScaleType
|
19
19
|
}
|
20
20
|
|
21
|
-
export interface
|
21
|
+
export interface PieParams {
|
22
22
|
// padding: Padding
|
23
23
|
outerRadius: number;
|
24
24
|
innerRadius: number;
|
@@ -32,13 +32,13 @@ export interface PiePluginParams {
|
|
32
32
|
cornerRadius: number
|
33
33
|
}
|
34
34
|
|
35
|
-
export interface
|
35
|
+
export interface PieEventTextsParams {
|
36
36
|
eventFn: (d: EventSeries, eventName: EventName, t: number) => string[]
|
37
37
|
textAttrs: Array<{ [key:string]: string | number }>
|
38
38
|
textStyles: Array<{ [key:string]: string | number }>
|
39
39
|
}
|
40
40
|
|
41
|
-
export interface
|
41
|
+
export interface PieLabelsParams {
|
42
42
|
// solidColor?: string;
|
43
43
|
// colors?: string[];
|
44
44
|
outerRadius: number
|