@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.
- package/README.md +15 -91
- package/dist/apollo-data/apollo-data.esm.js +1 -1
- package/dist/apollo-data/p-25841a73.entry.js +1 -0
- package/dist/apollo-data/p-839050b7.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.cjs.entry.js +10 -9
- 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-line-chart_2.cjs.entry.js → apollo-data-heat-map_4.cjs.entry.js} +358 -9
- 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 +8 -7
- 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.entry.js +10 -9
- 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-line-chart_2.entry.js → apollo-data-heat-map_4.entry.js} +357 -10
- 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-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/components/p-7XF5Cax8.js +0 -11
- package/dist/components/p-Dws5s-Xe.js +0 -1
package/README.md
CHANGED
|
@@ -1,112 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
### @xplortech/apollo-data
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides chart data used by the Apollo design system — structured datasets and fixtures for charts used across Storybook and applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Storybook: https://xplor-apollo.herokuapp.com
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than runtime tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements specification.
|
|
10
|
-
|
|
11
|
-
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
|
|
12
|
-
|
|
13
|
-
## Getting Started
|
|
14
|
-
|
|
15
|
-
### Build
|
|
7
|
+
Installation
|
|
16
8
|
|
|
17
9
|
```bash
|
|
18
|
-
npm
|
|
10
|
+
npm i @apollo-data@latest
|
|
19
11
|
```
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
Development notes
|
|
14
|
+
|
|
15
|
+
- Active development happens only in `apollo-data` and `apollo-data-react`. The Vue bundle is generated from the Stencil build output.
|
|
16
|
+
- To start development (local dev server):
|
|
22
17
|
|
|
23
18
|
```bash
|
|
24
19
|
npm start
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
Storybook (local)
|
|
23
|
+
|
|
24
|
+
1. From the repo root run:
|
|
28
25
|
|
|
29
26
|
```bash
|
|
30
|
-
npm
|
|
27
|
+
npm run build
|
|
31
28
|
```
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
This package includes a Storybook with framework-specific code examples:
|
|
30
|
+
2. Then run Storybook:
|
|
36
31
|
|
|
37
32
|
```bash
|
|
38
33
|
npm run storybook
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
See [STORYBOOK_GUIDE.md](./STORYBOOK_GUIDE.md) for details on how to add new stories and examples.
|
|
44
|
-
|
|
45
|
-
## Naming Components
|
|
46
|
-
|
|
47
|
-
When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
|
|
48
|
-
|
|
49
|
-
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the [Ionic-generated](https://ionicframework.com/) web components use the prefix `ion`.
|
|
50
|
-
|
|
51
|
-
## Using this component
|
|
52
|
-
|
|
53
|
-
There are two strategies we recommend for using web components built with Stencil.
|
|
54
|
-
|
|
55
|
-
The first step for all two of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
56
|
-
|
|
57
|
-
You can read more about these different approaches in the [Stencil docs](https://stenciljs.com/docs/publishing).
|
|
58
|
-
|
|
59
|
-
### Lazy Loading
|
|
60
|
-
|
|
61
|
-
If your Stencil project is built with the [`dist`](https://stenciljs.com/docs/distribution) output target, you can import a small bootstrap script that registers all components and allows you to load individual component scripts lazily.
|
|
62
|
-
|
|
63
|
-
For example, given your Stencil project namespace is called `my-design-system`, to use `my-component` on any website, inject this into your HTML:
|
|
64
|
-
|
|
65
|
-
```html
|
|
66
|
-
<script type="module" src="https://unpkg.com/my-design-system"></script>
|
|
67
|
-
<!--
|
|
68
|
-
To avoid unpkg.com redirects to the actual file, you can also directly import:
|
|
69
|
-
https://unpkg.com/foobar-design-system@0.0.1/dist/foobar-design-system/foobar-design-system.esm.js
|
|
70
|
-
-->
|
|
71
|
-
<my-component first="Stencil" middle="'Don't call me a framework'" last="JS"></my-component>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
This will only load the necessary scripts needed to render `<my-component />`. Once more components of this package are used, they will automatically be loaded lazily.
|
|
75
|
-
|
|
76
|
-
You can also import the script as part of your `node_modules` in your applications entry file:
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
import 'foobar-design-system/dist/foobar-design-system/foobar-design-system.esm.js';
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-y6v26a?file=src%2Fmain.tsx).
|
|
83
|
-
|
|
84
|
-
### Standalone
|
|
85
|
-
|
|
86
|
-
If you are using a Stencil component library with `dist-custom-elements`, we recommend importing Stencil components individually in those files where they are needed.
|
|
87
|
-
|
|
88
|
-
To export Stencil components as standalone components make sure you have the [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements) output target defined in your `stencil.config.ts`.
|
|
89
|
-
|
|
90
|
-
For example, given you'd like to use `<my-component />` as part of a React component, you can import the component directly via:
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
import 'foobar-design-system/my-component';
|
|
94
|
-
|
|
95
|
-
function App() {
|
|
96
|
-
return (
|
|
97
|
-
<>
|
|
98
|
-
<div>
|
|
99
|
-
<my-component
|
|
100
|
-
first="Stencil"
|
|
101
|
-
middle="'Don't call me a framework'"
|
|
102
|
-
last="JS"
|
|
103
|
-
></my-component>
|
|
104
|
-
</div>
|
|
105
|
-
</>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export default App;
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-b6zuds?file=src%2FApp.tsx).
|
|
36
|
+
License: MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as a,b as
|
|
1
|
+
import{p as a,b as d}from"./p-D64asVrg.js";export{s as setNonce}from"./p-D64asVrg.js";import{g as t}from"./p-DQuL1Twl.js";(()=>{const d=import.meta.url,t={};return""!==d&&(t.resourcesUrl=new URL(".",d).href),a(t)})().then((async a=>(await t(),d([["p-839050b7",[[513,"apollo-data-heat-map",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}],[513,"apollo-data-line-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}],[513,"apollo-data-scatter-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}],[513,"apollo-data-world-map-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]]],["p-25841a73",[[513,"apollo-data-bar-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]]],["p-e2c3a317",[[513,"apollo-data-donut-chart",{adData:[1,"ad-data"],adSpec:[1,"ad-spec"]}]]]],a))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,g as t,h as a,H as o}from"./p-D64asVrg.js";import{A as n}from"./p-C2k3WBpi.js";import{C as l}from"./p-2nuV5Vny.js";const r="apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif",i=class extends n{constructor(t){super(),e(this,t)}get el(){return t(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 new Error(`adSpec is required for ${a}`);const{tooltipPrefix:o="",currencySymbol:n=""}=t;if(!e||0===e.length)throw new 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%"}}))}};export{i as apollo_data_bar_chart}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,g as a,h as t,H as l}from"./p-D64asVrg.js";import{A as n}from"./p-C2k3WBpi.js";import{C as o}from"./p-2nuV5Vny.js";const i=class extends n{constructor(a){super(),e(this,a)}get el(){return a(this)}adData=[];adSpec={};async componentDidRender(){await this.renderChart()}DEFAULT_COLOR_RANGE=["#e8f4f8","#0066a1"];async getViewData(e,a){const t=a?.colorRange,l=Array.isArray(t)&&t.length>=2?t:this.DEFAULT_COLOR_RANGE,n="none"!==a?.tooltip,o=e.filter((e=>null!=e&&"string"==typeof e.xLabel&&"string"==typeof e.yLabel&&""!==e.xLabel&&""!==e.yLabel&&"number"==typeof e.value)),i=[...new Set(o.map((e=>e.xLabel)))],r=[...new Set(o.map((e=>e.yLabel)))];return{$schema:"https://vega.github.io/schema/vega/v6.json",description:"A heat map with xLabel and yLabel categories and value encoded as color.",width:450,height:350,padding:{left:5,top:5,bottom:5,right:70},autosize:{type:"fit",resize:!0},data:[{name:"source",values:o}],scales:[{name:"xscale",type:"band",range:[0,{signal:"width"}],domain:i,padding:.05},{name:"yscale",type:"band",range:[{signal:"height"},0],domain:r,padding:.05},{name:"color",type:"sequential",range:l,domain:{data:"source",field:"value"},zero:!0}],axes:[{orient:"bottom",scale:"xscale",title:a?.xAxisTitle??"X",labelAngle:-90,labelAlign:"right"},{orient:"left",scale:"yscale",title:a?.yAxisTitle??"Y"}],legends:[{type:"gradient",fill:"color",orient:"right",direction:"vertical",title:"Value",titleLimit:120,tickCount:5,format:"s"}],marks:[{type:"rect",from:{data:"source"},encode:{...n&&{enter:{tooltip:{signal:"datum.xLabel + ' | ' + datum.yLabel + ' | ' + format(datum.value, ',.2f')"}}},update:{x:{scale:"xscale",field:"xLabel"},y:{scale:"yscale",field:"yLabel"},width:{scale:"xscale",band:1},height:{scale:"yscale",band:1},fill:{scale:"color",field:"value"}},hover:{fill:{value:"firebrick"},opacity:{value:.8}}}}]}}render(){return t(l,{key:"d15b44f268f153498e61dc7829fe0d45f315a992"},t("div",{key:"7783444f4675c885980f1cd571737d506e00fdbc",id:"container",style:{width:"100%",height:"100%"}}))}},r="apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif",s=class extends n{constructor(a){super(),e(this,a)}get el(){return a(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 a="apollo-data-line-tooltip-styles";if(document.getElementById(a))return void(e.tooltipStylesInjected=!0);const t=document.createElement("style");t.id=a,t.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(t),e.tooltipStylesInjected=!0}async getViewData(e,a){const t=this.el?.tagName?.toLowerCase()??"apollo-data-line-chart";if(!a)throw new Error(`adSpec is required for ${t}`);const{tooltipPrefix:l="",currencySymbol:n=""}=a;if(!e||0===e.length)throw new Error(`Data is required for ${t}`);const i=Array.from(new Set(e.map((e=>e.category)))),s=[...new Set(e.map((e=>e.xValue)))].sort(((e,a)=>e-a)),d=a?.colorSet??o,c=s.map((a=>{const t=e.find((e=>e.xValue===a));return{xValue:a,displayLabel:null!=t?.xLabel?t.xLabel:String(a)}})),u=l?".2f":".0f",m=l?n:"",p=a.pointStyle??"circle",f=function(e){switch(e){case"dashed":return[6,4];case"dotted":return[2,2];default:return[]}}(a.lineStyle??"solid"),y=[{name:"raw",values:e},{name:"xLabelData",values:c}];i.forEach(((e,a)=>{y.push({name:`series_${a}`,source:"raw",transform:[{type:"filter",expr:`datum.category === ${JSON.stringify(e)}`},{type:"collect",sort:{field:"xValue"}}]})}));const g=i.map(((e,a)=>({type:"line",from:{data:`series_${a}`},encode:{enter:{x:{scale:"x",field:"xValue"},y:{scale:"y",field:"yValue"},stroke:{value:d[a%d.length]},strokeWidth:{value:2},interpolate:{value:"monotone"},...f.length>0?{strokeDash:{value:f}}:{}}}})));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)"}],width:{signal:"containerW"},data:y,scales:[{name:"x",type:"point",domain:s,range:"width",padding:.5},{name:"xLabels",type:"ordinal",domain:{data:"xLabelData",field:"xValue"},range:{data:"xLabelData",field:"displayLabel"}},{name:"y",type:"linear",domain:{data:"raw",field:"yValue"},nice:!0,zero:!0,range:"height"},{name:"color",type:"ordinal",domain:i,range:a?.colorSet??o}],axes:[{orient:"bottom",scale:"x",title:a?.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:a?.yAxisTitle||"",format:",.0f",grid:!0,tickCount:6,labelFontSize:12,titleFontSize:14,ticks:!1,domain:!1,tickBand:"extent",labelPadding:10}],legends:[{stroke:"color",orient:"bottom",direction:"horizontal",columns:{signal:"legendColumns"},title:null,symbolType:"stroke",symbolStrokeWidth:3,rowPadding:8,symbolOffset:-35,symbolSize:100,labelOffset:8,labelLimit:95}],marks:[...g,{type:"symbol",from:{data:"raw"},encode:{enter:{x:{scale:"x",field:"xValue"},y:{scale:"y",field:"yValue"},fill:{scale:"color",field:"category"},size:{value:50},shape:{value:p},tooltip:{signal:`(datum.xLabel != null ? datum.xLabel : format(datum.xValue, ',.0f')) + ' · ' + datum.category + ': ' + (datum.yLabel != null ? datum.yLabel : '${m}' + format(datum.yValue, ',${u}'))`}}}}]}}render(){return t(l,{key:"fd64f4abb624b14a878808b23345910c9b23a72c"},t("div",{key:"aeda5086730862ca1368a0374caf2d918969839d",id:"container",style:{width:"100%",height:"100%"}}))}},d=class extends n{constructor(a){super(),e(this,a)}get el(){return a(this)}adData=[];adSpec={};async componentDidRender(){await this.renderChart()}DEFAULT_POINT_STYLE={shape:"circle",opacity:1,color:"blue",size:1};async getViewData(e,a){const t=e.map((e=>{const t={};return Object.keys(this.DEFAULT_POINT_STYLE).forEach((l=>{t[l]=e.pointStyle?.[l]??e?.[l]??a.categoryPointStyleMap?.[e.category]?.[l]??a.defaultPointStyle?.[l]??this.DEFAULT_POINT_STYLE[l]})),{category:e.category,xValue:e.xValue,yValue:e.yValue,color:t.color,shape:t.shape,opacity:t.opacity}})),l="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:t},{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:l}},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:l}},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 t(l,{key:"f6c1e8d9e9a6ba41dbbf8c2c5737895b96b0915d"},t("div",{key:"2aeba82bc31c5995a3d5b532c339f5b45ae850f7",id:"container",style:{width:"100%",height:"100%"}}))}},c=class extends n{constructor(a){super(),e(this,a)}get el(){return a(this)}adData=[];adSpec={};async componentDidRender(){await this.renderChart()}async getViewData(e,a){return{$schema:"https://vega.github.io/schema/vega/v6.json",description:"World map + tooltip + points.",width:600,height:400,autosize:"none",background:"#cfe3f1",signals:[{name:"scale",value:85,on:[{events:{type:"wheel",consume:!0},update:"clamp(scale * pow(1.002, -event.deltaY), 85, 2000)"}]},{name:"xc",value:0,on:[{events:"mousedown",update:"x()"}]},{name:"yc",value:0,on:[{events:"mousedown",update:"y()"}]},{name:"xo",value:300,on:[{events:"mousedown",update:"tx"}]},{name:"yo",value:175,on:[{events:"mousedown",update:"ty"}]},{name:"tx",value:300,on:[{events:"[mousedown, window:mouseup] > window:mousemove",update:"xo - (x() - xc)"}]},{name:"ty",value:270,on:[{events:"[mousedown, window:mouseup] > window:mousemove",update:"clamp(yo + y() - yc, -scale * 0.5, scale * 2.5 + height)"}]}],projections:[{name:"projection",type:"mercator",scale:{signal:"scale"},rotate:[{signal:"-(tx - width / 2) * 180 / (scale * PI)"},0,0],center:[0,0],translate:[{signal:"width / 2"},{signal:"ty"}]}],data:[{name:"names",url:"https://raw.githubusercontent.com/KoGor/Map-Icons-Generator/master/data/world-110m-country-names.tsv",format:{type:"tsv"},transform:[{type:"formula",as:"id",expr:"toNumber(datum.id)"}]},{name:"metrics",values:e},{name:"world",url:"https://vega.github.io/editor/data/world-110m.json",format:{type:"topojson",feature:"countries"},transform:[{type:"lookup",from:"names",key:"id",fields:["id"],values:["name"],as:["name"]},{type:"filter",expr:"datum.name != 'Antarctica'"}]},{name:"points",source:"metrics",transform:[{type:"filter",expr:"isValid(datum.lon) && isValid(datum.lat)"},{type:"geopoint",projection:"projection",fields:["lon","lat"],as:["x","y"]}]},{name:"continentLabels",values:[{name:"North America",lon:-105,lat:45},{name:"South America",lon:-60,lat:-15},{name:"Europe",lon:15,lat:52},{name:"Africa",lon:20,lat:5},{name:"Asia",lon:90,lat:35},{name:"Oceania",lon:135,lat:-25}],transform:[{type:"geopoint",projection:"projection",fields:["lon","lat"],as:["x","y"]}]}],marks:[{type:"shape",from:{data:"world"},transform:[{type:"geoshape",projection:"projection"}],encode:{update:{fill:{value:"#8fbf8f"},stroke:{value:"#6c8c8c"},strokeWidth:{value:.7},tooltip:{signal:"{Country: datum.name ? datum.name : 'Unknown'}"}},hover:{stroke:{value:"#2b3a42"},strokeWidth:{value:1.3}}}},{type:"symbol",from:{data:"points"},encode:{update:{x:{field:"x"},y:{field:"y"},size:{value:80},fill:{value:a?.pinColor||"#d3544b"},stroke:{value:"white"},shape:{value:a?.pinShape||"circle"},strokeWidth:{value:1},tooltip:{signal:"{Label: datum.label, Value: datum.value, Latitude: datum.lat, Longitude: datum.lon}"}}}},{type:"text",from:{data:"continentLabels"},encode:{update:{x:{field:"x"},y:{field:"y"},text:{field:"name"},align:{value:"center"},baseline:{value:"middle"},fontSize:{value:12},fontWeight:{value:"600"},fill:{value:"#2b3a42"},fillOpacity:{value:.5}}}}]}}render(){return t(l,{key:"8053ea3b9706cdd03a430157b3f63e93c1201d1f"},t("div",{key:"514807ae8dd4868d3d74e86c4260b7b9967c0ac2",id:"container",style:{width:"100%",height:"100%"}}))}};export{i as apollo_data_heat_map,s as apollo_data_line_chart,d as apollo_data_scatter_chart,c as apollo_data_world_map_chart}
|