@xplortech/apollo-data 0.0.4-draft.64ed229 → 0.0.4-draft.f74ef02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/apollo-data/apollo-data.esm.js +1 -1
  2. package/dist/apollo-data/p-2nuV5Vny.js +1 -0
  3. package/dist/apollo-data/p-4ac3c97c.entry.js +1 -0
  4. package/dist/apollo-data/p-BWkrM8dc.js +11 -0
  5. package/dist/apollo-data/p-b7471c12.entry.js +1 -0
  6. package/dist/apollo-data/p-e518baac.entry.js +1 -0
  7. package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +314 -0
  8. package/dist/{esm/apollo-data-bar-chart_3.entry.js → cjs/apollo-data-base-CxVQ-WVP.js} +2 -999
  9. package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +408 -0
  10. package/dist/cjs/apollo-data-line-chart_2.cjs.entry.js +534 -0
  11. package/dist/cjs/apollo-data.cjs.js +1 -1
  12. package/dist/cjs/constants-B3weDEpc.js +5 -0
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/collection-manifest.json +2 -1
  15. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +329 -0
  16. package/dist/collection/examples/apollo-data-scatter.examples.js +94 -0
  17. package/dist/components/apollo-data-scatter-chart.d.ts +11 -0
  18. package/dist/components/apollo-data-scatter-chart.js +1 -0
  19. package/dist/esm/apollo-data-bar-chart.entry.js +312 -0
  20. package/dist/{cjs/apollo-data-bar-chart_3.cjs.entry.js → esm/apollo-data-base-BWkrM8dc.js} +1 -1004
  21. package/dist/esm/apollo-data-donut-chart.entry.js +406 -0
  22. package/dist/esm/apollo-data-line-chart_2.entry.js +531 -0
  23. package/dist/esm/apollo-data.js +1 -1
  24. package/dist/esm/constants-2nuV5Vny.js +3 -0
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +329 -0
  27. package/dist/types/components.d.ts +55 -0
  28. package/dist/types/examples/apollo-data-scatter.examples.d.ts +11 -0
  29. package/package.json +1 -1
  30. package/src/examples/apollo-data-scatter.examples.ts +109 -0
  31. package/dist/apollo-data/p-725550f2.entry.js +0 -11
