@xplortech/apollo-data 0.0.5 → 0.0.6

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 (80) hide show
  1. package/README.md +15 -91
  2. package/dist/apollo-data/apollo-data.esm.js +1 -1
  3. package/dist/apollo-data/p-25841a73.entry.js +1 -0
  4. package/dist/apollo-data/p-839050b7.entry.js +1 -0
  5. package/dist/apollo-data/p-C2k3WBpi.js +11 -0
  6. package/dist/apollo-data/p-D64asVrg.js +2 -0
  7. package/dist/apollo-data/{p-b7471c12.entry.js → p-e2c3a317.entry.js} +1 -1
  8. package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +10 -9
  9. package/dist/cjs/{apollo-data-base-CxVQ-WVP.js → apollo-data-base-COGMOEqL.js} +7 -11
  10. package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +3 -3
  11. package/dist/cjs/{apollo-data-line-chart_2.cjs.entry.js → apollo-data-heat-map_4.cjs.entry.js} +358 -9
  12. package/dist/cjs/apollo-data.cjs.js +3 -3
  13. package/dist/cjs/{index-Cl7HgRm0.js → index-Bd5risOy.js} +116 -63
  14. package/dist/cjs/loader.cjs.js +2 -2
  15. package/dist/collection/apollo-data-base.js +4 -8
  16. package/dist/collection/collection-manifest.json +5 -2
  17. package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +8 -7
  18. package/dist/collection/components/apollo-data-bar/apollo-data-bar.stories.js +122 -0
  19. package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +1 -1
  20. package/dist/collection/components/apollo-data-donut/apollo-data-donut.stories.js +132 -0
  21. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.js +208 -0
  22. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.stories.js +137 -0
  23. package/dist/collection/components/apollo-data-line/apollo-data-line.js +8 -6
  24. package/dist/collection/components/apollo-data-line/apollo-data-line.stories.js +122 -0
  25. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +1 -1
  26. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.stories.js +147 -0
  27. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.js +294 -0
  28. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.stories.js +126 -0
  29. package/dist/collection/examples/apollo-data-heat-map.examples.js +131 -0
  30. package/dist/collection/examples/apollo-data-world-map.examples.js +45 -0
  31. package/dist/collection/examples/index.js +2 -0
  32. package/dist/collection/utils/code-generator.js +1 -1
  33. package/dist/components/apollo-data-bar-chart.js +1 -1
  34. package/dist/components/apollo-data-donut-chart.js +1 -1
  35. package/dist/components/apollo-data-heat-map.d.ts +11 -0
  36. package/dist/components/apollo-data-heat-map.js +1 -0
  37. package/dist/components/apollo-data-line-chart.js +1 -1
  38. package/dist/components/apollo-data-scatter-chart.js +1 -1
  39. package/dist/components/apollo-data-world-map-chart.d.ts +11 -0
  40. package/dist/components/apollo-data-world-map-chart.js +1 -0
  41. package/dist/components/index.js +1 -1
  42. package/dist/components/p-CfbMSXKd.js +11 -0
  43. package/dist/components/p-gcjU8DVr.js +1 -0
  44. package/dist/esm/apollo-data-bar-chart.entry.js +10 -9
  45. package/dist/esm/{apollo-data-base-BWkrM8dc.js → apollo-data-base-C2k3WBpi.js} +7 -11
  46. package/dist/esm/apollo-data-donut-chart.entry.js +3 -3
  47. package/dist/esm/{apollo-data-line-chart_2.entry.js → apollo-data-heat-map_4.entry.js} +357 -10
  48. package/dist/esm/apollo-data.js +4 -4
  49. package/dist/esm/{index-Bb2nY-Tf.js → index-D64asVrg.js} +116 -63
  50. package/dist/esm/loader.js +3 -3
  51. package/dist/types/apollo-data-base.d.ts +2 -2
  52. package/dist/types/components/apollo-data-bar/apollo-data-bar.stories.d.ts +5 -0
  53. package/dist/types/components/apollo-data-donut/apollo-data-donut.stories.d.ts +5 -0
  54. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.d.ts +140 -0
  55. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.stories.d.ts +5 -0
  56. package/dist/types/components/apollo-data-line/apollo-data-line.stories.d.ts +5 -0
  57. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +1 -3
  58. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.stories.d.ts +5 -0
  59. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.d.ts +281 -0
  60. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.stories.d.ts +5 -0
  61. package/dist/types/components.d.ts +128 -8
  62. package/dist/types/examples/apollo-data-heat-map.examples.d.ts +11 -0
  63. package/dist/types/examples/apollo-data-scatter.examples.d.ts +1 -1
  64. package/dist/types/examples/apollo-data-world-map.examples.d.ts +11 -0
  65. package/dist/types/examples/index.d.ts +2 -0
  66. package/dist/types/stencil-public-runtime.d.ts +23 -2
  67. package/dist/types/utils/code-generator.d.ts +1 -3
  68. package/package.json +8 -8
  69. package/src/examples/apollo-data-bar.examples.ts +157 -157
  70. package/src/examples/apollo-data-heat-map.examples.ts +147 -0
  71. package/src/examples/apollo-data-line.examples.ts +91 -91
  72. package/src/examples/apollo-data-scatter.examples.ts +1 -1
  73. package/src/examples/apollo-data-world-map.examples.ts +57 -0
  74. package/src/examples/index.ts +3 -1
  75. package/dist/apollo-data/p-4ac3c97c.entry.js +0 -1
  76. package/dist/apollo-data/p-BWkrM8dc.js +0 -11
  77. package/dist/apollo-data/p-Bb2nY-Tf.js +0 -2
  78. package/dist/apollo-data/p-e518baac.entry.js +0 -1
  79. package/dist/components/p-7XF5Cax8.js +0 -11
  80. package/dist/components/p-Dws5s-Xe.js +0 -1
