@orbcharts/core 3.0.0-alpha.42 → 3.0.0-alpha.44
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-core.es.js +1905 -1896
- package/dist/orbcharts-core.umd.js +2 -2
- package/dist/src/defaults.d.ts +4 -3
- package/dist/src/grid/computeGridData.d.ts +4 -11
- package/dist/src/grid/gridObservables.d.ts +15 -18
- package/dist/src/multiGrid/multiGridObservables.d.ts +4 -11
- package/dist/src/series/seriesObservables.d.ts +26 -1
- package/dist/src/types/ComputedData.d.ts +1 -0
- package/dist/src/types/ComputedDataGrid.d.ts +0 -3
- package/dist/src/types/ComputedDataSeries.d.ts +1 -2
- package/dist/src/types/ContextObserverGrid.d.ts +11 -4
- package/dist/src/types/ContextObserverMultiGrid.d.ts +8 -3
- package/dist/src/types/ContextObserverSeries.d.ts +18 -0
- package/dist/src/types/DataFormatter.d.ts +8 -5
- package/dist/src/types/DataFormatterGrid.d.ts +13 -16
- package/dist/src/types/DataFormatterMultiGrid.d.ts +6 -3
- package/dist/src/types/DataFormatterMultiValue.d.ts +3 -0
- package/dist/src/types/DataFormatterRelationship.d.ts +3 -0
- package/dist/src/types/DataFormatterSeries.d.ts +11 -4
- package/dist/src/utils/orbchartsUtils.d.ts +14 -13
- package/package.json +1 -1
- package/src/base/createBaseChart.ts +10 -10
- package/src/defaults.ts +36 -64
- package/src/grid/computeGridData.ts +15 -86
- package/src/grid/createGridContextObserver.ts +33 -16
- package/src/grid/gridObservables.ts +157 -70
- package/src/multiGrid/computeMultiGridData.ts +77 -120
- package/src/multiGrid/createMultiGridContextObserver.ts +8 -8
- package/src/multiGrid/multiGridObservables.ts +236 -171
- package/src/multiValue/computeMultiValueData.ts +22 -15
- package/src/relationship/computeRelationshipData.ts +16 -4
- package/src/series/computeSeriesData.ts +51 -114
- package/src/series/createSeriesContextObserver.ts +59 -4
- package/src/series/seriesObservables.ts +162 -10
- package/src/tree/computeTreeData.ts +6 -3
- package/src/types/ComputedData.ts +1 -0
- package/src/types/ComputedDataGrid.ts +3 -3
- package/src/types/ComputedDataSeries.ts +2 -2
- package/src/types/ContextObserverGrid.ts +18 -10
- package/src/types/ContextObserverMultiGrid.ts +6 -18
- package/src/types/ContextObserverSeries.ts +21 -1
- package/src/types/DataFormatter.ts +11 -32
- package/src/types/DataFormatterGrid.ts +32 -20
- package/src/types/DataFormatterMultiGrid.ts +6 -4
- package/src/types/DataFormatterMultiValue.ts +3 -0
- package/src/types/DataFormatterRelationship.ts +3 -0
- package/src/types/DataFormatterSeries.ts +11 -21
- package/src/utils/d3Utils.ts +7 -7
- package/src/utils/orbchartsUtils.ts +128 -32
package/src/defaults.ts
CHANGED
@@ -7,7 +7,7 @@ import type { DataMultiGrid } from './types/DataMultiGrid'
|
|
7
7
|
import type { DataMultiValue } from './types/DataMultiValue'
|
8
8
|
import type { DataTree } from './types/DataTree'
|
9
9
|
import type { DataRelationship } from './types/DataRelationship'
|
10
|
-
import type { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis } from './types/DataFormatter'
|
10
|
+
import type { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis, DataFormatterContainer } from './types/DataFormatter'
|
11
11
|
import type { DataFormatterSeries } from './types/DataFormatterSeries'
|
12
12
|
import type { DataFormatterGrid, DataFormatterGridGrid } from './types/DataFormatterGrid'
|
13
13
|
import type { DataFormatterMultiGrid, DataFormatterMultiGridGrid } from './types/DataFormatterMultiGrid'
|
@@ -43,16 +43,9 @@ export const PADDING_DEFAULT: Padding = {
|
|
43
43
|
left: 60
|
44
44
|
}
|
45
45
|
|
46
|
-
// export const HIGHLIGHT_DEFAULT: HighlightDefault = {
|
47
|
-
// // trigger: 'datum',
|
48
|
-
// id: null,
|
49
|
-
// label: null
|
50
|
-
// }
|
51
|
-
|
52
46
|
export const CHART_PARAMS_DEFAULT: ChartParams = {
|
53
47
|
padding: PADDING_DEFAULT,
|
54
48
|
highlightTarget: 'datum',
|
55
|
-
// highlightDefault: HIGHLIGHT_DEFAULT,
|
56
49
|
highlightDefault: null,
|
57
50
|
colorScheme: 'light',
|
58
51
|
colors: {
|
@@ -104,45 +97,36 @@ export const DATA_RELATIONA_DEFAULTL: DataRelationship = {
|
|
104
97
|
|
105
98
|
// -- Data Formatter --
|
106
99
|
|
107
|
-
|
108
|
-
// export const DATA_FORMATTER: DataFormatterBase<ChartType> = {
|
109
|
-
// // ...GLOBAL_DEFAULT,
|
110
|
-
// type: ('' as any), // 後面需複蓋掉否則會有問題
|
111
|
-
// }
|
112
|
-
// 有value
|
113
|
-
// export const DATA_FORMATTER_WITH_VALUE: DataFormatterValue = {
|
114
|
-
// valueFormat: ',.0f'
|
115
|
-
// }
|
116
|
-
// 有axis
|
117
|
-
// export const DATA_FORMATTER_WITH_AXIS: DataFormatterAxis = {
|
118
|
-
// // domainMinValue: 0,
|
119
|
-
// // domainMaxValue: undefined,
|
120
|
-
// // domainMinRange: undefined,
|
121
|
-
// // domainMaxRange: 0.9
|
122
|
-
// valueDomain: [0, 'auto'],
|
123
|
-
// valueRange: [0, 0.9]
|
124
|
-
// }
|
125
|
-
|
126
|
-
export const DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis = {
|
100
|
+
export const DATA_FORMATTER_VALUE_AXIS_DEFAULT: DataFormatterValueAxis = {
|
127
101
|
position: 'left',
|
128
102
|
scaleDomain: [0, 'auto'],
|
129
103
|
scaleRange: [0, 0.9],
|
130
104
|
label: '',
|
131
105
|
}
|
132
106
|
|
133
|
-
export const
|
107
|
+
export const DATA_FORMATTER_GROUP_AXIS_DEFAULT: DataFormatterGroupAxis = {
|
134
108
|
position: 'bottom',
|
135
109
|
scaleDomain: [0, 'auto'],
|
136
110
|
scalePadding: 0.5,
|
137
111
|
label: ''
|
138
112
|
}
|
139
113
|
|
114
|
+
export const DATA_FORMATTER_CONTAINER_DEFAULT: DataFormatterContainer = {
|
115
|
+
gap: 120,
|
116
|
+
rowAmount: 1,
|
117
|
+
columnAmount: 1
|
118
|
+
}
|
119
|
+
|
140
120
|
export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
141
|
-
// ...DATA_FORMATTER_WITH_VALUE,
|
142
121
|
type: 'series',
|
143
|
-
visibleFilter: (datum,
|
144
|
-
|
122
|
+
visibleFilter: (datum, context) => true,
|
123
|
+
sort: null,
|
145
124
|
seriesLabels: [],
|
125
|
+
container: {
|
126
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
127
|
+
},
|
128
|
+
separateSeries: false,
|
129
|
+
sumSeries: false
|
146
130
|
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
147
131
|
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
148
132
|
// ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
|
@@ -156,38 +140,28 @@ export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
|
156
140
|
// rowIndex % chartParams.colors[chartParams.colorScheme].series.length
|
157
141
|
// ]
|
158
142
|
// },
|
159
|
-
sort: null,
|
160
143
|
}
|
161
144
|
|
162
145
|
export const DATA_FORMATTER_GRID_GRID_DEFAULT: DataFormatterGridGrid = {
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
slotIndex: 0,
|
172
|
-
seriesSlotIndexes: null
|
146
|
+
seriesDirection: 'row',
|
147
|
+
rowLabels: [],
|
148
|
+
columnLabels: [],
|
149
|
+
valueAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
150
|
+
groupAxis: { ...DATA_FORMATTER_GROUP_AXIS_DEFAULT, },
|
151
|
+
separateSeries: false,
|
152
|
+
// slotIndex: 0,
|
153
|
+
// seriesSlotIndexes: null
|
173
154
|
}
|
174
155
|
|
175
156
|
export const DATA_FORMATTER_GRID_DEFAULT: DataFormatterGrid = {
|
176
|
-
// ...DATA_FORMATTER_WITH_VALUE,
|
177
157
|
type: 'grid',
|
158
|
+
visibleFilter: (datum, context) => true,
|
178
159
|
grid: {
|
179
160
|
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
180
161
|
},
|
181
162
|
container: {
|
182
|
-
|
183
|
-
rowAmount: 1,
|
184
|
-
columnAmount: 1
|
163
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
185
164
|
}
|
186
|
-
// visibleGroupRange: null,
|
187
|
-
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams, dataFormatter }) => {
|
188
|
-
// const seriesIndex = dataFormatter.grid.seriesDirection === 'row' ? rowIndex : columnIndex
|
189
|
-
// return chartParams.colors[chartParams.colorScheme].series[seriesIndex]
|
190
|
-
// },
|
191
165
|
}
|
192
166
|
|
193
167
|
// export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
|
@@ -202,38 +176,38 @@ export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid
|
|
202
176
|
|
203
177
|
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
204
178
|
type: 'multiGrid',
|
205
|
-
|
179
|
+
visibleFilter: (datum, context) => true,
|
206
180
|
gridList: [
|
207
181
|
{
|
208
182
|
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
209
183
|
},
|
210
184
|
],
|
185
|
+
separateGrid: false,
|
211
186
|
container: {
|
212
|
-
|
213
|
-
rowAmount: 1,
|
214
|
-
columnAmount: 1
|
187
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
215
188
|
}
|
216
189
|
}
|
217
190
|
|
218
191
|
export const DATA_FORMATTER_MULTI_VALUE_DEFAULT: DataFormatterMultiValue = {
|
219
192
|
type: 'multiValue',
|
220
|
-
visibleFilter: (datum,
|
221
|
-
|
193
|
+
visibleFilter: (datum, context) => true,
|
194
|
+
categoryLabels: [],
|
222
195
|
multiValue: [],
|
223
|
-
xAxis: { ...
|
224
|
-
yAxis: { ...
|
196
|
+
xAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
197
|
+
yAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
225
198
|
}
|
226
199
|
|
227
200
|
export const DATA_FORMATTER_TREE_DEFAULT: DataFormatterTree = {
|
228
201
|
type: 'tree',
|
229
|
-
visibleFilter: (datum,
|
202
|
+
visibleFilter: (datum, context) => true,
|
230
203
|
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
231
204
|
categoryLabels: []
|
232
205
|
}
|
233
206
|
|
234
207
|
export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
235
208
|
type: 'relationship',
|
236
|
-
visibleFilter: (datum,
|
209
|
+
visibleFilter: (datum, context) => true,
|
210
|
+
categoryLabels: []
|
237
211
|
// node: {
|
238
212
|
// // labelFormat: (node: any) => (node && node.label) ?? '',
|
239
213
|
// descriptionFormat: (node: any) => (node && node.label) ?? ''
|
@@ -244,5 +218,3 @@ export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
|
244
218
|
// },
|
245
219
|
}
|
246
220
|
|
247
|
-
// -- Render Data --
|
248
|
-
|
@@ -2,20 +2,15 @@ import * as d3 from 'd3'
|
|
2
2
|
import type { ComputedDataFn } from '../types/ComputedData'
|
3
3
|
import type { DataGrid, DataGridDatum } from '../types/DataGrid'
|
4
4
|
import type { DataFormatterContext } from '../types/DataFormatter'
|
5
|
-
import type { DataFormatterGrid } from '../types/DataFormatterGrid'
|
5
|
+
import type { DataFormatterGrid, DataFormatterGridGrid } from '../types/DataFormatterGrid'
|
6
6
|
import type { ComputedDataGrid, ComputedDatumGrid } from '../types/ComputedDataGrid'
|
7
7
|
import type { Layout } from '../types/Layout'
|
8
8
|
import { formatValueToLabel, createDefaultDatumId, createDefaultSeriesLabel, createDefaultGroupLabel } from '../utils/orbchartsUtils'
|
9
|
-
import { createAxisLinearScale, createAxisPointScale } from '../utils/d3Utils'
|
10
9
|
import { getMinAndMaxValue, transposeData, createGridSeriesLabels, createGridGroupLabels, seriesColorPredicate } from '../utils/orbchartsUtils'
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
|
17
|
-
export function createTransposedDataGrid (context: DataFormatterContext<'grid'>): DataGridDatumTemp[][] {
|
18
|
-
const { data = [], dataFormatter, chartParams, layout } = context
|
11
|
+
// 統一 DataGrid 格式、並欄列資料轉置為一致方式
|
12
|
+
export function createTransposedDataGrid (data: DataGrid, dataFormatterGrid: DataFormatterGridGrid): DataGridDatum[][] {
|
13
|
+
// const { data = [], dataFormatter, chartParams } = context
|
19
14
|
if (!data.length) {
|
20
15
|
return []
|
21
16
|
}
|
@@ -38,40 +33,28 @@ export function createTransposedDataGrid (context: DataFormatterContext<'grid'>)
|
|
38
33
|
})
|
39
34
|
|
40
35
|
// 完整的資料格式
|
41
|
-
const dataGrid:
|
36
|
+
const dataGrid: DataGridDatum[][] = fullData.map((d, i) => {
|
42
37
|
return d.map((_d, _i) => {
|
43
38
|
|
44
|
-
|
45
|
-
const _visible = dataFormatter.grid.visibleFilter(_d, i, _i, context)
|
46
|
-
|
47
|
-
const datum: DataGridDatumTemp = _d == null
|
39
|
+
const datum: DataGridDatum = _d == null
|
48
40
|
? {
|
49
41
|
id: '',
|
50
42
|
label: '',
|
51
|
-
// tooltipContent: '',
|
52
43
|
data: {},
|
53
44
|
value: null,
|
54
|
-
// _color,
|
55
|
-
_visible
|
56
45
|
}
|
57
46
|
: typeof _d === 'number'
|
58
47
|
? {
|
59
48
|
id: '',
|
60
49
|
label: '',
|
61
|
-
// tooltipContent: '',
|
62
50
|
data: {},
|
63
51
|
value: _d,
|
64
|
-
// _color,
|
65
|
-
_visible
|
66
52
|
}
|
67
53
|
: {
|
68
54
|
id: _d.id ?? '',
|
69
55
|
label: _d.label ?? '',
|
70
|
-
// tooltipContent: _d.tooltipContent ?? '',
|
71
56
|
data: _d.data ?? {},
|
72
57
|
value: _d.value,
|
73
|
-
// _color,
|
74
|
-
_visible
|
75
58
|
}
|
76
59
|
|
77
60
|
return datum
|
@@ -79,7 +62,7 @@ export function createTransposedDataGrid (context: DataFormatterContext<'grid'>)
|
|
79
62
|
})
|
80
63
|
|
81
64
|
// 依seriesDirection轉置資料矩陣
|
82
|
-
const transposedDataGrid = transposeData(
|
65
|
+
const transposedDataGrid = transposeData(dataFormatterGrid.seriesDirection, dataGrid)
|
83
66
|
|
84
67
|
return transposedDataGrid
|
85
68
|
} catch (e) {
|
@@ -87,43 +70,8 @@ export function createTransposedDataGrid (context: DataFormatterContext<'grid'>)
|
|
87
70
|
}
|
88
71
|
}
|
89
72
|
|
90
|
-
export function createGroupScale (transposedDataGrid: DataGridDatumTemp[][], dataFormatter: DataFormatterGrid, layout: Layout) {
|
91
|
-
const groupAxisWidth = (dataFormatter.grid.groupAxis.position === 'top' || dataFormatter.grid.groupAxis.position === 'bottom')
|
92
|
-
? layout.width
|
93
|
-
: layout.height
|
94
|
-
const groupEndIndex = transposedDataGrid[0] ? transposedDataGrid[0].length - 1 : 0
|
95
|
-
const groupScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
|
96
|
-
maxValue: groupEndIndex,
|
97
|
-
minValue: 0,
|
98
|
-
axisWidth: groupAxisWidth,
|
99
|
-
scaleDomain: [0, groupEndIndex], // 不使用dataFormatter設定
|
100
|
-
scaleRange: [0, 1] // 不使用dataFormatter設定
|
101
|
-
})
|
102
|
-
return groupScale
|
103
|
-
}
|
104
|
-
|
105
|
-
export function createSeriesValueScaleArr (transposedDataGrid: DataGridDatumTemp[][], dataFormatter: DataFormatterGrid, layout: Layout) {
|
106
|
-
const valueAxisWidth = (dataFormatter.grid.valueAxis.position === 'left' || dataFormatter.grid.valueAxis.position === 'right')
|
107
|
-
? layout.height
|
108
|
-
: layout.width
|
109
|
-
|
110
|
-
const visibleData = transposedDataGrid.flat().filter(d => d._visible != false)
|
111
|
-
const [minValue, maxValue] = getMinAndMaxValue(visibleData)
|
112
|
-
|
113
|
-
return transposedDataGrid.map((seriesData, seriesIndex) => {
|
114
|
-
const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
|
115
|
-
maxValue,
|
116
|
-
minValue,
|
117
|
-
axisWidth: valueAxisWidth,
|
118
|
-
scaleDomain: [minValue, maxValue], // 不使用dataFormatter設定
|
119
|
-
scaleRange: [0, 1] // 不使用dataFormatter設定
|
120
|
-
})
|
121
|
-
return valueScale
|
122
|
-
})
|
123
|
-
}
|
124
|
-
|
125
73
|
export const computeGridData: ComputedDataFn<'grid'> = (context) => {
|
126
|
-
const { data = [], dataFormatter, chartParams
|
74
|
+
const { data = [], dataFormatter, chartParams } = context
|
127
75
|
if (!data.length) {
|
128
76
|
return []
|
129
77
|
}
|
@@ -133,63 +81,45 @@ export const computeGridData: ComputedDataFn<'grid'> = (context) => {
|
|
133
81
|
try {
|
134
82
|
|
135
83
|
// 依seriesDirection轉置資料矩陣
|
136
|
-
const transposedDataGrid = createTransposedDataGrid(
|
137
|
-
|
138
|
-
const groupScale = createGroupScale(transposedDataGrid, dataFormatter, layout)
|
84
|
+
const transposedDataGrid = createTransposedDataGrid(data, dataFormatter.grid)
|
139
85
|
|
140
86
|
const seriesLabels = createGridSeriesLabels({
|
141
87
|
transposedDataGrid,
|
142
|
-
dataFormatter,
|
88
|
+
dataFormatterGrid: dataFormatter.grid,
|
143
89
|
chartType: 'grid'
|
144
90
|
})
|
145
91
|
const groupLabels = createGridGroupLabels({
|
146
92
|
transposedDataGrid,
|
147
|
-
dataFormatter,
|
93
|
+
dataFormatterGrid: dataFormatter.grid,
|
148
94
|
chartType: 'grid'
|
149
95
|
})
|
150
96
|
|
151
|
-
// 每一個series的valueScale
|
152
|
-
const seriesValueScaleArr = createSeriesValueScaleArr(transposedDataGrid, dataFormatter, layout)
|
153
|
-
|
154
|
-
const zeroYArr = transposedDataGrid.map((series, seriesIndex) => {
|
155
|
-
return seriesValueScaleArr[seriesIndex]!(0)
|
156
|
-
})
|
157
|
-
|
158
97
|
let _index = 0
|
159
98
|
computedDataGrid = transposedDataGrid.map((seriesData, seriesIndex) => {
|
160
99
|
return seriesData.map((groupDatum, groupIndex) => {
|
161
100
|
|
162
101
|
const defaultId = createDefaultDatumId('grid', 0, seriesIndex, groupIndex)
|
163
|
-
// const visible = visibleFilter(groupDatum, seriesIndex, groupIndex, context)
|
164
102
|
const groupLabel = groupLabels[groupIndex]
|
165
|
-
const valueScale = seriesValueScaleArr[seriesIndex]
|
166
|
-
const axisY = valueScale(groupDatum.value ?? 0)
|
167
|
-
const zeroY = zeroYArr[seriesIndex]
|
168
103
|
|
169
104
|
const computedDatum: ComputedDatumGrid = {
|
170
105
|
id: groupDatum.id ? groupDatum.id : defaultId,
|
171
106
|
index: _index,
|
172
107
|
label: groupDatum.label ? groupDatum.label : defaultId,
|
173
108
|
description: groupDatum.description ?? '',
|
174
|
-
// tooltipContent: groupDatum.tooltipContent ? groupDatum.tooltipContent : dataFormatter.tooltipContentFormat(groupDatum, seriesIndex, groupIndex, context),
|
175
109
|
data: groupDatum.data,
|
176
110
|
value: groupDatum.value,
|
177
|
-
// valueLabel: formatValueToLabel(groupDatum.value, dataFormatter.valueFormat),
|
178
111
|
gridIndex: 0,
|
179
|
-
// accSeriesIndex: seriesIndex, // 預設為seriesIndex
|
180
112
|
seriesIndex,
|
181
113
|
seriesLabel: seriesLabels[seriesIndex],
|
182
114
|
groupIndex,
|
183
115
|
groupLabel,
|
184
|
-
// color: groupDatum._color,
|
185
116
|
color: seriesColorPredicate(seriesIndex, chartParams),
|
186
|
-
|
187
|
-
axisY,
|
188
|
-
axisYFromZero: axisY - zeroY,
|
189
|
-
// visible: groupDatum._visible == true && scaleDomainFilter(groupIndex) == true ? true : false // 兩者有一個false即為false
|
190
|
-
visible: groupDatum._visible
|
117
|
+
visible: true // 先給一個預設值
|
191
118
|
}
|
192
119
|
|
120
|
+
// 先建立物件再計算visible欄位
|
121
|
+
computedDatum.visible = dataFormatter.visibleFilter(computedDatum, context)
|
122
|
+
|
193
123
|
_index ++
|
194
124
|
|
195
125
|
return computedDatum
|
@@ -197,7 +127,6 @@ export const computeGridData: ComputedDataFn<'grid'> = (context) => {
|
|
197
127
|
})
|
198
128
|
|
199
129
|
} catch (e) {
|
200
|
-
// console.error(e)
|
201
130
|
throw Error(e)
|
202
131
|
}
|
203
132
|
|
@@ -6,15 +6,17 @@ import {
|
|
6
6
|
groupDataMapObservable,
|
7
7
|
textSizePxObservable } from '../utils/observables'
|
8
8
|
import {
|
9
|
+
gridComputedLayoutDataObservable,
|
9
10
|
gridAxesTransformObservable,
|
10
11
|
gridAxesReverseTransformObservable,
|
11
12
|
gridGraphicTransformObservable,
|
12
13
|
gridGraphicReverseScaleObservable,
|
13
14
|
gridAxesSizeObservable,
|
14
|
-
|
15
|
+
seriesLabelsObservable,
|
15
16
|
gridVisibleComputedDataObservable,
|
16
|
-
|
17
|
-
|
17
|
+
gridVisibleComputedLayoutDataObservable,
|
18
|
+
// isSeriesSeprateObservable,
|
19
|
+
gridContainerPositionObservable } from './gridObservables'
|
18
20
|
|
19
21
|
export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject, observer }) => {
|
20
22
|
|
@@ -22,17 +24,16 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
22
24
|
shareReplay(1)
|
23
25
|
)
|
24
26
|
|
25
|
-
const
|
26
|
-
|
27
|
-
|
28
|
-
}).pipe(
|
29
|
-
|
30
|
-
)
|
27
|
+
// const isSeriesSeprate$ = isSeriesSeprateObservable({
|
28
|
+
// computedData$: observer.computedData$,
|
29
|
+
// fullDataFormatter$: observer.fullDataFormatter$
|
30
|
+
// }).pipe(
|
31
|
+
// shareReplay(1)
|
32
|
+
// )
|
31
33
|
|
32
|
-
const
|
34
|
+
const gridContainerPosition$ = gridContainerPositionObservable({
|
33
35
|
computedData$: observer.computedData$,
|
34
36
|
fullDataFormatter$: observer.fullDataFormatter$,
|
35
|
-
fullChartParams$: observer.fullChartParams$,
|
36
37
|
layout$: observer.layout$,
|
37
38
|
})
|
38
39
|
|
@@ -58,7 +59,7 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
58
59
|
)
|
59
60
|
|
60
61
|
const gridGraphicReverseScale$ = gridGraphicReverseScaleObservable({
|
61
|
-
|
62
|
+
gridContainerPosition$: gridContainerPosition$,
|
62
63
|
gridAxesTransform$: gridAxesTransform$,
|
63
64
|
gridGraphicTransform$: gridGraphicTransform$,
|
64
65
|
})
|
@@ -84,7 +85,7 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
84
85
|
shareReplay(1)
|
85
86
|
)
|
86
87
|
|
87
|
-
const
|
88
|
+
const seriesLabels$ = seriesLabelsObservable({
|
88
89
|
computedData$: observer.computedData$,
|
89
90
|
})
|
90
91
|
|
@@ -100,12 +101,26 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
100
101
|
shareReplay(1)
|
101
102
|
)
|
102
103
|
|
104
|
+
const computedLayoutData$ = gridComputedLayoutDataObservable({
|
105
|
+
computedData$: observer.computedData$,
|
106
|
+
fullDataFormatter$: observer.fullDataFormatter$,
|
107
|
+
layout$: observer.layout$,
|
108
|
+
}).pipe(
|
109
|
+
shareReplay(1)
|
110
|
+
)
|
111
|
+
|
103
112
|
const visibleComputedData$ = gridVisibleComputedDataObservable({
|
104
113
|
computedData$: observer.computedData$,
|
105
114
|
}).pipe(
|
106
115
|
shareReplay(1)
|
107
116
|
)
|
108
117
|
|
118
|
+
const visibleComputedLayoutData$ = gridVisibleComputedLayoutDataObservable({
|
119
|
+
computedLayoutData$: computedLayoutData$,
|
120
|
+
}).pipe(
|
121
|
+
shareReplay(1)
|
122
|
+
)
|
123
|
+
|
109
124
|
|
110
125
|
return {
|
111
126
|
fullParams$: observer.fullParams$,
|
@@ -114,17 +129,19 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
114
129
|
computedData$: observer.computedData$,
|
115
130
|
layout$: observer.layout$,
|
116
131
|
textSizePx$,
|
117
|
-
|
118
|
-
|
132
|
+
// isSeriesSeprate$,
|
133
|
+
gridContainerPosition$,
|
119
134
|
gridAxesTransform$,
|
120
135
|
gridAxesReverseTransform$,
|
121
136
|
gridGraphicTransform$,
|
122
137
|
gridGraphicReverseScale$,
|
123
138
|
gridAxesSize$,
|
124
139
|
gridHighlight$,
|
125
|
-
|
140
|
+
seriesLabels$,
|
126
141
|
SeriesDataMap$,
|
127
142
|
GroupDataMap$,
|
143
|
+
computedLayoutData$,
|
128
144
|
visibleComputedData$,
|
145
|
+
visibleComputedLayoutData$,
|
129
146
|
}
|
130
147
|
}
|