@xplortech/apollo-data 0.0.4 → 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 (88) 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-2nuV5Vny.js +1 -0
  5. package/dist/apollo-data/p-839050b7.entry.js +1 -0
  6. package/dist/apollo-data/p-C2k3WBpi.js +11 -0
  7. package/dist/apollo-data/p-D64asVrg.js +2 -0
  8. package/dist/apollo-data/p-e2c3a317.entry.js +1 -0
  9. package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +315 -0
  10. package/dist/{esm/apollo-data-bar-chart_2.entry.js → cjs/apollo-data-base-COGMOEqL.js} +9 -724
  11. package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +408 -0
  12. package/dist/cjs/apollo-data-heat-map_4.cjs.entry.js +883 -0
  13. package/dist/cjs/apollo-data.cjs.js +3 -3
  14. package/dist/cjs/constants-B3weDEpc.js +5 -0
  15. package/dist/cjs/{index-Cl7HgRm0.js → index-Bd5risOy.js} +116 -63
  16. package/dist/cjs/loader.cjs.js +2 -2
  17. package/dist/collection/apollo-data-base.js +4 -8
  18. package/dist/collection/collection-manifest.json +7 -2
  19. package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +8 -7
  20. package/dist/collection/components/apollo-data-bar/apollo-data-bar.stories.js +122 -0
  21. package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +1 -1
  22. package/dist/collection/components/apollo-data-donut/apollo-data-donut.stories.js +132 -0
  23. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.js +208 -0
  24. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.stories.js +137 -0
  25. package/dist/collection/components/apollo-data-line/apollo-data-line.js +348 -0
  26. package/dist/collection/components/apollo-data-line/apollo-data-line.stories.js +122 -0
  27. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +329 -0
  28. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.stories.js +147 -0
  29. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.js +294 -0
  30. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.stories.js +126 -0
  31. package/dist/collection/examples/apollo-data-heat-map.examples.js +131 -0
  32. package/dist/collection/examples/apollo-data-line.examples.js +91 -0
  33. package/dist/collection/examples/apollo-data-scatter.examples.js +94 -0
  34. package/dist/collection/examples/apollo-data-world-map.examples.js +45 -0
  35. package/dist/collection/examples/index.js +3 -0
  36. package/dist/collection/utils/code-generator.js +1 -1
  37. package/dist/components/apollo-data-bar-chart.js +1 -1
  38. package/dist/components/apollo-data-donut-chart.js +1 -1
  39. package/dist/components/apollo-data-heat-map.d.ts +11 -0
  40. package/dist/components/apollo-data-heat-map.js +1 -0
  41. package/dist/components/apollo-data-line-chart.d.ts +11 -0
  42. package/dist/components/apollo-data-line-chart.js +1 -0
  43. package/dist/components/apollo-data-scatter-chart.d.ts +11 -0
  44. package/dist/components/apollo-data-scatter-chart.js +1 -0
  45. package/dist/components/apollo-data-world-map-chart.d.ts +11 -0
  46. package/dist/components/apollo-data-world-map-chart.js +1 -0
  47. package/dist/components/index.js +1 -1
  48. package/dist/components/p-2nuV5Vny.js +1 -0
  49. package/dist/components/p-CfbMSXKd.js +11 -0
  50. package/dist/components/p-gcjU8DVr.js +1 -0
  51. package/dist/esm/apollo-data-bar-chart.entry.js +313 -0
  52. package/dist/{cjs/apollo-data-bar-chart_2.cjs.entry.js → esm/apollo-data-base-C2k3WBpi.js} +8 -728
  53. package/dist/esm/apollo-data-donut-chart.entry.js +406 -0
  54. package/dist/esm/apollo-data-heat-map_4.entry.js +878 -0
  55. package/dist/esm/apollo-data.js +4 -4
  56. package/dist/esm/constants-2nuV5Vny.js +3 -0
  57. package/dist/esm/{index-Bb2nY-Tf.js → index-D64asVrg.js} +116 -63
  58. package/dist/esm/loader.js +3 -3
  59. package/dist/types/apollo-data-base.d.ts +2 -2
  60. package/dist/types/components/apollo-data-bar/apollo-data-bar.stories.d.ts +5 -0
  61. package/dist/types/components/apollo-data-donut/apollo-data-donut.stories.d.ts +5 -0
  62. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.d.ts +140 -0
  63. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.stories.d.ts +5 -0
  64. package/dist/types/components/apollo-data-line/apollo-data-line.d.ts +244 -0
  65. package/dist/types/components/apollo-data-line/apollo-data-line.stories.d.ts +5 -0
  66. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +327 -0
  67. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.stories.d.ts +5 -0
  68. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.d.ts +281 -0
  69. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.stories.d.ts +5 -0
  70. package/dist/types/components.d.ts +210 -4
  71. package/dist/types/examples/apollo-data-heat-map.examples.d.ts +11 -0
  72. package/dist/types/examples/apollo-data-line.examples.d.ts +12 -0
  73. package/dist/types/examples/apollo-data-scatter.examples.d.ts +11 -0
  74. package/dist/types/examples/apollo-data-world-map.examples.d.ts +11 -0
  75. package/dist/types/examples/index.d.ts +3 -0
  76. package/dist/types/stencil-public-runtime.d.ts +23 -2
  77. package/dist/types/utils/code-generator.d.ts +1 -3
  78. package/package.json +8 -8
  79. package/src/examples/apollo-data-bar.examples.ts +157 -157
  80. package/src/examples/apollo-data-heat-map.examples.ts +147 -0
  81. package/src/examples/apollo-data-line.examples.ts +103 -0
  82. package/src/examples/apollo-data-scatter.examples.ts +109 -0
  83. package/src/examples/apollo-data-world-map.examples.ts +57 -0
  84. package/src/examples/index.ts +4 -1
  85. package/dist/apollo-data/p-Bb2nY-Tf.js +0 -2
  86. package/dist/apollo-data/p-e6584598.entry.js +0 -11
  87. package/dist/components/p-7XF5Cax8.js +0 -11
  88. package/dist/components/p-Dws5s-Xe.js +0 -1