@@ -0,0 +1,294 @@
1
+ import { h, Host } from "@stencil/core";
2
+ import { ApolloBase } from "../../apollo-data-base";
3
+ export class ApolloDataWorldMapChart extends ApolloBase {
4
+ constructor() {
5
+ super();
6
+ }
7
+ el = null;
8
+ /**
9
+ * Represents a single data point in the world map chart.
10
+ * @property {number} lon - Longitude coordinate used to position the point on the map.
11
+ * @property {number} lat - Latitude coordinate used to position the point on the map.
12
+ * @property {number} value - A numeric metric tied to the point.
13
+ * @property {string} label - Label displayed for the place or location represented by the point.
14
+ */
15
+ adData = [];
16
+ /**
17
+ * @property {string} pinColor - Color of the pin representing the point.
18
+ * @property {'circle' | 'square' | 'triangle'} pinShape - Shape of the pin representing the point.
19
+ */
20
+ adSpec = {};
21
+ async componentDidRender() {
22
+ await this.renderChart();
23
+ }
24
+ // @ts-ignore
25
+ // eslint-disable-next-line class-methods-use-this
26
+ async getViewData(data, spec) {
27
+ const pinColor = spec?.pinColor || '#d3544b';
28
+ const pinShape = spec?.pinShape || 'circle';
29
+ return {
30
+ $schema: 'https://vega.github.io/schema/vega/v6.json',
31
+ description: 'World map + tooltip + points.',
32
+ width: 600,
33
+ height: 400,
34
+ autosize: 'none',
35
+ background: '#cfe3f1',
36
+ signals: [
37
+ {
38
+ name: 'scale',
39
+ value: 85,
40
+ on: [
41
+ {
42
+ events: { type: 'wheel', consume: true },
43
+ update: 'clamp(scale * pow(1.002, -event.deltaY), 85, 2000)',
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ name: 'xc',
49
+ value: 0,
50
+ on: [{ events: 'mousedown', update: 'x()' }],
51
+ },
52
+ {
53
+ name: 'yc',
54
+ value: 0,
55
+ on: [{ events: 'mousedown', update: 'y()' }],
56
+ },
57
+ {
58
+ name: 'xo',
59
+ value: 300,
60
+ on: [{ events: 'mousedown', update: 'tx' }],
61
+ },
62
+ {
63
+ name: 'yo',
64
+ value: 175,
65
+ on: [{ events: 'mousedown', update: 'ty' }],
66
+ },
67
+ {
68
+ name: 'tx',
69
+ value: 300,
70
+ on: [
71
+ {
72
+ events: '[mousedown, window:mouseup] > window:mousemove',
73
+ update: 'xo - (x() - xc)',
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ name: 'ty',
79
+ value: 270,
80
+ on: [
81
+ {
82
+ events: '[mousedown, window:mouseup] > window:mousemove',
83
+ update: 'clamp(yo + y() - yc, -scale * 0.5, scale * 2.5 + height)',
84
+ },
85
+ ],
86
+ },
87
+ ],
88
+ projections: [
89
+ {
90
+ name: 'projection',
91
+ type: 'mercator',
92
+ scale: { signal: 'scale' },
93
+ rotate: [{ signal: '-(tx - width / 2) * 180 / (scale * PI)' }, 0, 0],
94
+ center: [0, 0],
95
+ translate: [{ signal: 'width / 2' }, { signal: 'ty' }],
96
+ },
97
+ ],
98
+ data: [
99
+ {
100
+ name: 'names',
101
+ url: 'https://raw.githubusercontent.com/KoGor/Map-Icons-Generator/master/data/world-110m-country-names.tsv',
102
+ format: { type: 'tsv' },
103
+ transform: [{ type: 'formula', as: 'id', expr: 'toNumber(datum.id)' }],
104
+ },
105
+ {
106
+ name: 'metrics',
107
+ values: data,
108
+ },
109
+ {
110
+ name: 'world',
111
+ url: 'https://vega.github.io/editor/data/world-110m.json',
112
+ format: { type: 'topojson', feature: 'countries' },
113
+ transform: [
114
+ {
115
+ type: 'lookup',
116
+ from: 'names',
117
+ key: 'id',
118
+ fields: ['id'],
119
+ values: ['name'],
120
+ as: ['name'],
121
+ },
122
+ { type: 'filter', expr: "datum.name != 'Antarctica'" },
123
+ ],
124
+ },
125
+ {
126
+ name: 'points',
127
+ source: 'metrics',
128
+ transform: [
129
+ { type: 'filter', expr: 'isValid(datum.lon) && isValid(datum.lat)' },
130
+ {
131
+ type: 'geopoint',
132
+ projection: 'projection',
133
+ fields: ['lon', 'lat'],
134
+ as: ['x', 'y'],
135
+ },
136
+ ],
137
+ },
138
+ {
139
+ name: 'continentLabels',
140
+ values: [
141
+ { name: 'North America', lon: -105, lat: 45 },
142
+ { name: 'South America', lon: -60, lat: -15 },
143
+ { name: 'Europe', lon: 15, lat: 52 },
144
+ { name: 'Africa', lon: 20, lat: 5 },
145
+ { name: 'Asia', lon: 90, lat: 35 },
146
+ { name: 'Oceania', lon: 135, lat: -25 },
147
+ ],
148
+ transform: [
149
+ {
150
+ type: 'geopoint',
151
+ projection: 'projection',
152
+ fields: ['lon', 'lat'],
153
+ as: ['x', 'y'],
154
+ },
155
+ ],
156
+ },
157
+ ],
158
+ marks: [
159
+ {
160
+ type: 'shape',
161
+ from: { data: 'world' },
162
+ transform: [{ type: 'geoshape', projection: 'projection' }],
163
+ encode: {
164
+ update: {
165
+ fill: { value: '#8fbf8f' },
166
+ stroke: { value: '#6c8c8c' },
167
+ strokeWidth: { value: 0.7 },
168
+ tooltip: { signal: "{Country: datum.name ? datum.name : 'Unknown'}" },
169
+ },
170
+ hover: {
171
+ stroke: { value: '#2b3a42' },
172
+ strokeWidth: { value: 1.3 },
173
+ },
174
+ },
175
+ },
176
+ {
177
+ type: 'symbol',
178
+ from: { data: 'points' },
179
+ encode: {
180
+ update: {
181
+ x: { field: 'x' },
182
+ y: { field: 'y' },
183
+ size: { value: 80 },
184
+ fill: { value: pinColor },
185
+ stroke: { value: 'white' },
186
+ shape: { value: pinShape },
187
+ strokeWidth: { value: 1 },
188
+ tooltip: {
189
+ signal: '{Label: datum.label, Value: datum.value, Latitude: datum.lat, Longitude: datum.lon}',
190
+ },
191
+ },
192
+ },
193
+ },
194
+ {
195
+ type: 'text',
196
+ from: { data: 'continentLabels' },
197
+ encode: {
198
+ update: {
199
+ x: { field: 'x' },
200
+ y: { field: 'y' },
201
+ text: { field: 'name' },
202
+ align: { value: 'center' },
203
+ baseline: { value: 'middle' },
204
+ fontSize: { value: 12 },
205
+ fontWeight: { value: '600' },
206
+ fill: { value: '#2b3a42' },
207
+ fillOpacity: { value: 0.5 },
208
+ },
209
+ },
210
+ },
211
+ ],
212
+ };
213
+ }
214
+ render() {
215
+ return (h(Host, { key: '8053ea3b9706cdd03a430157b3f63e93c1201d1f' }, h("div", { key: '514807ae8dd4868d3d74e86c4260b7b9967c0ac2', id: "container", style: { width: '100%', height: '100%' } })));
216
+ }
217
+ static get is() { return "apollo-data-world-map-chart"; }
218
+ static get encapsulation() { return "shadow"; }
219
+ static get properties() {
220
+ return {
221
+ "adData": {
222
+ "type": "string",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "string | WorldMapDataItem[]",
226
+ "resolved": "WorldMapDataItem[] | string",
227
+ "references": {
228
+ "WorldMapDataItem": {
229
+ "location": "local",
230
+ "path": "/home/runner/work/apollo/apollo/packages/apollo-data/src/components/apollo-data-world-map/apollo-data-world-map.tsx",
231
+ "id": "src/components/apollo-data-world-map/apollo-data-world-map.tsx::WorldMapDataItem"
232
+ }
233
+ }
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [{
239
+ "name": "property",
240
+ "text": "{number} lon - Longitude coordinate used to position the point on the map."
241
+ }, {
242
+ "name": "property",
243
+ "text": "{number} lat - Latitude coordinate used to position the point on the map."
244
+ }, {
245
+ "name": "property",
246
+ "text": "{number} value - A numeric metric tied to the point."
247
+ }, {
248
+ "name": "property",
249
+ "text": "{string} label - Label displayed for the place or location represented by the point."
250
+ }],
251
+ "text": "Represents a single data point in the world map chart."
252
+ },
253
+ "getter": false,
254
+ "setter": false,
255
+ "reflect": false,
256
+ "attribute": "ad-data",
257
+ "defaultValue": "[]"
258
+ },
259
+ "adSpec": {
260
+ "type": "string",
261
+ "mutable": false,
262
+ "complexType": {
263
+ "original": "string | WorldMapSpec",
264
+ "resolved": "WorldMapSpec | string",
265
+ "references": {
266
+ "WorldMapSpec": {
267
+ "location": "local",
268
+ "path": "/home/runner/work/apollo/apollo/packages/apollo-data/src/components/apollo-data-world-map/apollo-data-world-map.tsx",
269
+ "id": "src/components/apollo-data-world-map/apollo-data-world-map.tsx::WorldMapSpec"
270
+ }
271
+ }
272
+ },
273
+ "required": false,
274
+ "optional": false,
275
+ "docs": {
276
+ "tags": [{
277
+ "name": "property",
278
+ "text": "{string} pinColor - Color of the pin representing the point."
279
+ }, {
280
+ "name": "property",
281
+ "text": "{'circle' | 'square' | 'triangle'} pinShape - Shape of the pin representing the point."
282
+ }],
283
+ "text": ""
284
+ },
285
+ "getter": false,
286
+ "setter": false,
287
+ "reflect": false,
288
+ "attribute": "ad-spec",
289
+ "defaultValue": "{}"
290
+ }
291
+ };
292
+ }
293
+ static get elementRef() { return "el"; }
294
+ }
@@ -0,0 +1,126 @@
1
+ import { html } from "lit-html";
2
+ import { worldMapExamples } from "../../examples/apollo-data-world-map.examples";
3
+ import { generateReactCode, generateVueCode, generateWebComponentCode, generateInstallationDocs } from "../../utils/code-generator";
4
+ function getCodeForFramework(props, framework) {
5
+ switch (framework) {
6
+ case 'vue':
7
+ return generateVueCode('apollo-data-world-map-chart', props);
8
+ case 'webcomponent':
9
+ return generateWebComponentCode('apollo-data-world-map-chart', props);
10
+ case 'react':
11
+ default:
12
+ return generateReactCode('apollo-data-world-map-chart', props);
13
+ }
14
+ }
15
+ const meta = {
16
+ title: 'Apollo Data/World Map Chart',
17
+ tags: ['autodocs'],
18
+ argTypes: {
19
+ adData: {
20
+ control: 'object',
21
+ description: 'Array of map data items. Each item contains geographic coordinates (lon/lat), a label, and a value displayed in the tooltip.',
22
+ table: {
23
+ type: {
24
+ summary: 'WorldMapDataItem[]',
25
+ detail: 'interface WorldMapDataItem {\n lon: number;\n lat: number;\n value: number;\n label: string;\n}',
26
+ },
27
+ defaultValue: { summary: '[]' },
28
+ },
29
+ },
30
+ adSpec: {
31
+ control: 'object',
32
+ description: 'Optional specification object for world map customization (for example pin color and pin shape).',
33
+ table: {
34
+ type: {
35
+ summary: 'WorldMapSpec',
36
+ detail: "interface WorldMapSpec {\n pinColor?: string;\n pinShape?: 'circle' | 'square' | 'triangle';\n}",
37
+ },
38
+ defaultValue: { summary: '{}' },
39
+ },
40
+ },
41
+ },
42
+ decorators: [
43
+ (story, context) => {
44
+ const framework = context.globals?.framework || 'react';
45
+ setTimeout(() => {
46
+ const doc = globalThis.document;
47
+ if (doc) {
48
+ const installSections = {
49
+ react: doc.querySelector('.install-react'),
50
+ vue: doc.querySelector('.install-vue'),
51
+ webcomponent: doc.querySelector('.install-webcomponent'),
52
+ };
53
+ Object.values(installSections).forEach((section) => {
54
+ if (section) {
55
+ section.setAttribute('style', 'display: none;');
56
+ }
57
+ });
58
+ const selectedSection = installSections[framework];
59
+ if (selectedSection) {
60
+ selectedSection.setAttribute('style', 'display: block;');
61
+ }
62
+ }
63
+ }, 0);
64
+ return story();
65
+ },
66
+ ],
67
+ parameters: {
68
+ docs: {
69
+ description: {
70
+ component: `${generateInstallationDocs('react', 'apollo-data-world-map-chart')}
71
+
72
+ ${generateInstallationDocs('vue', 'apollo-data-world-map-chart')}
73
+
74
+ ${generateInstallationDocs('webcomponent', 'apollo-data-world-map-chart')}
75
+
76
+ ---
77
+
78
+ ## Description
79
+
80
+ A world map chart component built with Vega that renders countries with interactive city markers using longitude and latitude coordinates.
81
+
82
+ **Tip:** Use the Framework selector in the toolbar above to switch between React, Vue, and Web Component installation instructions and code examples.`,
83
+ },
84
+ },
85
+ viewMode: 'story',
86
+ },
87
+ };
88
+ export default meta;
89
+ const chartWrapper = (args) => html `
90
+ <div style="width: 800px; height: 460px;">
91
+ <apollo-data-world-map-chart .adData=${args.adData} .adSpec=${args.adSpec}></apollo-data-world-map-chart>
92
+ </div>
93
+ `;
94
+ export const ApolloDataWorldMap = {
95
+ args: {
96
+ adData: worldMapExamples[0].props.adData,
97
+ adSpec: { ...(worldMapExamples[0].props.adSpec || {}), pinShape: 'circle' },
98
+ },
99
+ render: args => chartWrapper(args),
100
+ parameters: {
101
+ codeGenerator: (args, framework) => getCodeForFramework(args, framework),
102
+ docs: {
103
+ description: {
104
+ story: 'Interactive world map chart. Modify **adData** and **adSpec** in the controls, switch frameworks from the toolbar, and view generated usage code in the Code tab.',
105
+ },
106
+ source: {
107
+ language: 'tsx',
108
+ type: 'dynamic',
109
+ transform: (_code, storyContext) => {
110
+ try {
111
+ const framework = storyContext?.globals?.framework || 'react';
112
+ const props = {
113
+ adData: storyContext?.args?.adData || [],
114
+ adSpec: storyContext?.args?.adSpec || {},
115
+ };
116
+ return getCodeForFramework(props, framework);
117
+ }
118
+ catch (error) {
119
+ console.error('Error in transform function:', error);
120
+ return `<apollo-data-world-map-chart />`;
121
+ }
122
+ },
123
+ },
124
+ },
125
+ },
126
+ };
@@ -0,0 +1,131 @@
1
+ /** Average high temperature (°F) by day of month and month – weather heat map. */
2
+ const weatherDayVsMonth = (() => {
3
+ const days = ['1', '5', '10', '15', '20', '25', '30'];
4
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
5
+ // Base avg high °F by month (mid-latitude style), with slight variation by day-in-month
6
+ const baseByMonth = [42, 45, 54, 64, 74, 82, 87, 85, 78, 66, 54, 44];
7
+ const items = [];
8
+ days.forEach((day, i) => {
9
+ months.forEach((month, j) => {
10
+ const base = baseByMonth[j];
11
+ const dayOffset = (i - 3) * 2; // slightly warmer in middle of month
12
+ items.push({ xLabel: month, yLabel: `Day ${day}`, value: Math.round(base + dayOffset) });
13
+ });
14
+ });
15
+ return items;
16
+ })();
17
+ /** Quarterly revenue (K) by region – typical sales dashboard. */
18
+ const salesByRegionQuarter = [
19
+ { xLabel: 'Q1', yLabel: 'North', value: 142 },
20
+ { xLabel: 'Q2', yLabel: 'North', value: 168 },
21
+ { xLabel: 'Q3', yLabel: 'North', value: 195 },
22
+ { xLabel: 'Q4', yLabel: 'North', value: 218 },
23
+ { xLabel: 'Q1', yLabel: 'South', value: 98 },
24
+ { xLabel: 'Q2', yLabel: 'South', value: 112 },
25
+ { xLabel: 'Q3', yLabel: 'South', value: 134 },
26
+ { xLabel: 'Q4', yLabel: 'South', value: 156 },
27
+ { xLabel: 'Q1', yLabel: 'East', value: 187 },
28
+ { xLabel: 'Q2', yLabel: 'East', value: 203 },
29
+ { xLabel: 'Q3', yLabel: 'East', value: 221 },
30
+ { xLabel: 'Q4', yLabel: 'East', value: 245 },
31
+ { xLabel: 'Q1', yLabel: 'West', value: 76 },
32
+ { xLabel: 'Q2', yLabel: 'West', value: 89 },
33
+ { xLabel: 'Q3', yLabel: 'West', value: 102 },
34
+ { xLabel: 'Q4', yLabel: 'West', value: 118 },
35
+ ];
36
+ /** Support tickets by product and month. */
37
+ const supportTicketsByProductMonth = [
38
+ { xLabel: 'Jan', yLabel: 'Billing', value: 124 },
39
+ { xLabel: 'Feb', yLabel: 'Billing', value: 98 },
40
+ { xLabel: 'Mar', yLabel: 'Billing', value: 156 },
41
+ { xLabel: 'Apr', yLabel: 'Billing', value: 87 },
42
+ { xLabel: 'May', yLabel: 'Billing', value: 112 },
43
+ { xLabel: 'Jun', yLabel: 'Billing', value: 134 },
44
+ { xLabel: 'Jan', yLabel: 'Onboarding', value: 89 },
45
+ { xLabel: 'Feb', yLabel: 'Onboarding', value: 102 },
46
+ { xLabel: 'Mar', yLabel: 'Onboarding', value: 145 },
47
+ { xLabel: 'Apr', yLabel: 'Onboarding', value: 78 },
48
+ { xLabel: 'May', yLabel: 'Onboarding', value: 91 },
49
+ { xLabel: 'Jun', yLabel: 'Onboarding', value: 67 },
50
+ { xLabel: 'Jan', yLabel: 'API', value: 45 },
51
+ { xLabel: 'Feb', yLabel: 'API', value: 52 },
52
+ { xLabel: 'Mar', yLabel: 'API', value: 61 },
53
+ { xLabel: 'Apr', yLabel: 'API', value: 38 },
54
+ { xLabel: 'May', yLabel: 'API', value: 49 },
55
+ { xLabel: 'Jun', yLabel: 'API', value: 55 },
56
+ { xLabel: 'Jan', yLabel: 'Mobile App', value: 203 },
57
+ { xLabel: 'Feb', yLabel: 'Mobile App', value: 187 },
58
+ { xLabel: 'Mar', yLabel: 'Mobile App', value: 221 },
59
+ { xLabel: 'Apr', yLabel: 'Mobile App', value: 198 },
60
+ { xLabel: 'May', yLabel: 'Mobile App', value: 234 },
61
+ { xLabel: 'Jun', yLabel: 'Mobile App', value: 256 },
62
+ ];
63
+ /** Average response time (ms) by service and environment. */
64
+ const responseTimeByServiceEnv = [
65
+ { xLabel: 'Staging', yLabel: 'Auth', value: 42 },
66
+ { xLabel: 'Production', yLabel: 'Auth', value: 38 },
67
+ { xLabel: 'Staging', yLabel: 'Payments', value: 128 },
68
+ { xLabel: 'Production', yLabel: 'Payments', value: 95 },
69
+ { xLabel: 'Staging', yLabel: 'Search', value: 215 },
70
+ { xLabel: 'Production', yLabel: 'Search', value: 178 },
71
+ { xLabel: 'Staging', yLabel: 'Notifications', value: 56 },
72
+ { xLabel: 'Production', yLabel: 'Notifications', value: 48 },
73
+ { xLabel: 'Staging', yLabel: 'Reporting', value: 890 },
74
+ { xLabel: 'Production', yLabel: 'Reporting', value: 720 },
75
+ ];
76
+ export const heatMapExamples = [
77
+ {
78
+ name: 'Weather: day vs month',
79
+ description: 'Average high temperature (°F) by day of month and month.',
80
+ props: {
81
+ adData: weatherDayVsMonth,
82
+ adSpec: {
83
+ xAxisTitle: 'Month',
84
+ yAxisTitle: 'Day of month',
85
+ colorRange: ['#2166ac', '#b2182b'],
86
+ tooltip: 'auto',
87
+ },
88
+ },
89
+ notes: 'Cool (blue) to warm (red) temperature scale; diverging style.',
90
+ },
91
+ {
92
+ name: 'Sales by region and quarter',
93
+ description: 'Quarterly revenue (K) by region – typical sales or revenue dashboard.',
94
+ props: {
95
+ adData: salesByRegionQuarter,
96
+ adSpec: {
97
+ xAxisTitle: 'Quarter',
98
+ yAxisTitle: 'Region',
99
+ tooltip: 'auto',
100
+ },
101
+ },
102
+ notes: 'Useful for regional performance and seasonality.',
103
+ },
104
+ {
105
+ name: 'Support tickets by product and month',
106
+ description: 'Monthly support ticket volume by product area.',
107
+ props: {
108
+ adData: supportTicketsByProductMonth,
109
+ adSpec: {
110
+ xAxisTitle: 'Month',
111
+ yAxisTitle: 'Product',
112
+ tooltip: 'auto',
113
+ },
114
+ },
115
+ notes: 'Helps spot spikes by product and time.',
116
+ },
117
+ {
118
+ name: 'API response time by service and environment',
119
+ description: 'Average response time (ms) by service and environment (green = fast, red = slow).',
120
+ props: {
121
+ adData: responseTimeByServiceEnv,
122
+ adSpec: {
123
+ xAxisTitle: 'Environment',
124
+ yAxisTitle: 'Service',
125
+ colorRange: ['#2ecc71', '#e74c3c'],
126
+ tooltip: 'auto',
127
+ },
128
+ },
129
+ notes: 'Green–red scale for performance; lower is better.',
130
+ },
131
+ ];
@@ -0,0 +1,45 @@
1
+ export const worldMapExamples = [
2
+ {
3
+ name: 'Global Sales Hubs',
4
+ description: 'World map with major city hubs and value markers.',
5
+ props: {
6
+ adData: [
7
+ { lon: -74.006, lat: 40.7128, value: 82, label: 'New York' },
8
+ { lon: -46.6333, lat: -23.5505, value: 64, label: 'São Paulo' },
9
+ { lon: -0.1276, lat: 51.5074, value: 58, label: 'London' },
10
+ { lon: 77.209, lat: 28.6139, value: 73, label: 'Delhi' },
11
+ { lon: 139.6917, lat: 35.6895, value: 69, label: 'Tokyo' },
12
+ { lon: 151.2093, lat: -33.8688, value: 47, label: 'Sydney' },
13
+ ],
14
+ adSpec: { pinColor: '#2563eb' },
15
+ },
16
+ },
17
+ {
18
+ name: 'EMEA Focus',
19
+ description: 'World map centered on EMEA business locations and values.',
20
+ props: {
21
+ adData: [
22
+ { lon: 13.405, lat: 52.52, value: 56, label: 'Berlin' },
23
+ { lon: 2.3522, lat: 48.8566, value: 59, label: 'Paris' },
24
+ { lon: 55.2708, lat: 25.2048, value: 45, label: 'Dubai' },
25
+ { lon: 18.4241, lat: -33.9249, value: 41, label: 'Cape Town' },
26
+ { lon: 36.8219, lat: -1.2921, value: 26, label: 'Nairobi' },
27
+ ],
28
+ adSpec: {},
29
+ },
30
+ },
31
+ {
32
+ name: 'APAC Expansion',
33
+ description: 'World map showing APAC expansion points and values.',
34
+ props: {
35
+ adData: [
36
+ { lon: 103.8198, lat: 1.3521, value: 62, label: 'Singapore' },
37
+ { lon: 126.978, lat: 37.5665, value: 53, label: 'Seoul' },
38
+ { lon: 106.8456, lat: -6.2088, value: 37, label: 'Jakarta' },
39
+ { lon: 100.5018, lat: 13.7563, value: 31, label: 'Bangkok' },
40
+ { lon: 174.7633, lat: -36.8485, value: 23, label: 'Auckland' },
41
+ ],
42
+ adSpec: {},
43
+ },
44
+ },
45
+ ];
@@ -1,3 +1,5 @@
1
1
  export * from './apollo-data-donut.examples';
2
2
  export * from './apollo-data-bar.examples';
3
3
  export * from './apollo-data-line.examples';
4
+ export * from './apollo-data-heat-map.examples';
5
+ export * from './apollo-data-world-map.examples';
@@ -233,7 +233,7 @@ export function generateWebComponentCode(componentName, props) {
233
233
  <script>
234
234
  const component = document.querySelector('${componentName}');
235
235
  ${propertyAssignments.join('\n')}
236
- ${eventListeners.length > 0 ? '\n' + eventListeners.join('\n') : ''}
236
+ ${eventListeners.length > 0 ? `\n${eventListeners.join('\n')}` : ''}
237
237
  </script>
238
238
  </body>
239
239
  </html>`;
@@ -1 +1 @@
1
- import{p as e,t,h as a,H as o}from"./p-Dws5s-Xe.js";import{A as l}from"./p-7XF5Cax8.js";import{C as n}from"./p-2nuV5Vny.js";const r="apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif",i=e(class e extends l{constructor(e){super(!1),!1!==e&&this.__registerHost(),this.__attachShadow()}get el(){return this}adData=[];adSpec=null;static tooltipStylesInjected=!1;componentDidLoad(){this.injectTooltipStyles()}async componentDidRender(){await this.renderChart()}injectTooltipStyles(){if(e.tooltipStylesInjected)return;const t="apollo-data-bar-tooltip-styles";if(document.getElementById(t))return void(e.tooltipStylesInjected=!0);const a=document.createElement("style");a.id=t,a.textContent="\n #vg-tooltip-element {\n background-color: #ffffff;\n border: 1px solid #e1e2e8;\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.05);\n font-family: apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif;\n font-weight: 500;\n padding: 0.25rem 0.75rem;\n pointer-events: none;\n text-align: center;\n transform: translateY(20%);\n white-space: pre;\n z-index: 999999999;\n }\n\n #vg-tooltip-element table tr td.key {\n color: #6a6d7d;\n text-align: center;\n }\n\n #vg-tooltip-element table tr td.value {\n text-align: center;\n }\n\n #vg-tooltip-element.dark-theme {\n background-color: #292632;\n border: 1px solid #6a6d7d;\n box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.5);\n color: #ffffff;\n }\n\n #vg-tooltip-element::after {\n border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;\n border-style: solid;\n border-width: 9px;\n bottom: -17px;\n content: '';\n left: 50%;\n position: absolute;\n transform: translateX(-50%);\n }\n ",document.head.appendChild(a),e.tooltipStylesInjected=!0}async getViewData(e,t){if(!t)throw Error("adSpec is required for apollo-data-bar-chart");const{tooltipPrefix:a="",currencySymbol:o=""}=t;if(!e||0===e.length)throw Error("Data is required for apollo-data-bar-chart");const l=Array.from(new Set(e.map((e=>e.category)))),i=a?".2f":".0f",d=a?o:"";return{$schema:"https://vega.github.io/schema/vega/v5.json",config:{text:{fill:"#6a6d7d",font:r,labelFontSize:12,labelFontWeight:400},axis:{labelColor:"#6a6d7d",titleColor:"#6a6d7d",labelFont:r,titleFont:r,titleFontWeight:400},legend:{labelColor:"#6a6d7d",titleColor:"#6a6d7d",labelFont:r,titleFont:r,labelFontSize:12,labelLimit:95},title:{color:"#6a6d7d",font:r,labelFontSize:12,labelFontWeight:400}},height:250,autosize:{type:"fit-x",contains:"padding",resize:!0},signals:[{name:"containerW",update:"max(containerSize()[0], 400)"},{name:"legendColumns",update:"ceil(containerW / 140)"},{name:"hoveredPeriod",value:null,on:[{events:"rect:mouseover",update:"datum.period"},{events:"rect:mouseout",update:"null"}]}],width:{signal:"containerW"},data:[{name:"raw",values:e},{name:"periodTotals",source:"raw",transform:[{type:"aggregate",groupby:["periodId"],fields:["value"],ops:["sum"],as:["total"]}]},{name:"table",source:"raw",transform:[{type:"lookup",from:"periodTotals",key:"periodId",fields:["periodId"],values:["total"],as:["total"]},{type:"stack",groupby:["periodId"],sort:{field:"category"},field:"value"},{type:"formula",as:"periodId",expr:"datum.periodId"},{type:"formula",as:"labelOnly",expr:"datum.label"}]},{name:"periodLabels",source:"raw",transform:[{type:"aggregate",groupby:["periodId","label"]}]}],scales:[{name:"x",type:"band",domain:{data:"table",field:"periodId"},range:"width",paddingInner:.35,paddingOuter:.02},{name:"xLabels",type:"ordinal",domain:{data:"periodLabels",field:"periodId"},range:{data:"periodLabels",field:"label"}},{name:"y",type:"linear",domain:{data:"table",field:"y1"},nice:!0,zero:!0,range:"height"},{name:"color",type:"ordinal",domain:l,range:t?.colorSet??n}],axes:[{orient:"bottom",scale:"x",title:t?.xAxisTitle,labelPadding:12,titlePadding:12,labelAngle:-90,labelAlign:"right",labelBaseline:"middle",tickSize:3,labelFontSize:12,titleFontSize:14,ticks:!1,domain:!1,encode:{labels:{update:{text:{signal:"scale('xLabels', datum.value)"}}}}},{orient:"left",scale:"y",title:t?.yAxisTitle||"",format:",.0f",grid:!0,tickCount:6,labelFontSize:12,titleFontSize:14,ticks:!1,domain:!1,tickBand:"extent",labelPadding:10}],legends:[{fill:"color",orient:"bottom",direction:"horizontal",columns:{signal:"legendColumns"},title:null,symbolType:"square",rowPadding:8,symbolOffset:-35,symbolSize:100,labelOffset:8,labelLimit:95}],marks:[{type:"rect",from:{data:"table"},encode:{enter:{x:{scale:"x",field:"periodId"},width:{scale:"x",band:1},y:{scale:"y",field:"y1"},y2:{scale:"y",field:"y0"},fill:{scale:"color",field:"category"},tooltip:{signal:`datum.category + ': ${d}' + format(datum.value, ',${i}') + '\\nTotal: ${d}' + format(datum.total, ',${i}')`}},update:{opacity:[{test:"hoveredPeriod && datum.period !== hoveredPeriod",value:.2},{value:1}]}}}]}}render(){return a(o,{key:"86ed2e74e5abd57e684a93bc9cf6a014b3ed081c"},a("div",{key:"96e5f7dd2dfa6a104ca709d1399308a86041c2f3",id:"container",style:{width:"100%",height:"100%"}}))}},[513,"apollo-data-bar-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]),d=i,s=function(){"undefined"!=typeof customElements&&["apollo-data-bar-chart"].forEach((e=>{"apollo-data-bar-chart"===e&&(customElements.get(t(e))||customElements.define(t(e),i))}))};export{d as ApolloDataBarChart,s as defineCustomElement}
1
+ import{p as e,t,h as a,H as o}from"./p-gcjU8DVr.js";import{A as n}from"./p-CfbMSXKd.js";import{C as l}from"./p-2nuV5Vny.js";const r="apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif",i=e(class extends n{constructor(e){super(!1),!1!==e&&this.__registerHost(),this.__attachShadow()}get el(){return this}adData=[];adSpec=null;static tooltipStylesInjected=!1;componentDidLoad(){this.injectTooltipStyles()}async componentDidRender(){await this.renderChart()}injectTooltipStyles(){const e=this.constructor;if(e.tooltipStylesInjected)return;const t="apollo-data-bar-tooltip-styles";if(document.getElementById(t))return void(e.tooltipStylesInjected=!0);const a=document.createElement("style");a.id=t,a.textContent="\n #vg-tooltip-element {\n background-color: #ffffff;\n border: 1px solid #e1e2e8;\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.05);\n font-family: apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif;\n font-weight: 500;\n padding: 0.25rem 0.75rem;\n pointer-events: none;\n text-align: center;\n transform: translateY(20%);\n white-space: pre;\n z-index: 999999999;\n }\n\n #vg-tooltip-element table tr td.key {\n color: #6a6d7d;\n text-align: center;\n }\n\n #vg-tooltip-element table tr td.value {\n text-align: center;\n }\n\n #vg-tooltip-element.dark-theme {\n background-color: #292632;\n border: 1px solid #6a6d7d;\n box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.5);\n color: #ffffff;\n }\n\n #vg-tooltip-element::after {\n border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;\n border-style: solid;\n border-width: 9px;\n bottom: -17px;\n content: '';\n left: 50%;\n position: absolute;\n transform: translateX(-50%);\n }\n ",document.head.appendChild(a),e.tooltipStylesInjected=!0}async getViewData(e,t){const a=this.el?.tagName?.toLowerCase()??"apollo-data-bar-chart";if(!t)throw Error("adSpec is required for "+a);const{tooltipPrefix:o="",currencySymbol:n=""}=t;if(!e||0===e.length)throw Error("Data is required for "+a);const i=Array.from(new Set(e.map((e=>e.category)))),d=o?".2f":".0f",s=o?n:"";return{$schema:"https://vega.github.io/schema/vega/v5.json",config:{text:{fill:"#6a6d7d",font:r,labelFontSize:12,labelFontWeight:400},axis:{labelColor:"#6a6d7d",titleColor:"#6a6d7d",labelFont:r,titleFont:r,titleFontWeight:400},legend:{labelColor:"#6a6d7d",titleColor:"#6a6d7d",labelFont:r,titleFont:r,labelFontSize:12,labelLimit:95},title:{color:"#6a6d7d",font:r,labelFontSize:12,labelFontWeight:400}},height:250,autosize:{type:"fit-x",contains:"padding",resize:!0},signals:[{name:"containerW",update:"max(containerSize()[0], 400)"},{name:"legendColumns",update:"ceil(containerW / 140)"},{name:"hoveredPeriod",value:null,on:[{events:"rect:mouseover",update:"datum.period"},{events:"rect:mouseout",update:"null"}]}],width:{signal:"containerW"},data:[{name:"raw",values:e},{name:"periodTotals",source:"raw",transform:[{type:"aggregate",groupby:["periodId"],fields:["value"],ops:["sum"],as:["total"]}]},{name:"table",source:"raw",transform:[{type:"lookup",from:"periodTotals",key:"periodId",fields:["periodId"],values:["total"],as:["total"]},{type:"stack",groupby:["periodId"],sort:{field:"category"},field:"value"},{type:"formula",as:"periodId",expr:"datum.periodId"},{type:"formula",as:"labelOnly",expr:"datum.label"}]},{name:"periodLabels",source:"raw",transform:[{type:"aggregate",groupby:["periodId","label"]}]}],scales:[{name:"x",type:"band",domain:{data:"table",field:"periodId"},range:"width",paddingInner:.35,paddingOuter:.02},{name:"xLabels",type:"ordinal",domain:{data:"periodLabels",field:"periodId"},range:{data:"periodLabels",field:"label"}},{name:"y",type:"linear",domain:{data:"table",field:"y1"},nice:!0,zero:!0,range:"height"},{name:"color",type:"ordinal",domain:i,range:t?.colorSet??l}],axes:[{orient:"bottom",scale:"x",title:t?.xAxisTitle,labelPadding:12,titlePadding:12,labelAngle:-90,labelAlign:"right",labelBaseline:"middle",tickSize:3,labelFontSize:12,titleFontSize:14,ticks:!1,domain:!1,encode:{labels:{update:{text:{signal:"scale('xLabels', datum.value)"}}}}},{orient:"left",scale:"y",title:t?.yAxisTitle||"",format:",.0f",grid:!0,tickCount:6,labelFontSize:12,titleFontSize:14,ticks:!1,domain:!1,tickBand:"extent",labelPadding:10}],legends:[{fill:"color",orient:"bottom",direction:"horizontal",columns:{signal:"legendColumns"},title:null,symbolType:"square",rowPadding:8,symbolOffset:-35,symbolSize:100,labelOffset:8,labelLimit:95}],marks:[{type:"rect",from:{data:"table"},encode:{enter:{x:{scale:"x",field:"periodId"},width:{scale:"x",band:1},y:{scale:"y",field:"y1"},y2:{scale:"y",field:"y0"},fill:{scale:"color",field:"category"},tooltip:{signal:`datum.category + ': ${s}' + format(datum.value, ',${d}') + '\\nTotal: ${s}' + format(datum.total, ',${d}')`}},update:{opacity:[{test:"hoveredPeriod && datum.period !== hoveredPeriod",value:.2},{value:1}]}}}]}}render(){return a(o,{key:"a0aebbff4fb177de35eb90329de81a1098663620"},a("div",{key:"9e753e876df877d46254a02349850414914d9231",id:"container",style:{width:"100%",height:"100%"}}))}},[513,"apollo-data-bar-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]),d=i,s=function(){"undefined"!=typeof customElements&&["apollo-data-bar-chart"].forEach((e=>{"apollo-data-bar-chart"===e&&(customElements.get(t(e))||customElements.define(t(e),i))}))};export{d as ApolloDataBarChart,s as defineCustomElement}