@@ -0,0 +1,329 @@
1
+ import { h, Host } from "@stencil/core";
2
+ import { ApolloBase } from "../../apollo-data-base";
3
+ export class ApolloDataScatterChart extends ApolloBase {
4
+ constructor() {
5
+ super();
6
+ }
7
+ el = null;
8
+ /**
9
+ * Represents a single data point in the scatter chart.
10
+ * @property {string} category - Category or group name associated with the data point.
11
+ * This can be used for legend grouping or category-based styling.
12
+ * @property {number} xValue - Numeric value plotted along the X-axis.
13
+ * @property {number} yValue - Numeric value plotted along the Y-axis.
14
+ * @property {PointStyle} [pointStyle] - Optional style override for this specific data point.
15
+ * If provided, it takes precedence over default or category-level styles.
16
+ */
17
+ adData = [];
18
+ /**
19
+ * Optional specification object for customizing the scatter chart configuration.
20
+ * @property {string} [yAxisTitle] - Label displayed for the Y-axis.
21
+ * @property {string} [xAxisTitle] - Label displayed for the X-axis.
22
+ * @property {PointStyle} [defaultPointStyle] - Default styling applied to all scatter points (e.g., size, color, shape, opacity).
23
+ * @property {PointStyle} [pointStyle] - Global point style override applied to all data points.
24
+ * @property {{ [categoryName: string]: PointStyle }} [categoryPointStyleMap] -
25
+ * A mapping object that allows custom point styles per category name.
26
+ * Each key represents a category, and its value defines the corresponding PointStyle.
27
+ * @property {'auto' | 'none'} [tooltip] - Controls tooltip behavior.
28
+ * 'auto' enables default tooltip rendering, while 'none' disables tooltips.
29
+ */
30
+ adSpec = {};
31
+ async componentDidRender() {
32
+ await this.renderChart();
33
+ }
34
+ DEFAULT_POINT_STYLE = {
35
+ shape: 'circle',
36
+ opacity: 1,
37
+ color: 'blue',
38
+ size: 1,
39
+ };
40
+ // @ts-ignore
41
+ async getViewData(data, spec) {
42
+ const dataItemsToUse = data.map(dataItem => {
43
+ const pointStylesToUse = {};
44
+ Object.keys(this.DEFAULT_POINT_STYLE).forEach(key => {
45
+ const value = dataItem.pointStyle?.[key] ??
46
+ dataItem?.[key] ??
47
+ spec.categoryPointStyleMap?.[dataItem.category]?.[key] ??
48
+ spec.defaultPointStyle?.[key] ??
49
+ this.DEFAULT_POINT_STYLE[key];
50
+ pointStylesToUse[key] = value;
51
+ });
52
+ return {
53
+ category: dataItem.category,
54
+ xValue: dataItem.xValue,
55
+ yValue: dataItem.yValue,
56
+ color: pointStylesToUse.color,
57
+ shape: pointStylesToUse.shape,
58
+ opacity: pointStylesToUse.opacity,
59
+ };
60
+ });
61
+ const tooltipField = spec?.tooltip === 'auto' ? 'category' : 'none';
62
+ return {
63
+ $schema: 'https://vega.github.io/schema/vega/v6.json',
64
+ description: 'A scatter plot with null values visualized along the axes.',
65
+ width: 450,
66
+ height: 450,
67
+ padding: 5,
68
+ autosize: { type: 'fit', resize: true },
69
+ signals: [
70
+ { name: 'nullSize', value: 8 },
71
+ { name: 'nullGap', update: 'nullSize + 10' },
72
+ ],
73
+ data: [
74
+ {
75
+ name: 'source',
76
+ values: dataItemsToUse,
77
+ },
78
+ {
79
+ name: 'valid',
80
+ source: 'source',
81
+ transform: [
82
+ {
83
+ type: 'filter',
84
+ expr: 'datum.xValue != null && datum.yValue != null',
85
+ },
86
+ ],
87
+ },
88
+ {
89
+ name: 'nullXY',
90
+ source: 'source',
91
+ transform: [
92
+ {
93
+ type: 'filter',
94
+ expr: 'datum.xValue == null && datum.yValue == null',
95
+ },
96
+ { type: 'aggregate' },
97
+ ],
98
+ },
99
+ {
100
+ name: 'nullY',
101
+ source: 'source',
102
+ transform: [
103
+ {
104
+ type: 'filter',
105
+ expr: 'datum.xValue != null && datum.yValue == null',
106
+ },
107
+ ],
108
+ },
109
+ {
110
+ name: 'nullX',
111
+ source: 'source',
112
+ transform: [
113
+ {
114
+ type: 'filter',
115
+ expr: 'datum.xValue == null && datum.yValue != null',
116
+ },
117
+ ],
118
+ },
119
+ ],
120
+ scales: [
121
+ {
122
+ name: 'xscale',
123
+ type: 'linear',
124
+ range: [{ signal: 'nullGap' }, { signal: 'width' }],
125
+ nice: true,
126
+ domain: { data: 'valid', field: 'xValue' },
127
+ },
128
+ {
129
+ name: 'yscale',
130
+ type: 'linear',
131
+ range: [{ signal: 'height - nullGap' }, 0],
132
+ nice: true,
133
+ domain: { data: 'valid', field: 'yValue' },
134
+ },
135
+ ],
136
+ axes: [
137
+ {
138
+ orient: 'bottom',
139
+ scale: 'xscale',
140
+ offset: 5,
141
+ format: 's',
142
+ title: spec?.xAxisTitle || 'X Value',
143
+ },
144
+ {
145
+ orient: 'left',
146
+ scale: 'yscale',
147
+ offset: 5,
148
+ format: 's',
149
+ title: spec?.yAxisTitle || 'Y Value',
150
+ },
151
+ ],
152
+ marks: [
153
+ {
154
+ type: 'symbol',
155
+ from: { data: 'valid' },
156
+ encode: {
157
+ enter: {
158
+ size: { value: 50 },
159
+ tooltip: { field: tooltipField },
160
+ },
161
+ update: {
162
+ x: { scale: 'xscale', field: 'xValue' },
163
+ y: { scale: 'yscale', field: 'yValue' },
164
+ fill: { field: 'color' },
165
+ fillOpacity: { field: 'opacity' },
166
+ shape: { field: 'shape' },
167
+ zindex: { value: 0 },
168
+ },
169
+ hover: {
170
+ fill: { value: 'firebrick' },
171
+ fillOpacity: { value: 1 },
172
+ zindex: { value: 1 },
173
+ },
174
+ },
175
+ },
176
+ {
177
+ type: 'symbol',
178
+ from: { data: 'nullY' },
179
+ encode: {
180
+ enter: {
181
+ size: { value: 50 },
182
+ tooltip: { field: tooltipField },
183
+ },
184
+ update: {
185
+ x: { scale: 'xscale', field: 'xValue' },
186
+ y: { signal: 'height - nullSize/2' },
187
+ fill: { value: '#aaa' },
188
+ fillOpacity: { value: 0.2 },
189
+ },
190
+ hover: {
191
+ fill: { value: 'firebrick' },
192
+ fillOpacity: { value: 1 },
193
+ },
194
+ },
195
+ },
196
+ {
197
+ type: 'symbol',
198
+ from: { data: 'nullX' },
199
+ encode: {
200
+ enter: {
201
+ size: { value: 50 },
202
+ tooltip: { field: 'name' },
203
+ },
204
+ update: {
205
+ x: { signal: 'nullSize/2' },
206
+ y: { scale: 'yscale', field: 'yValue' },
207
+ fill: { value: '#aaa' },
208
+ fillOpacity: { value: 0.2 },
209
+ zindex: { value: 0 },
210
+ },
211
+ hover: {
212
+ fill: { value: 'firebrick' },
213
+ fillOpacity: { value: 1 },
214
+ zindex: { value: 1 },
215
+ },
216
+ },
217
+ },
218
+ {
219
+ type: 'text',
220
+ interactive: false,
221
+ from: { data: 'nullXY' },
222
+ encode: {
223
+ update: {
224
+ x: { signal: 'nullSize', offset: -4 },
225
+ y: { signal: 'height', offset: 13 },
226
+ text: { signal: "datum.count + ' null'" },
227
+ align: { value: 'right' },
228
+ baseline: { value: 'top' },
229
+ fill: { value: '#999' },
230
+ fontSize: { value: 9 },
231
+ },
232
+ },
233
+ },
234
+ ],
235
+ };
236
+ }
237
+ render() {
238
+ return (h(Host, { key: '60005ab926b0153b3e31729a69f5a64cf6558085' }, h("div", { key: '820de3e0ddbbc2650b9764e279d87531338e72e3', id: "container", style: { width: '100%', height: '100%' } })));
239
+ }
240
+ static get is() { return "apollo-data-scatter-chart"; }
241
+ static get encapsulation() { return "shadow"; }
242
+ static get properties() {
243
+ return {
244
+ "adData": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string | ScatterDataItem[]",
249
+ "resolved": "ScatterDataItem[] | string",
250
+ "references": {
251
+ "ScatterDataItem": {
252
+ "location": "local",
253
+ "path": "/home/runner/work/apollo/apollo/packages/apollo-data/src/components/apollo-data-scatter/apollo-data-scatter.tsx",
254
+ "id": "src/components/apollo-data-scatter/apollo-data-scatter.tsx::ScatterDataItem"
255
+ }
256
+ }
257
+ },
258
+ "required": false,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [{
262
+ "name": "property",
263
+ "text": "{string} category - Category or group name associated with the data point.\nThis can be used for legend grouping or category-based styling."
264
+ }, {
265
+ "name": "property",
266
+ "text": "{number} xValue - Numeric value plotted along the X-axis."
267
+ }, {
268
+ "name": "property",
269
+ "text": "{number} yValue - Numeric value plotted along the Y-axis."
270
+ }, {
271
+ "name": "property",
272
+ "text": "{PointStyle} [pointStyle] - Optional style override for this specific data point.\nIf provided, it takes precedence over default or category-level styles."
273
+ }],
274
+ "text": "Represents a single data point in the scatter chart."
275
+ },
276
+ "getter": false,
277
+ "setter": false,
278
+ "reflect": false,
279
+ "attribute": "ad-data",
280
+ "defaultValue": "[]"
281
+ },
282
+ "adSpec": {
283
+ "type": "string",
284
+ "mutable": false,
285
+ "complexType": {
286
+ "original": "string | ScatterSpec",
287
+ "resolved": "ScatterSpec | string",
288
+ "references": {
289
+ "ScatterSpec": {
290
+ "location": "local",
291
+ "path": "/home/runner/work/apollo/apollo/packages/apollo-data/src/components/apollo-data-scatter/apollo-data-scatter.tsx",
292
+ "id": "src/components/apollo-data-scatter/apollo-data-scatter.tsx::ScatterSpec"
293
+ }
294
+ }
295
+ },
296
+ "required": false,
297
+ "optional": false,
298
+ "docs": {
299
+ "tags": [{
300
+ "name": "property",
301
+ "text": "{string} [yAxisTitle] - Label displayed for the Y-axis."
302
+ }, {
303
+ "name": "property",
304
+ "text": "{string} [xAxisTitle] - Label displayed for the X-axis."
305
+ }, {
306
+ "name": "property",
307
+ "text": "{PointStyle} [defaultPointStyle] - Default styling applied to all scatter points (e.g., size, color, shape, opacity)."
308
+ }, {
309
+ "name": "property",
310
+ "text": "{PointStyle} [pointStyle] - Global point style override applied to all data points."
311
+ }, {
312
+ "name": "property",
313
+ "text": "{{ [categoryName: string]: PointStyle }} [categoryPointStyleMap] -\nA mapping object that allows custom point styles per category name.\nEach key represents a category, and its value defines the corresponding PointStyle."
314
+ }, {
315
+ "name": "property",
316
+ "text": "{'auto' | 'none'} [tooltip] - Controls tooltip behavior.\n'auto' enables default tooltip rendering, while 'none' disables tooltips."
317
+ }],
318
+ "text": "Optional specification object for customizing the scatter chart configuration."
319
+ },
320
+ "getter": false,
321
+ "setter": false,
322
+ "reflect": false,
323
+ "attribute": "ad-spec",
324
+ "defaultValue": "{}"
325
+ }
326
+ };
327
+ }
328
+ static get elementRef() { return "el"; }
329
+ }
@@ -0,0 +1,94 @@
1
+ export const scatterExamples = [
2
+ {
3
+ name: 'Basic Scatter Chart',
4
+ description: 'A simple scatter chart using default styling and automatic tooltips.',
5
+ props: {
6
+ adData: [
7
+ { category: 'A', xValue: 120, yValue: 4.5 },
8
+ { category: 'B', xValue: 340, yValue: 6.8 },
9
+ { category: 'C', xValue: 560, yValue: 7.2 },
10
+ { category: 'A', xValue: 230, yValue: 5.1 },
11
+ { category: 'B', xValue: 890, yValue: 8.4 },
12
+ ],
13
+ adSpec: {
14
+ xAxisTitle: 'Revenue',
15
+ yAxisTitle: 'Rating',
16
+ tooltip: 'auto',
17
+ },
18
+ },
19
+ notes: 'Uses defaultPointStyle internally. No category-based styling applied.',
20
+ },
21
+ {
22
+ name: 'Category Styled Scatter',
23
+ description: 'Scatter chart with custom styles per category using categoryPointStyleMap.',
24
+ props: {
25
+ adData: [
26
+ { category: 'Mobile', xValue: 150, yValue: 3.8 },
27
+ { category: 'Web', xValue: 980, yValue: 7.9 },
28
+ { category: 'Backend', xValue: 670, yValue: 6.7 },
29
+ { category: 'Mobile', xValue: 300, yValue: 5.6 },
30
+ ],
31
+ adSpec: {
32
+ xAxisTitle: 'Users',
33
+ yAxisTitle: 'Performance Score',
34
+ tooltip: 'auto',
35
+ categoryPointStyleMap: {
36
+ Mobile: { color: '#4ECDC4', size: 100, shape: 'circle' },
37
+ Web: { color: '#FF6B6B', size: 120, shape: 'square' },
38
+ Backend: { color: '#6A6D7D', size: 140, shape: 'triangle' },
39
+ },
40
+ },
41
+ },
42
+ notes: 'Each category overrides the defaultPointStyle using categoryPointStyleMap.',
43
+ },
44
+ {
45
+ name: 'Per-Point Style Override',
46
+ description: 'Individual data points override category and default styles.',
47
+ props: {
48
+ adData: [
49
+ {
50
+ category: 'Sales',
51
+ xValue: 400,
52
+ yValue: 6.2,
53
+ pointStyle: { color: '#FF0000', size: 180, shape: 'triangle' },
54
+ },
55
+ {
56
+ category: 'Sales',
57
+ xValue: 520,
58
+ yValue: 7.1,
59
+ },
60
+ {
61
+ category: 'Marketing',
62
+ xValue: 310,
63
+ yValue: 5.4,
64
+ pointStyle: { color: '#000000', size: 160, shape: 'square' },
65
+ },
66
+ ],
67
+ adSpec: {
68
+ xAxisTitle: 'Spend',
69
+ yAxisTitle: 'Conversion Rate',
70
+ defaultPointStyle: { color: '#6A6D7D', size: 100, shape: 'circle' },
71
+ tooltip: 'auto',
72
+ },
73
+ },
74
+ notes: 'pointStyle at the data level has highest priority over category and default styles.',
75
+ },
76
+ {
77
+ name: 'Tooltip Disabled',
78
+ description: 'Scatter chart with tooltips disabled.',
79
+ props: {
80
+ adData: [
81
+ { category: 'Q1', xValue: 200, yValue: 4.2 },
82
+ { category: 'Q2', xValue: 450, yValue: 6.5 },
83
+ { category: 'Q3', xValue: 700, yValue: 8.1 },
84
+ { category: 'Q4', xValue: 300, yValue: 5.9 },
85
+ ],
86
+ adSpec: {
87
+ xAxisTitle: 'Quarter',
88
+ yAxisTitle: 'Growth',
89
+ tooltip: 'none',
90
+ },
91
+ },
92
+ notes: 'Tooltip interaction is completely disabled in this example.',
93
+ },
94
+ ];
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ApolloDataScatterChart extends Components.ApolloDataScatterChart, HTMLElement {}
4
+ export const ApolloDataScatterChart: {
5
+ prototype: ApolloDataScatterChart;
6
+ new (): ApolloDataScatterChart;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{p as e,h as a,H as l,t}from"./p-Dws5s-Xe.js";import{A as i}from"./p-7XF5Cax8.js";const s=e(class extends i{constructor(e){super(!1),!1!==e&&this.__registerHost(),this.__attachShadow()}get el(){return this}adData=[];adSpec={};async componentDidRender(){await this.renderChart()}DEFAULT_POINT_STYLE={shape:"circle",opacity:1,color:"blue",size:1};async getViewData(e,a){const l=e.map((e=>{const l={};return Object.keys(this.DEFAULT_POINT_STYLE).forEach((t=>{l[t]=e.pointStyle?.[t]??e?.[t]??a.categoryPointStyleMap?.[e.category]?.[t]??a.defaultPointStyle?.[t]??this.DEFAULT_POINT_STYLE[t]})),{category:e.category,xValue:e.xValue,yValue:e.yValue,color:l.color,shape:l.shape,opacity:l.opacity}})),t="auto"===a?.tooltip?"category":"none";return{$schema:"https://vega.github.io/schema/vega/v6.json",description:"A scatter plot with null values visualized along the axes.",width:450,height:450,padding:5,autosize:{type:"fit",resize:!0},signals:[{name:"nullSize",value:8},{name:"nullGap",update:"nullSize + 10"}],data:[{name:"source",values:l},{name:"valid",source:"source",transform:[{type:"filter",expr:"datum.xValue != null && datum.yValue != null"}]},{name:"nullXY",source:"source",transform:[{type:"filter",expr:"datum.xValue == null && datum.yValue == null"},{type:"aggregate"}]},{name:"nullY",source:"source",transform:[{type:"filter",expr:"datum.xValue != null && datum.yValue == null"}]},{name:"nullX",source:"source",transform:[{type:"filter",expr:"datum.xValue == null && datum.yValue != null"}]}],scales:[{name:"xscale",type:"linear",range:[{signal:"nullGap"},{signal:"width"}],nice:!0,domain:{data:"valid",field:"xValue"}},{name:"yscale",type:"linear",range:[{signal:"height - nullGap"},0],nice:!0,domain:{data:"valid",field:"yValue"}}],axes:[{orient:"bottom",scale:"xscale",offset:5,format:"s",title:a?.xAxisTitle||"X Value"},{orient:"left",scale:"yscale",offset:5,format:"s",title:a?.yAxisTitle||"Y Value"}],marks:[{type:"symbol",from:{data:"valid"},encode:{enter:{size:{value:50},tooltip:{field:t}},update:{x:{scale:"xscale",field:"xValue"},y:{scale:"yscale",field:"yValue"},fill:{field:"color"},fillOpacity:{field:"opacity"},shape:{field:"shape"},zindex:{value:0}},hover:{fill:{value:"firebrick"},fillOpacity:{value:1},zindex:{value:1}}}},{type:"symbol",from:{data:"nullY"},encode:{enter:{size:{value:50},tooltip:{field:t}},update:{x:{scale:"xscale",field:"xValue"},y:{signal:"height - nullSize/2"},fill:{value:"#aaa"},fillOpacity:{value:.2}},hover:{fill:{value:"firebrick"},fillOpacity:{value:1}}}},{type:"symbol",from:{data:"nullX"},encode:{enter:{size:{value:50},tooltip:{field:"name"}},update:{x:{signal:"nullSize/2"},y:{scale:"yscale",field:"yValue"},fill:{value:"#aaa"},fillOpacity:{value:.2},zindex:{value:0}},hover:{fill:{value:"firebrick"},fillOpacity:{value:1},zindex:{value:1}}}},{type:"text",interactive:!1,from:{data:"nullXY"},encode:{update:{x:{signal:"nullSize",offset:-4},y:{signal:"height",offset:13},text:{signal:"datum.count + ' null'"},align:{value:"right"},baseline:{value:"top"},fill:{value:"#999"},fontSize:{value:9}}}}]}}render(){return a(l,{key:"60005ab926b0153b3e31729a69f5a64cf6558085"},a("div",{key:"820de3e0ddbbc2650b9764e279d87531338e72e3",id:"container",style:{width:"100%",height:"100%"}}))}},[513,"apollo-data-scatter-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]),u=s,n=function(){"undefined"!=typeof customElements&&["apollo-data-scatter-chart"].forEach((e=>{"apollo-data-scatter-chart"===e&&(customElements.get(t(e))||customElements.define(t(e),s))}))};export{u as ApolloDataScatterChart,n as defineCustomElement}