@xplortech/apollo-data 0.0.5 → 0.0.7
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/README.md +15 -91
- package/dist/apollo-data/apollo-data.esm.js +1 -1
- package/dist/apollo-data/p-4d3f0792.entry.js +1 -0
- package/dist/apollo-data/p-C2k3WBpi.js +11 -0
- package/dist/apollo-data/p-D64asVrg.js +2 -0
- package/dist/apollo-data/{p-b7471c12.entry.js → p-e2c3a317.entry.js} +1 -1
- package/dist/cjs/apollo-data-bar-chart_5.cjs.entry.js +1193 -0
- package/dist/cjs/{apollo-data-base-CxVQ-WVP.js → apollo-data-base-COGMOEqL.js} +7 -11
- package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +3 -3
- package/dist/cjs/apollo-data.cjs.js +3 -3
- package/dist/cjs/{index-Cl7HgRm0.js → index-Bd5risOy.js} +116 -63
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/apollo-data-base.js +4 -8
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +10 -9
- package/dist/collection/components/apollo-data-bar/apollo-data-bar.stories.js +122 -0
- package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +1 -1
- package/dist/collection/components/apollo-data-donut/apollo-data-donut.stories.js +132 -0
- package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.js +208 -0
- package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.stories.js +137 -0
- package/dist/collection/components/apollo-data-line/apollo-data-line.js +8 -6
- package/dist/collection/components/apollo-data-line/apollo-data-line.stories.js +122 -0
- package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +1 -1
- package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.stories.js +147 -0
- package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.js +294 -0
- package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.stories.js +126 -0
- package/dist/collection/examples/apollo-data-heat-map.examples.js +131 -0
- package/dist/collection/examples/apollo-data-world-map.examples.js +45 -0
- package/dist/collection/examples/index.js +2 -0
- package/dist/collection/utils/code-generator.js +1 -1
- package/dist/components/apollo-data-bar-chart.js +1 -1
- package/dist/components/apollo-data-donut-chart.js +1 -1
- package/dist/components/apollo-data-heat-map.d.ts +11 -0
- package/dist/components/apollo-data-heat-map.js +1 -0
- package/dist/components/apollo-data-line-chart.js +1 -1
- package/dist/components/apollo-data-scatter-chart.js +1 -1
- package/dist/components/apollo-data-world-map-chart.d.ts +11 -0
- package/dist/components/apollo-data-world-map-chart.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-CfbMSXKd.js +11 -0
- package/dist/components/p-gcjU8DVr.js +1 -0
- package/dist/esm/apollo-data-bar-chart_5.entry.js +1187 -0
- package/dist/esm/{apollo-data-base-BWkrM8dc.js → apollo-data-base-C2k3WBpi.js} +7 -11
- package/dist/esm/apollo-data-donut-chart.entry.js +3 -3
- package/dist/esm/apollo-data.js +4 -4
- package/dist/esm/{index-Bb2nY-Tf.js → index-D64asVrg.js} +116 -63
- package/dist/esm/loader.js +3 -3
- package/dist/types/apollo-data-base.d.ts +2 -2
- package/dist/types/components/apollo-data-bar/apollo-data-bar.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-donut/apollo-data-donut.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.d.ts +140 -0
- package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-line/apollo-data-line.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +1 -3
- package/dist/types/components/apollo-data-scatter/apollo-data-scatter.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-world-map/apollo-data-world-map.d.ts +281 -0
- package/dist/types/components/apollo-data-world-map/apollo-data-world-map.stories.d.ts +5 -0
- package/dist/types/components.d.ts +128 -8
- package/dist/types/examples/apollo-data-heat-map.examples.d.ts +11 -0
- package/dist/types/examples/apollo-data-scatter.examples.d.ts +1 -1
- package/dist/types/examples/apollo-data-world-map.examples.d.ts +11 -0
- package/dist/types/examples/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +23 -2
- package/dist/types/utils/code-generator.d.ts +1 -3
- package/package.json +8 -8
- package/src/examples/apollo-data-bar.examples.ts +157 -157
- package/src/examples/apollo-data-heat-map.examples.ts +147 -0
- package/src/examples/apollo-data-line.examples.ts +91 -91
- package/src/examples/apollo-data-scatter.examples.ts +1 -1
- package/src/examples/apollo-data-world-map.examples.ts +57 -0
- package/src/examples/index.ts +3 -1
- package/dist/apollo-data/p-2nuV5Vny.js +0 -1
- package/dist/apollo-data/p-4ac3c97c.entry.js +0 -1
- package/dist/apollo-data/p-BWkrM8dc.js +0 -11
- package/dist/apollo-data/p-Bb2nY-Tf.js +0 -2
- package/dist/apollo-data/p-e518baac.entry.js +0 -1
- package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +0 -314
- package/dist/cjs/apollo-data-line-chart_2.cjs.entry.js +0 -534
- package/dist/cjs/constants-B3weDEpc.js +0 -5
- package/dist/components/p-7XF5Cax8.js +0 -11
- package/dist/components/p-Dws5s-Xe.js +0 -1
- package/dist/esm/apollo-data-bar-chart.entry.js +0 -312
- package/dist/esm/apollo-data-line-chart_2.entry.js +0 -531
- package/dist/esm/constants-2nuV5Vny.js +0 -3
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, g as getElement, h, H as Host } from './index-Bb2nY-Tf.js';
|
|
2
|
-
import { A as ApolloBase } from './apollo-data-base-BWkrM8dc.js';
|
|
3
|
-
import { C as CHART_COLORS } from './constants-2nuV5Vny.js';
|
|
4
|
-
|
|
5
|
-
const FONT_FAMILY = "apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif";
|
|
6
|
-
function lineStyleToStrokeDash(lineStyle) {
|
|
7
|
-
switch (lineStyle) {
|
|
8
|
-
case 'dashed':
|
|
9
|
-
return [6, 4];
|
|
10
|
-
case 'dotted':
|
|
11
|
-
return [2, 2];
|
|
12
|
-
case 'solid':
|
|
13
|
-
default:
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const ApolloDataLineChart = class extends ApolloBase {
|
|
18
|
-
constructor(hostRef) {
|
|
19
|
-
super();
|
|
20
|
-
registerInstance(this, hostRef);
|
|
21
|
-
}
|
|
22
|
-
get el() { return getElement(this); }
|
|
23
|
-
adData = [];
|
|
24
|
-
adSpec = null;
|
|
25
|
-
static tooltipStylesInjected = false;
|
|
26
|
-
componentDidLoad() {
|
|
27
|
-
this.injectTooltipStyles();
|
|
28
|
-
}
|
|
29
|
-
async componentDidRender() {
|
|
30
|
-
await this.renderChart();
|
|
31
|
-
}
|
|
32
|
-
injectTooltipStyles() {
|
|
33
|
-
if (ApolloDataLineChart.tooltipStylesInjected) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const styleId = 'apollo-data-line-tooltip-styles';
|
|
37
|
-
if (document.getElementById(styleId)) {
|
|
38
|
-
ApolloDataLineChart.tooltipStylesInjected = true;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const style = document.createElement('style');
|
|
42
|
-
style.id = styleId;
|
|
43
|
-
style.textContent = `
|
|
44
|
-
#vg-tooltip-element {
|
|
45
|
-
background-color: #ffffff;
|
|
46
|
-
border: 1px solid #e1e2e8;
|
|
47
|
-
border-radius: 0.25rem;
|
|
48
|
-
box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.05);
|
|
49
|
-
font-family: apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif;
|
|
50
|
-
font-weight: 500;
|
|
51
|
-
padding: 0.25rem 0.75rem;
|
|
52
|
-
pointer-events: none;
|
|
53
|
-
text-align: center;
|
|
54
|
-
transform: translateY(20%);
|
|
55
|
-
white-space: pre;
|
|
56
|
-
z-index: 999999999;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#vg-tooltip-element table tr td.key {
|
|
60
|
-
color: #6a6d7d;
|
|
61
|
-
text-align: center;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#vg-tooltip-element table tr td.value {
|
|
65
|
-
text-align: center;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#vg-tooltip-element.dark-theme {
|
|
69
|
-
background-color: #292632;
|
|
70
|
-
border: 1px solid #6a6d7d;
|
|
71
|
-
box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.5);
|
|
72
|
-
color: #ffffff;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
#vg-tooltip-element::after {
|
|
76
|
-
border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
|
|
77
|
-
border-style: solid;
|
|
78
|
-
border-width: 9px;
|
|
79
|
-
bottom: -17px;
|
|
80
|
-
content: '';
|
|
81
|
-
left: 50%;
|
|
82
|
-
position: absolute;
|
|
83
|
-
transform: translateX(-50%);
|
|
84
|
-
}
|
|
85
|
-
`;
|
|
86
|
-
document.head.appendChild(style);
|
|
87
|
-
ApolloDataLineChart.tooltipStylesInjected = true;
|
|
88
|
-
}
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
async getViewData(data, spec) {
|
|
91
|
-
if (!spec) {
|
|
92
|
-
throw new Error('adSpec is required for apollo-data-line-chart');
|
|
93
|
-
}
|
|
94
|
-
const { tooltipPrefix = '', currencySymbol = '' } = spec;
|
|
95
|
-
if (!data || data.length === 0) {
|
|
96
|
-
throw new Error('Data is required for apollo-data-line-chart');
|
|
97
|
-
}
|
|
98
|
-
const uniqueCategories = Array.from(new Set(data.map(item => item.category)));
|
|
99
|
-
const uniqueXValues = [...new Set(data.map(item => item.xValue))].sort((a, b) => a - b);
|
|
100
|
-
const colorSet = spec?.colorSet ?? CHART_COLORS;
|
|
101
|
-
const xLabelData = uniqueXValues.map(x => {
|
|
102
|
-
const first = data.find(d => d.xValue === x);
|
|
103
|
-
return { xValue: x, displayLabel: first?.xLabel != null ? first.xLabel : String(x) };
|
|
104
|
-
});
|
|
105
|
-
const formatNumber = tooltipPrefix ? '.2f' : '.0f';
|
|
106
|
-
const currencyPrefix = tooltipPrefix ? currencySymbol : '';
|
|
107
|
-
const pointShape = spec.pointStyle ?? 'circle';
|
|
108
|
-
const strokeDash = lineStyleToStrokeDash(spec.lineStyle ?? 'solid');
|
|
109
|
-
const dataSpec = [
|
|
110
|
-
{ name: 'raw', values: data },
|
|
111
|
-
{ name: 'xLabelData', values: xLabelData },
|
|
112
|
-
];
|
|
113
|
-
uniqueCategories.forEach((cat, i) => {
|
|
114
|
-
dataSpec.push({
|
|
115
|
-
name: `series_${i}`,
|
|
116
|
-
source: 'raw',
|
|
117
|
-
transform: [
|
|
118
|
-
{ type: 'filter', expr: `datum.category === ${JSON.stringify(cat)}` },
|
|
119
|
-
{ type: 'collect', sort: { field: 'xValue' } },
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
const lineMarks = uniqueCategories.map((_, i) => ({
|
|
124
|
-
type: 'line',
|
|
125
|
-
from: { data: `series_${i}` },
|
|
126
|
-
encode: {
|
|
127
|
-
enter: {
|
|
128
|
-
x: { scale: 'x', field: 'xValue' },
|
|
129
|
-
y: { scale: 'y', field: 'yValue' },
|
|
130
|
-
stroke: { value: colorSet[i % colorSet.length] },
|
|
131
|
-
strokeWidth: { value: 2 },
|
|
132
|
-
interpolate: { value: 'monotone' },
|
|
133
|
-
...(strokeDash.length > 0 ? { strokeDash: { value: strokeDash } } : {}),
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
}));
|
|
137
|
-
return {
|
|
138
|
-
$schema: 'https://vega.github.io/schema/vega/v5.json',
|
|
139
|
-
config: {
|
|
140
|
-
text: {
|
|
141
|
-
fill: '#6a6d7d',
|
|
142
|
-
font: FONT_FAMILY,
|
|
143
|
-
labelFontSize: 12,
|
|
144
|
-
labelFontWeight: 400,
|
|
145
|
-
},
|
|
146
|
-
axis: {
|
|
147
|
-
labelColor: '#6a6d7d',
|
|
148
|
-
titleColor: '#6a6d7d',
|
|
149
|
-
labelFont: FONT_FAMILY,
|
|
150
|
-
titleFont: FONT_FAMILY,
|
|
151
|
-
titleFontWeight: 400,
|
|
152
|
-
},
|
|
153
|
-
legend: {
|
|
154
|
-
labelColor: '#6a6d7d',
|
|
155
|
-
titleColor: '#6a6d7d',
|
|
156
|
-
labelFont: FONT_FAMILY,
|
|
157
|
-
titleFont: FONT_FAMILY,
|
|
158
|
-
labelFontSize: 12,
|
|
159
|
-
labelLimit: 95,
|
|
160
|
-
},
|
|
161
|
-
title: {
|
|
162
|
-
color: '#6a6d7d',
|
|
163
|
-
font: FONT_FAMILY,
|
|
164
|
-
labelFontSize: 12,
|
|
165
|
-
labelFontWeight: 400,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
height: 250,
|
|
169
|
-
autosize: { type: 'fit-x', contains: 'padding', resize: true },
|
|
170
|
-
signals: [
|
|
171
|
-
{
|
|
172
|
-
name: 'containerW',
|
|
173
|
-
update: 'max(containerSize()[0], 400)',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
name: 'legendColumns',
|
|
177
|
-
update: 'ceil(containerW / 140)',
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
width: { signal: 'containerW' },
|
|
181
|
-
data: dataSpec,
|
|
182
|
-
scales: [
|
|
183
|
-
{
|
|
184
|
-
name: 'x',
|
|
185
|
-
type: 'point',
|
|
186
|
-
domain: uniqueXValues,
|
|
187
|
-
range: 'width',
|
|
188
|
-
padding: 0.5,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: 'xLabels',
|
|
192
|
-
type: 'ordinal',
|
|
193
|
-
domain: { data: 'xLabelData', field: 'xValue' },
|
|
194
|
-
range: { data: 'xLabelData', field: 'displayLabel' },
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: 'y',
|
|
198
|
-
type: 'linear',
|
|
199
|
-
domain: { data: 'raw', field: 'yValue' },
|
|
200
|
-
nice: true,
|
|
201
|
-
zero: true,
|
|
202
|
-
range: 'height',
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: 'color',
|
|
206
|
-
type: 'ordinal',
|
|
207
|
-
domain: uniqueCategories,
|
|
208
|
-
range: spec?.colorSet ?? CHART_COLORS,
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
axes: [
|
|
212
|
-
{
|
|
213
|
-
orient: 'bottom',
|
|
214
|
-
scale: 'x',
|
|
215
|
-
title: spec?.xAxisTitle,
|
|
216
|
-
labelPadding: 12,
|
|
217
|
-
titlePadding: 12,
|
|
218
|
-
labelAngle: -90,
|
|
219
|
-
labelAlign: 'right',
|
|
220
|
-
labelBaseline: 'middle',
|
|
221
|
-
tickSize: 3,
|
|
222
|
-
labelFontSize: 12,
|
|
223
|
-
titleFontSize: 14,
|
|
224
|
-
ticks: false,
|
|
225
|
-
domain: false,
|
|
226
|
-
encode: {
|
|
227
|
-
labels: {
|
|
228
|
-
update: {
|
|
229
|
-
text: { signal: "scale('xLabels', datum.value)" },
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
orient: 'left',
|
|
236
|
-
scale: 'y',
|
|
237
|
-
title: spec?.yAxisTitle || '',
|
|
238
|
-
format: ',.0f',
|
|
239
|
-
grid: true,
|
|
240
|
-
tickCount: 6,
|
|
241
|
-
labelFontSize: 12,
|
|
242
|
-
titleFontSize: 14,
|
|
243
|
-
ticks: false,
|
|
244
|
-
domain: false,
|
|
245
|
-
tickBand: 'extent',
|
|
246
|
-
labelPadding: 10,
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
legends: [
|
|
250
|
-
{
|
|
251
|
-
stroke: 'color',
|
|
252
|
-
orient: 'bottom',
|
|
253
|
-
direction: 'horizontal',
|
|
254
|
-
columns: { signal: 'legendColumns' },
|
|
255
|
-
title: null,
|
|
256
|
-
symbolType: 'stroke',
|
|
257
|
-
symbolStrokeWidth: 3,
|
|
258
|
-
rowPadding: 8,
|
|
259
|
-
symbolOffset: -35,
|
|
260
|
-
symbolSize: 100,
|
|
261
|
-
labelOffset: 8,
|
|
262
|
-
labelLimit: 95,
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
marks: [
|
|
266
|
-
...lineMarks,
|
|
267
|
-
{
|
|
268
|
-
type: 'symbol',
|
|
269
|
-
from: { data: 'raw' },
|
|
270
|
-
encode: {
|
|
271
|
-
enter: {
|
|
272
|
-
x: { scale: 'x', field: 'xValue' },
|
|
273
|
-
y: { scale: 'y', field: 'yValue' },
|
|
274
|
-
fill: { scale: 'color', field: 'category' },
|
|
275
|
-
size: { value: 50 },
|
|
276
|
-
shape: { value: pointShape },
|
|
277
|
-
tooltip: {
|
|
278
|
-
signal: `(datum.xLabel != null ? datum.xLabel : format(datum.xValue, ',.0f')) + ' · ' + datum.category + ': ' + (datum.yLabel != null ? datum.yLabel : '${currencyPrefix}' + format(datum.yValue, ',${formatNumber}'))`,
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
render() {
|
|
287
|
-
return (h(Host, { key: '7799f01536f212d7a06da08c1e463d8529c5bf21' }, h("div", { key: '25463f10bbc0f5443c35ab03b5b53164d9ad1efd', id: "container", style: { width: '100%', height: '100%' } })));
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const ApolloDataScatterChart = class extends ApolloBase {
|
|
292
|
-
constructor(hostRef) {
|
|
293
|
-
super();
|
|
294
|
-
registerInstance(this, hostRef);
|
|
295
|
-
}
|
|
296
|
-
get el() { return getElement(this); }
|
|
297
|
-
/**
|
|
298
|
-
* Represents a single data point in the scatter chart.
|
|
299
|
-
* @property {string} category - Category or group name associated with the data point.
|
|
300
|
-
* This can be used for legend grouping or category-based styling.
|
|
301
|
-
* @property {number} xValue - Numeric value plotted along the X-axis.
|
|
302
|
-
* @property {number} yValue - Numeric value plotted along the Y-axis.
|
|
303
|
-
* @property {PointStyle} [pointStyle] - Optional style override for this specific data point.
|
|
304
|
-
* If provided, it takes precedence over default or category-level styles.
|
|
305
|
-
*/
|
|
306
|
-
adData = [];
|
|
307
|
-
/**
|
|
308
|
-
* Optional specification object for customizing the scatter chart configuration.
|
|
309
|
-
* @property {string} [yAxisTitle] - Label displayed for the Y-axis.
|
|
310
|
-
* @property {string} [xAxisTitle] - Label displayed for the X-axis.
|
|
311
|
-
* @property {PointStyle} [defaultPointStyle] - Default styling applied to all scatter points (e.g., size, color, shape, opacity).
|
|
312
|
-
* @property {PointStyle} [pointStyle] - Global point style override applied to all data points.
|
|
313
|
-
* @property {{ [categoryName: string]: PointStyle }} [categoryPointStyleMap] -
|
|
314
|
-
* A mapping object that allows custom point styles per category name.
|
|
315
|
-
* Each key represents a category, and its value defines the corresponding PointStyle.
|
|
316
|
-
* @property {'auto' | 'none'} [tooltip] - Controls tooltip behavior.
|
|
317
|
-
* 'auto' enables default tooltip rendering, while 'none' disables tooltips.
|
|
318
|
-
*/
|
|
319
|
-
adSpec = {};
|
|
320
|
-
async componentDidRender() {
|
|
321
|
-
await this.renderChart();
|
|
322
|
-
}
|
|
323
|
-
DEFAULT_POINT_STYLE = {
|
|
324
|
-
shape: 'circle',
|
|
325
|
-
opacity: 1,
|
|
326
|
-
color: 'blue',
|
|
327
|
-
size: 1,
|
|
328
|
-
};
|
|
329
|
-
// @ts-ignore
|
|
330
|
-
async getViewData(data, spec) {
|
|
331
|
-
const dataItemsToUse = data.map(dataItem => {
|
|
332
|
-
const pointStylesToUse = {};
|
|
333
|
-
Object.keys(this.DEFAULT_POINT_STYLE).forEach(key => {
|
|
334
|
-
const value = dataItem.pointStyle?.[key] ??
|
|
335
|
-
dataItem?.[key] ??
|
|
336
|
-
spec.categoryPointStyleMap?.[dataItem.category]?.[key] ??
|
|
337
|
-
spec.defaultPointStyle?.[key] ??
|
|
338
|
-
this.DEFAULT_POINT_STYLE[key];
|
|
339
|
-
pointStylesToUse[key] = value;
|
|
340
|
-
});
|
|
341
|
-
return {
|
|
342
|
-
category: dataItem.category,
|
|
343
|
-
xValue: dataItem.xValue,
|
|
344
|
-
yValue: dataItem.yValue,
|
|
345
|
-
color: pointStylesToUse.color,
|
|
346
|
-
shape: pointStylesToUse.shape,
|
|
347
|
-
opacity: pointStylesToUse.opacity,
|
|
348
|
-
};
|
|
349
|
-
});
|
|
350
|
-
const tooltipField = spec?.tooltip === 'auto' ? 'category' : 'none';
|
|
351
|
-
return {
|
|
352
|
-
$schema: 'https://vega.github.io/schema/vega/v6.json',
|
|
353
|
-
description: 'A scatter plot with null values visualized along the axes.',
|
|
354
|
-
width: 450,
|
|
355
|
-
height: 450,
|
|
356
|
-
padding: 5,
|
|
357
|
-
autosize: { type: 'fit', resize: true },
|
|
358
|
-
signals: [
|
|
359
|
-
{ name: 'nullSize', value: 8 },
|
|
360
|
-
{ name: 'nullGap', update: 'nullSize + 10' },
|
|
361
|
-
],
|
|
362
|
-
data: [
|
|
363
|
-
{
|
|
364
|
-
name: 'source',
|
|
365
|
-
values: dataItemsToUse,
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: 'valid',
|
|
369
|
-
source: 'source',
|
|
370
|
-
transform: [
|
|
371
|
-
{
|
|
372
|
-
type: 'filter',
|
|
373
|
-
expr: 'datum.xValue != null && datum.yValue != null',
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
name: 'nullXY',
|
|
379
|
-
source: 'source',
|
|
380
|
-
transform: [
|
|
381
|
-
{
|
|
382
|
-
type: 'filter',
|
|
383
|
-
expr: 'datum.xValue == null && datum.yValue == null',
|
|
384
|
-
},
|
|
385
|
-
{ type: 'aggregate' },
|
|
386
|
-
],
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
name: 'nullY',
|
|
390
|
-
source: 'source',
|
|
391
|
-
transform: [
|
|
392
|
-
{
|
|
393
|
-
type: 'filter',
|
|
394
|
-
expr: 'datum.xValue != null && datum.yValue == null',
|
|
395
|
-
},
|
|
396
|
-
],
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
name: 'nullX',
|
|
400
|
-
source: 'source',
|
|
401
|
-
transform: [
|
|
402
|
-
{
|
|
403
|
-
type: 'filter',
|
|
404
|
-
expr: 'datum.xValue == null && datum.yValue != null',
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
},
|
|
408
|
-
],
|
|
409
|
-
scales: [
|
|
410
|
-
{
|
|
411
|
-
name: 'xscale',
|
|
412
|
-
type: 'linear',
|
|
413
|
-
range: [{ signal: 'nullGap' }, { signal: 'width' }],
|
|
414
|
-
nice: true,
|
|
415
|
-
domain: { data: 'valid', field: 'xValue' },
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
name: 'yscale',
|
|
419
|
-
type: 'linear',
|
|
420
|
-
range: [{ signal: 'height - nullGap' }, 0],
|
|
421
|
-
nice: true,
|
|
422
|
-
domain: { data: 'valid', field: 'yValue' },
|
|
423
|
-
},
|
|
424
|
-
],
|
|
425
|
-
axes: [
|
|
426
|
-
{
|
|
427
|
-
orient: 'bottom',
|
|
428
|
-
scale: 'xscale',
|
|
429
|
-
offset: 5,
|
|
430
|
-
format: 's',
|
|
431
|
-
title: spec?.xAxisTitle || 'X Value',
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
orient: 'left',
|
|
435
|
-
scale: 'yscale',
|
|
436
|
-
offset: 5,
|
|
437
|
-
format: 's',
|
|
438
|
-
title: spec?.yAxisTitle || 'Y Value',
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
marks: [
|
|
442
|
-
{
|
|
443
|
-
type: 'symbol',
|
|
444
|
-
from: { data: 'valid' },
|
|
445
|
-
encode: {
|
|
446
|
-
enter: {
|
|
447
|
-
size: { value: 50 },
|
|
448
|
-
tooltip: { field: tooltipField },
|
|
449
|
-
},
|
|
450
|
-
update: {
|
|
451
|
-
x: { scale: 'xscale', field: 'xValue' },
|
|
452
|
-
y: { scale: 'yscale', field: 'yValue' },
|
|
453
|
-
fill: { field: 'color' },
|
|
454
|
-
fillOpacity: { field: 'opacity' },
|
|
455
|
-
shape: { field: 'shape' },
|
|
456
|
-
zindex: { value: 0 },
|
|
457
|
-
},
|
|
458
|
-
hover: {
|
|
459
|
-
fill: { value: 'firebrick' },
|
|
460
|
-
fillOpacity: { value: 1 },
|
|
461
|
-
zindex: { value: 1 },
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
type: 'symbol',
|
|
467
|
-
from: { data: 'nullY' },
|
|
468
|
-
encode: {
|
|
469
|
-
enter: {
|
|
470
|
-
size: { value: 50 },
|
|
471
|
-
tooltip: { field: tooltipField },
|
|
472
|
-
},
|
|
473
|
-
update: {
|
|
474
|
-
x: { scale: 'xscale', field: 'xValue' },
|
|
475
|
-
y: { signal: 'height - nullSize/2' },
|
|
476
|
-
fill: { value: '#aaa' },
|
|
477
|
-
fillOpacity: { value: 0.2 },
|
|
478
|
-
},
|
|
479
|
-
hover: {
|
|
480
|
-
fill: { value: 'firebrick' },
|
|
481
|
-
fillOpacity: { value: 1 },
|
|
482
|
-
},
|
|
483
|
-
},
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
type: 'symbol',
|
|
487
|
-
from: { data: 'nullX' },
|
|
488
|
-
encode: {
|
|
489
|
-
enter: {
|
|
490
|
-
size: { value: 50 },
|
|
491
|
-
tooltip: { field: 'name' },
|
|
492
|
-
},
|
|
493
|
-
update: {
|
|
494
|
-
x: { signal: 'nullSize/2' },
|
|
495
|
-
y: { scale: 'yscale', field: 'yValue' },
|
|
496
|
-
fill: { value: '#aaa' },
|
|
497
|
-
fillOpacity: { value: 0.2 },
|
|
498
|
-
zindex: { value: 0 },
|
|
499
|
-
},
|
|
500
|
-
hover: {
|
|
501
|
-
fill: { value: 'firebrick' },
|
|
502
|
-
fillOpacity: { value: 1 },
|
|
503
|
-
zindex: { value: 1 },
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
type: 'text',
|
|
509
|
-
interactive: false,
|
|
510
|
-
from: { data: 'nullXY' },
|
|
511
|
-
encode: {
|
|
512
|
-
update: {
|
|
513
|
-
x: { signal: 'nullSize', offset: -4 },
|
|
514
|
-
y: { signal: 'height', offset: 13 },
|
|
515
|
-
text: { signal: "datum.count + ' null'" },
|
|
516
|
-
align: { value: 'right' },
|
|
517
|
-
baseline: { value: 'top' },
|
|
518
|
-
fill: { value: '#999' },
|
|
519
|
-
fontSize: { value: 9 },
|
|
520
|
-
},
|
|
521
|
-
},
|
|
522
|
-
},
|
|
523
|
-
],
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
render() {
|
|
527
|
-
return (h(Host, { key: '60005ab926b0153b3e31729a69f5a64cf6558085' }, h("div", { key: '820de3e0ddbbc2650b9764e279d87531338e72e3', id: "container", style: { width: '100%', height: '100%' } })));
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
export { ApolloDataLineChart as apollo_data_line_chart, ApolloDataScatterChart as apollo_data_scatter_chart };
|