@@ -0,0 +1 @@
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],r=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);r&&Object.defineProperty(e,o,{get(){return r.get.call(this)},set(t){r.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>(0,console.error)(t,e),r="undefined"!=typeof window?window:{},s=r.HTMLElement||class{},i={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},c=!!(()=>{try{return!!r.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})()&&(()=>!!r.document&&Object.getOwnPropertyDescriptor(r.document.adoptedStyleSheets,"length").writable)(),u=!1,a=[],f=[],d=(t,e)=>n=>{t.push(n),u||(u=!0,e&&4&i.i?m(p):i.raf(p))},h=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},p=()=>{h(a),h(f),(u=a.length>0)&&i.raf(p)},m=t=>Promise.resolve(undefined).then(t),$=d(f,!0),b=t=>{const e=new URL(t,i.u);return e.origin!==r.location.origin?e.href:e.pathname},v=t=>i.u=t;function y(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(c?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var w,j=new WeakMap,O=t=>"object"==(t=typeof t)||"function"===t,g=(t,e,...n)=>{let o=null,l=null,r=!1,s=!1;const i=[],c=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?c(o):null!=o&&"boolean"!=typeof o&&((r="function"!=typeof t&&!O(o))&&(o=String(o)),r&&s?i[i.length-1].h+=o:i.push(r?S(null,o):o),s=r)};c(n),e&&e.key&&(l=e.key);const u=S(t,null);return u.p=e,i.length>0&&(u.m=i),u.$=l,u},S=(t,e)=>({i:0,v:t,h:null!=e?e:null,j:null,m:null,p:null,$:null}),M={},k=(t,e)=>null==t||O(t)?t:1&e?String(t):t,E=(t,e,n,l,r,s)=>{if(n===l)return;let i=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"style"===e){for(const e in n)l&&null!=l[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in l)n&&l[e]===n[e]||(e.includes("-")?t.style.setProperty(e,l[e]):t.style[e]=l[e])}else if("key"===e);else{if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let r;{const e=o(t);if(e&&e.o&&e.o.t){const t=e.o.t[n];t&&t[1]&&(r=t[1])}}return r||(r=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==l||!1===l?!1===l&&""!==t.getAttribute(r)||t.removeAttribute(r):t.setAttribute(r,!0===l?"":l))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=l}catch(t){}return}{const o=O(l);if((i||o&&null!==l)&&!r)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const o=null==l?"":l;"list"===e?i=!1:null!=n&&t[e]===o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&s||r)&&!o&&1===t.nodeType&&t.setAttribute(e,l=!0===l?"":l)}}},C=(t,e,n)=>{const o=11===e.j.nodeType&&e.j.host?e.j.host:e.j,l=t&&t.p||{},r=e.p||{};for(const t of L(Object.keys(l)))t in r||E(o,t,l[t],void 0,n,e.i);for(const t of L(Object.keys(r)))E(o,t,l[t],r[t],n,e.i)};function L(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var _=!1,x=(t,e,n)=>{const o=e.m[n];let l,s,i=0;if(!r.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.j=r.document.createElement(o.v),C(null,o,_),o.m){const e="template"===o.v?l.content:l;for(i=0;i<o.m.length;++i)s=x(t,o,i),s&&e.appendChild(s)}return l["s-hn"]=w,l},A=(t,e,n,o,l,r)=>{let s,i=t;for(i.shadowRoot&&i.tagName===w&&(i=i.shadowRoot),"template"===n.v&&(i=i.content);l<=r;++l)o[l]&&(s=x(null,n,l),s&&(o[l].j=s,D(i,s,e)))},H=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.j;t&&t.remove()}}},P=(t,e,n=!1)=>t.v===e.v&&(n?(n&&!t.$&&e.$&&(t.$=e.$),!0):t.$===e.$),U=(t,e,n=!1)=>{const o=e.j=t.j,l=t.m,r=e.m;C(t,e,_),null!==l&&null!==r?((t,e,n,o,l=!1)=>{let r,s,i=0,c=0,u=0,a=0,f=e.length-1,d=e[0],h=e[f],p=o.length-1,m=o[0],$=o[p];const b="template"===n.v?t.content:t;for(;i<=f&&c<=p;)if(null==d)d=e[++i];else if(null==h)h=e[--f];else if(null==m)m=o[++c];else if(null==$)$=o[--p];else if(P(d,m,l))U(d,m,l),d=e[++i],m=o[++c];else if(P(h,$,l))U(h,$,l),h=e[--f],$=o[--p];else if(P(d,$,l))U(d,$,l),D(b,d.j,h.j.nextSibling),d=e[++i],$=o[--p];else if(P(h,m,l))U(h,m,l),D(b,h.j,d.j),h=e[--f],m=o[++c];else{for(u=-1,a=i;a<=f;++a)if(e[a]&&null!==e[a].$&&e[a].$===m.$){u=a;break}u>=0?(s=e[u],s.v!==m.v?r=x(e&&e[c],n,u):(U(s,m,l),e[u]=void 0,r=s.j),m=o[++c]):(r=x(e&&e[c],n,c),m=o[++c]),r&&D(d.j.parentNode,r,d.j)}i>f?A(t,null==o[p+1]?null:o[p+1].j,n,o,c,p):c>p&&H(e,i,f)})(o,l,e,r,n):null!==r?A(o,null,e,r,0,r.length-1):!n&&null!==l&&H(l,0,l.length-1)},D=(t,e,n)=>t.__insertBefore?t.__insertBefore(e,n):null==t?void 0:t.insertBefore(e,n),R=(t,e,n=!1)=>{const o=t.$hostElement$,l=t.O||S(null,null);var r;const s=(r=e)&&r.v===M?e:g(null,null,e);if(w=o.tagName,n&&s.p)for(const t of Object.keys(s.p))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.p[t]=o[t]);s.v=null,s.i|=4,t.O=s,s.j=l.j=o.shadowRoot||o,U(l,s,n)},W=(t,e)=>{if(e&&!t.S&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.S=()=>{e["s-p"].splice(n-1,1),o()})))}},N=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);W(t,t.M);const n=()=>q(t,e);if(!e)return $(n);queueMicrotask((()=>{n()}))},q=(t,e)=>{const n=t.$hostElement$,o=n;if(!o)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=B(o,e?"componentWillLoad":"componentWillUpdate",void 0,n),l=z(l,(()=>B(o,"componentWillRender",void 0,n))),z(l,(()=>T(t,o,e)))},z=(t,e)=>F(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),F=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,T=async(t,e,n)=>{var o;const l=t.$hostElement$,r=l["s-rc"];V(t,e,l,n),r&&(r.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>Y(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0)}},V=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,R(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},Y=t=>{const e=t.$hostElement$,n=e,o=t.M;B(n,"componentDidRender",void 0,e),64&t.i?B(n,"componentDidUpdate",void 0,e):(t.i|=64,G(e),B(n,"componentDidLoad",void 0,e),t.k(e),o||Z()),t.S&&(t.S(),t.S=void 0),512&t.i&&m((()=>N(t,!1))),t.i&=-517},Z=()=>{m((()=>(t=>{const e=i.ce("appload",{detail:{namespace:"apollo-data"}});return t.dispatchEvent(e),e})(r)))},B=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},G=t=>t.classList.add("hydrated"),I=(t,e,n,l)=>{const r=o(t);if(!r)return;const s=t,i=r.l.get(e),c=r.i,u=s;n=k(n,l.t[e][0]);const a=Number.isNaN(i)&&Number.isNaN(n);if(n!==i&&!a&&(r.l.set(e,n),2&c)){if(u.componentShouldUpdate&&!1===u.componentShouldUpdate(n,i,e)&&!(16&c))return;16&c||N(r,!1)}},J=(e,n)=>{var l,r;const s=e.prototype;if(n.t){const c=Object.entries(null!=(l=n.t)?l:{});c.map((([e,[l]])=>{if(31&l||32&l){const{get:r,set:i}=t(s,e)||{};r&&(n.t[e][0]|=2048),i&&(n.t[e][0]|=4096),Object.defineProperty(s,e,{get(){return r?r.apply(this):(t=e,o(this).l.get(t));var t},configurable:!0,enumerable:!0}),Object.defineProperty(s,e,{set(t){const r=o(this);if(r){if(i)return void 0===(32&l?this[e]:r.$hostElement$[e])&&r.l.get(e)&&(t=r.l.get(e)),i.apply(this,[k(t,l)]),void I(this,e,t=32&l?this[e]:r.$hostElement$[e],n);I(this,e,t,n)}}})}}));{const t=new Map;s.attributeChangedCallback=function(e,l,r){i.jmp((()=>{var i;const u=t.get(e),a=o(this);if(this.hasOwnProperty(u),s.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==r)return;if(null==u){const t=null==a?void 0:a.i;if(a&&t&&!(8&t)&&r!==l){const o=this,s=null==(i=n.C)?void 0:i[e];null==s||s.forEach((n=>{const[[s,i]]=Object.entries(n);null!=o[s]&&(128&t||1&i)&&o[s].call(o,r,l,e)}))}return}const f=c.find((([t])=>t===u));f&&4&f[1][0]&&(r=null!==r&&"false"!==r);const d=Object.getOwnPropertyDescriptor(s,u);r==this[u]||d.get&&!d.set||(this[u]=r)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=n.C)?r:{}),...c.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},K=(t,e)=>{const r={i:e[0],L:e[1]};try{r.t=e[2];const s=t.prototype.connectedCallback,c=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,_:new Map};o.A=new Promise((t=>o.k=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,r)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!o(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&i.i)){const e=o(t);if(!e)return;const n=e.o,r=()=>{};if(1&e.i)(null==e?void 0:e.H)||(null==e?void 0:e.A)&&e.A.then((()=>{}));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){W(e,e.M=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e)=>{try{32&e.i||(e.i|=32,customElements.whenDefined(t.localName).then((()=>e.i|=128)));const n=e.M,o=()=>N(e,!0);n&&n["s-rc"]?n["s-rc"].push(o):o()}catch(n){l(n,t),e.S&&(e.S(),e.S=void 0),e.k&&e.k(t)}})(t,e)}r()}})(this),s&&s.call(this)},disconnectedCallback(){(async t=>{1&i.i||o(t),j.has(t)&&j.delete(t),t.shadowRoot&&j.has(t.shadowRoot)&&j.delete(t.shadowRoot)})(this),c&&c.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${r.L}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else y.call(this,r)}}),Object.defineProperty(t,"is",{value:r.L,configurable:!0}),J(t,r)}catch(e){return l(e),t}},Q=t=>i.P=t,X=t=>Object.assign(i,t);function tt(t,e){R({$hostElement$:e},t)}function et(t){return t}export{M as H,Q as a,X as b,s as c,b as g,g as h,K as p,tt as r,v as s,et as t}
@@ -0,0 +1,313 @@
1
+ import { r as registerInstance, g as getElement, h, H as Host } from './index-D64asVrg.js';
2
+ import { A as ApolloBase } from './apollo-data-base-C2k3WBpi.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
+ const ApolloDataBarChart = class extends ApolloBase {
7
+ constructor(hostRef) {
8
+ super();
9
+ registerInstance(this, hostRef);
10
+ }
11
+ get el() { return getElement(this); }
12
+ adData = [];
13
+ adSpec = null;
14
+ static tooltipStylesInjected = false;
15
+ componentDidLoad() {
16
+ this.injectTooltipStyles();
17
+ }
18
+ async componentDidRender() {
19
+ await this.renderChart();
20
+ }
21
+ injectTooltipStyles() {
22
+ const chartClass = this.constructor;
23
+ if (chartClass.tooltipStylesInjected) {
24
+ return;
25
+ }
26
+ const styleId = 'apollo-data-bar-tooltip-styles';
27
+ if (document.getElementById(styleId)) {
28
+ chartClass.tooltipStylesInjected = true;
29
+ return;
30
+ }
31
+ const style = document.createElement('style');
32
+ style.id = styleId;
33
+ style.textContent = `
34
+ #vg-tooltip-element {
35
+ background-color: #ffffff;
36
+ border: 1px solid #e1e2e8;
37
+ border-radius: 0.25rem;
38
+ box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.05);
39
+ font-family: apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif;
40
+ font-weight: 500;
41
+ padding: 0.25rem 0.75rem;
42
+ pointer-events: none;
43
+ text-align: center;
44
+ transform: translateY(20%);
45
+ white-space: pre;
46
+ z-index: 999999999;
47
+ }
48
+
49
+ #vg-tooltip-element table tr td.key {
50
+ color: #6a6d7d;
51
+ text-align: center;
52
+ }
53
+
54
+ #vg-tooltip-element table tr td.value {
55
+ text-align: center;
56
+ }
57
+
58
+ #vg-tooltip-element.dark-theme {
59
+ background-color: #292632;
60
+ border: 1px solid #6a6d7d;
61
+ box-shadow: 0 4px 6px -1px rgba(48, 45, 59, 0.1), 0 2px 4px -1px rgba(48, 45, 59, 0.5);
62
+ color: #ffffff;
63
+ }
64
+
65
+ #vg-tooltip-element::after {
66
+ border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
67
+ border-style: solid;
68
+ border-width: 9px;
69
+ bottom: -17px;
70
+ content: '';
71
+ left: 50%;
72
+ position: absolute;
73
+ transform: translateX(-50%);
74
+ }
75
+ `;
76
+ document.head.appendChild(style);
77
+ chartClass.tooltipStylesInjected = true;
78
+ }
79
+ async getViewData(data, spec) {
80
+ const componentTag = this.el?.tagName?.toLowerCase() ?? 'apollo-data-bar-chart';
81
+ if (!spec) {
82
+ throw new Error(`adSpec is required for ${componentTag}`);
83
+ }
84
+ const { tooltipPrefix = '', currencySymbol = '' } = spec;
85
+ if (!data || data.length === 0) {
86
+ throw new Error(`Data is required for ${componentTag}`);
87
+ }
88
+ const uniqueCategories = Array.from(new Set(data.map(item => item.category)));
89
+ const formatNumber = tooltipPrefix ? '.2f' : '.0f';
90
+ const currencyPrefix = tooltipPrefix ? currencySymbol : '';
91
+ return {
92
+ $schema: 'https://vega.github.io/schema/vega/v5.json',
93
+ config: {
94
+ text: {
95
+ fill: '#6a6d7d',
96
+ font: FONT_FAMILY,
97
+ labelFontSize: 12,
98
+ labelFontWeight: 400,
99
+ },
100
+ axis: {
101
+ labelColor: '#6a6d7d',
102
+ titleColor: '#6a6d7d',
103
+ labelFont: FONT_FAMILY,
104
+ titleFont: FONT_FAMILY,
105
+ titleFontWeight: 400,
106
+ },
107
+ legend: {
108
+ labelColor: '#6a6d7d',
109
+ titleColor: '#6a6d7d',
110
+ labelFont: FONT_FAMILY,
111
+ titleFont: FONT_FAMILY,
112
+ labelFontSize: 12,
113
+ labelLimit: 95,
114
+ },
115
+ title: {
116
+ color: '#6a6d7d',
117
+ font: FONT_FAMILY,
118
+ labelFontSize: 12,
119
+ labelFontWeight: 400,
120
+ },
121
+ },
122
+ height: 250,
123
+ autosize: { type: 'fit-x', contains: 'padding', resize: true },
124
+ signals: [
125
+ {
126
+ name: 'containerW',
127
+ update: 'max(containerSize()[0], 400)',
128
+ },
129
+ {
130
+ name: 'legendColumns',
131
+ update: 'ceil(containerW / 140)',
132
+ },
133
+ {
134
+ name: 'hoveredPeriod',
135
+ value: null,
136
+ on: [
137
+ { events: 'rect:mouseover', update: 'datum.period' },
138
+ { events: 'rect:mouseout', update: 'null' },
139
+ ],
140
+ },
141
+ ],
142
+ width: { signal: 'containerW' },
143
+ data: [
144
+ {
145
+ name: 'raw',
146
+ values: data,
147
+ },
148
+ {
149
+ name: 'periodTotals',
150
+ source: 'raw',
151
+ transform: [
152
+ {
153
+ type: 'aggregate',
154
+ groupby: ['periodId'],
155
+ fields: ['value'],
156
+ ops: ['sum'],
157
+ as: ['total'],
158
+ },
159
+ ],
160
+ },
161
+ {
162
+ name: 'table',
163
+ source: 'raw',
164
+ transform: [
165
+ {
166
+ type: 'lookup',
167
+ from: 'periodTotals',
168
+ key: 'periodId',
169
+ fields: ['periodId'],
170
+ values: ['total'],
171
+ as: ['total'],
172
+ },
173
+ {
174
+ type: 'stack',
175
+ groupby: ['periodId'],
176
+ sort: { field: 'category' },
177
+ field: 'value',
178
+ },
179
+ {
180
+ type: 'formula',
181
+ as: 'periodId',
182
+ expr: 'datum.periodId',
183
+ },
184
+ {
185
+ type: 'formula',
186
+ as: 'labelOnly',
187
+ expr: 'datum.label',
188
+ },
189
+ ],
190
+ },
191
+ {
192
+ name: 'periodLabels',
193
+ source: 'raw',
194
+ transform: [
195
+ {
196
+ type: 'aggregate',
197
+ groupby: ['periodId', 'label'],
198
+ },
199
+ ],
200
+ },
201
+ ],
202
+ scales: [
203
+ {
204
+ name: 'x',
205
+ type: 'band',
206
+ domain: { data: 'table', field: 'periodId' },
207
+ range: 'width',
208
+ paddingInner: 0.35,
209
+ paddingOuter: 0.02,
210
+ },
211
+ {
212
+ name: 'xLabels',
213
+ type: 'ordinal',
214
+ domain: { data: 'periodLabels', field: 'periodId' },
215
+ range: { data: 'periodLabels', field: 'label' },
216
+ },
217
+ {
218
+ name: 'y',
219
+ type: 'linear',
220
+ domain: { data: 'table', field: 'y1' },
221
+ nice: true,
222
+ zero: true,
223
+ range: 'height',
224
+ },
225
+ {
226
+ name: 'color',
227
+ type: 'ordinal',
228
+ domain: uniqueCategories,
229
+ range: spec?.colorSet ?? CHART_COLORS,
230
+ },
231
+ ],
232
+ axes: [
233
+ {
234
+ orient: 'bottom',
235
+ scale: 'x',
236
+ title: spec?.xAxisTitle,
237
+ labelPadding: 12,
238
+ titlePadding: 12,
239
+ labelAngle: -90,
240
+ labelAlign: 'right',
241
+ labelBaseline: 'middle',
242
+ tickSize: 3,
243
+ labelFontSize: 12,
244
+ titleFontSize: 14,
245
+ ticks: false,
246
+ domain: false,
247
+ encode: {
248
+ labels: {
249
+ update: {
250
+ text: { signal: "scale('xLabels', datum.value)" },
251
+ },
252
+ },
253
+ },
254
+ },
255
+ {
256
+ orient: 'left',
257
+ scale: 'y',
258
+ title: spec?.yAxisTitle || '',
259
+ format: ',.0f',
260
+ grid: true,
261
+ tickCount: 6,
262
+ labelFontSize: 12,
263
+ titleFontSize: 14,
264
+ ticks: false,
265
+ domain: false,
266
+ tickBand: 'extent',
267
+ labelPadding: 10,
268
+ },
269
+ ],
270
+ legends: [
271
+ {
272
+ fill: 'color',
273
+ orient: 'bottom',
274
+ direction: 'horizontal',
275
+ columns: { signal: 'legendColumns' },
276
+ title: null,
277
+ symbolType: 'square',
278
+ rowPadding: 8,
279
+ symbolOffset: -35,
280
+ symbolSize: 100,
281
+ labelOffset: 8,
282
+ labelLimit: 95,
283
+ },
284
+ ],
285
+ marks: [
286
+ {
287
+ type: 'rect',
288
+ from: { data: 'table' },
289
+ encode: {
290
+ enter: {
291
+ x: { scale: 'x', field: 'periodId' },
292
+ width: { scale: 'x', band: 1 },
293
+ y: { scale: 'y', field: 'y1' },
294
+ y2: { scale: 'y', field: 'y0' },
295
+ fill: { scale: 'color', field: 'category' },
296
+ tooltip: {
297
+ signal: `datum.category + ': ${currencyPrefix}' + format(datum.value, ',${formatNumber}') + '\\nTotal: ${currencyPrefix}' + format(datum.total, ',${formatNumber}')`,
298
+ },
299
+ },
300
+ update: {
301
+ opacity: [{ test: 'hoveredPeriod && datum.period !== hoveredPeriod', value: 0.2 }, { value: 1 }],
302
+ },
303
+ },
304
+ },
305
+ ],
306
+ };
307
+ }
308
+ render() {
309
+ return (h(Host, { key: 'a0aebbff4fb177de35eb90329de81a1098663620' }, h("div", { key: '9e753e876df877d46254a02349850414914d9231', id: "container", style: { width: '100%', height: '100%' } })));
310
+ }
311
+ };
312
+
313
+ export { ApolloDataBarChart as apollo_data_bar_chart };