@eox/chart 2.0.0-alpha7b → 2.0.0-alpha9
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 +8 -0
- package/dist/assets/{main-0d4938a0.js → main-7bb39df5.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/interface.mjs +82 -27
- package/dist/interface.umd.js +1 -1
- package/package.json +8 -1
- package/src/interface.ts +13 -10
- package/src/main.ts +1 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -9
- package/.prettierignore +0 -2
- package/cypress/e2e/general.cy.ts +0 -34
- package/cypress/e2e/sh.json +0 -417
- package/cypress/e2e/shDisplay.cy.ts +0 -26
- package/cypress/e2e/signalsEndpoint.cy.ts +0 -145
- package/cypress.config.ts +0 -11
- package/index.html +0 -82
- package/public/interface.mjs +0 -53
- package/public/interface.umd.js +0 -1
- package/public/test.html +0 -23
- package/test.html +0 -23
- package/tsconfig.json +0 -21
- package/vite.config.interface.ts +0 -19
- package/vite.config.map.ts +0 -15
package/README.md
CHANGED
|
@@ -22,4 +22,4 @@ var tc=Object.defineProperty;var ec=(i,t,e)=>t in i?tc(i,t,{enumerable:!0,config
|
|
|
22
22
|
* Released under the MIT license
|
|
23
23
|
*/const ip={datetime:O.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:O.TIME_WITH_SECONDS,minute:O.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Ma._date.override({_id:"luxon",_create:function(i){return O.fromMillis(i,this.options)},init(i){this.options.locale||(this.options.locale=i.locale)},formats:function(){return ip},parse:function(i,t){const e=this.options,s=typeof i;return i===null||s==="undefined"?null:(s==="number"?i=this._create(i):s==="string"?typeof t=="string"?i=O.fromFormat(i,t,e):i=O.fromISO(i,e):i instanceof Date?i=O.fromJSDate(i,e):s==="object"&&!(i instanceof O)&&(i=O.fromObject(i,e)),i.isValid?i.valueOf():null)},format:function(i,t){const e=this._create(i);return typeof t=="string"?e.toFormat(t):e.toLocaleString(t)},add:function(i,t,e){const s={};return s[e]=t,this._create(i).plus(s).valueOf()},diff:function(i,t,e){return this._create(i).diff(this._create(t)).as(e).valueOf()},startOf:function(i,t,e){if(t==="isoWeek"){e=Math.trunc(Math.min(Math.max(0,e),6));const s=this._create(i);return s.minus({days:(s.weekday-e+7)%7}).startOf("day").valueOf()}return t?this._create(i).startOf(t).valueOf():i},endOf:function(i,t){return this._create(i).endOf(t).valueOf()}});function sp(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var vn={},np={get exports(){return vn},set exports(i){vn=i}},jl={};function St(i,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var rp=St;St.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};St.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};St.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var t=new Date().getTime();if(i&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var e=this._timeouts.shift();if(e===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),e=this._cachedTimeouts.slice(-1);else return!1;var s=this;return this._timer=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},e),this._options.unref&&this._timer.unref(),!0};St.prototype.attempt=function(i,t){this._fn=i,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var e=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){e._operationTimeoutCb()},e._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};St.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};St.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};St.prototype.start=St.prototype.try;St.prototype.errors=function(){return this._errors};St.prototype.attempts=function(){return this._attempts};St.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},t=null,e=0,s=0;s<this._errors.length;s++){var n=this._errors[s],r=n.message,o=(i[r]||0)+1;i[r]=o,o>=e&&(t=n,e=o)}return t};(function(i){var t=rp;i.operation=function(e){var s=i.timeouts(e);return new t(s,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},i.timeouts=function(e){if(e instanceof Array)return[].concat(e);var s={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)s[n]=e[n];if(s.minTimeout>s.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<s.retries;o++)r.push(this.createTimeout(o,s));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,s)),r.sort(function(a,l){return a-l}),r},i.createTimeout=function(e,s){var n=s.randomize?Math.random()+1:1,r=Math.round(n*Math.max(s.minTimeout,1)*Math.pow(s.factor,e));return r=Math.min(r,s.maxTimeout),r},i.wrap=function(e,s,n){if(s instanceof Array&&(n=s,s=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var o=0;o<n.length;o++){var a=n[o],l=e[a];e[a]=function(h){var u=i.operation(s),d=Array.prototype.slice.call(arguments,1),f=d.pop();d.push(function(m){u.retry(m)||(m&&(arguments[0]=u.mainError()),f.apply(this,arguments))}),u.attempt(function(){h.apply(e,d)})}.bind(e,l),e[a].options=s}}})(jl);(function(i){i.exports=jl})(np);const op=sp(vn),ap=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed"]);class Ul extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const lp=(i,t,e)=>{const s=e.retries-(t-1);return i.attemptNumber=t,i.retriesLeft=s,i},cp=i=>ap.has(i),Bo=i=>globalThis.DOMException===void 0?new Error(i):new DOMException(i);async function hp(i,t){return new Promise((e,s)=>{t={onFailedAttempt(){},retries:10,...t};const n=op.operation(t);n.attempt(async r=>{try{e(await i(r))}catch(o){if(!(o instanceof Error)){s(new TypeError(`Non-error was thrown: "${o}". You should only throw errors.`));return}if(o instanceof Ul)n.stop(),s(o.originalError);else if(o instanceof TypeError&&!cp(o.message))n.stop(),s(o);else{lp(o,r,t);try{await t.onFailedAttempt(o)}catch(a){s(a);return}n.retry(o)||s(n.mainError())}}}),t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",()=>{n.stop();const r=t.signal.reason===void 0?Bo("The operation was aborted."):t.signal.reason;s(r instanceof Error?r:Bo(r))},{once:!0})})}const Ps={errorBarLineWidth:{v:[1,3]},errorBarColor:{v:["#2c2c2c","#1f1f1f"]},errorBarWhiskerLineWidth:{v:[1,3]},errorBarWhiskerRatio:{v:[.2,.25]},errorBarWhiskerSize:{v:[20,24]},errorBarWhiskerColor:{v:["#2c2c2c","#1f1f1f"]}},Yn={_scriptable:!0,_indexable:i=>i!=="v"},Ho=Object.keys(Ps);function Zn(i,t){const e=Array.isArray(i)?i:[i],s=Array.isArray(t)?t:[t];if(e.length===s.length)return e.map((r,o)=>[r,s[o]]);const n=Math.max(e.length,s.length);return Array(n).map((r,o)=>[e[o%e.length],s[o%s.length]])}function dt(i,t){if(typeof i=="string"||typeof i=="number")return i;const e=Array.isArray(i)?i:i.v;return e[t%e.length]}function qn(i,t,e){const s=dt(t.errorBarWhiskerRatio,e);return i!=null&&s>0?i*s*.5:dt(t.errorBarWhiskerSize,e)*.5}function up(i,t,e,s,n){n.save(),n.translate(i.x,0);const r=Zn(t??i.y,e??i.y);r.reverse().forEach(([o,a],l)=>{const c=r.length-l-1,h=qn(i.width,s,c);n.lineWidth=dt(s.errorBarLineWidth,c),n.strokeStyle=dt(s.errorBarColor,c),n.beginPath(),n.moveTo(0,o),n.lineTo(0,a),n.stroke(),n.lineWidth=dt(s.errorBarWhiskerLineWidth,c),n.strokeStyle=dt(s.errorBarWhiskerColor,c),n.beginPath(),n.moveTo(-h,o),n.lineTo(h,o),n.moveTo(-h,a),n.lineTo(h,a),n.stroke()}),n.restore()}function dp(i,t,e,s,n){n.save(),n.translate(0,i.y);const r=Zn(t??i.x,e??i.x);r.reverse().forEach(([o,a],l)=>{const c=r.length-l-1,h=qn(i.height,s,c);n.lineWidth=dt(s.errorBarLineWidth,c),n.strokeStyle=dt(s.errorBarColor,c),n.beginPath(),n.moveTo(o,0),n.lineTo(a,0),n.stroke(),n.lineWidth=dt(s.errorBarWhiskerLineWidth,c),n.strokeStyle=dt(s.errorBarWhiskerColor,c),n.beginPath(),n.moveTo(o,-h),n.lineTo(o,h),n.moveTo(a,-h),n.lineTo(a,h),n.stroke()}),n.restore()}function Yl(i,t){var e,s,n,r;const o=i.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);(o.xMin!=null||o.xMax!=null)&&dp(o,(e=o.xMin)!==null&&e!==void 0?e:null,(s=o.xMax)!==null&&s!==void 0?s:null,i.options,t),(o.yMin!=null||o.yMax!=null)&&up(o,(n=o.yMin)!==null&&n!==void 0?n:null,(r=o.yMax)!==null&&r!==void 0?r:null,i.options,t)}function fp(i,t,e,s,n){n.save(),n.translate(i.x,i.y);const r=(i.startAngle+i.endAngle)/2,o=Math.cos(r),a=Math.sin(r),l={x:-a,y:o},c=Math.sqrt(l.x*l.x+l.y*l.y);l.x/=c,l.y/=c;const h=Zn(t??i.outerRadius,e??i.outerRadius);h.reverse().forEach(([u,d],f)=>{const m=h.length-f-1,g=u*o,p=u*a,b=d*o,y=d*a,v=qn(null,s,m),_=l.x*v,x=l.y*v;n.lineWidth=dt(s.errorBarLineWidth,m),n.strokeStyle=dt(s.errorBarColor,m),n.beginPath(),n.moveTo(g,p),n.lineTo(b,y),n.stroke(),n.lineWidth=dt(s.errorBarWhiskerLineWidth,m),n.strokeStyle=dt(s.errorBarWhiskerColor,m),n.beginPath(),n.moveTo(g+_,p+x),n.lineTo(g-_,p-x),n.moveTo(b+_,y+x),n.lineTo(b-_,y-x),n.stroke()}),n.restore()}function mp(i,t){const e=i.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);(e.rMin!=null||e.rMax!=null)&&fp(e,e.rMin,e.rMax,i.options,t)}class Ze extends xe{draw(t){super.draw(t),Yl(this,t)}}Ze.id="barWithErrorBar";Ze.defaults={...xe.defaults,...Ps};Ze.defaultRoutes=xe.defaultRoutes;Ze.descriptors=Yn;class yt extends ye{draw(t,e){super.draw.call(this,t,e),Yl(this,t)}}yt.id="pointWithErrorBar";yt.defaults={...ye.defaults,...Ps};yt.defaultRoutes=ye.defaultRoutes;yt.descriptors=Yn;class qe extends be{draw(t){super.draw(t),mp(this,t)}}qe.id="arcWithErrorBar";qe.defaults={...be.defaults,...Ps};qe.defaultRoutes=be.defaultRoutes;qe.descriptors=Yn;const wn=["xMin","xMax","yMin","yMax"];function Zl(i){return i?wn.slice(0,2):wn.slice(2)}function Di(i,t,e,s,n){const r=[`${s.axis}Min`,`${s.axis}Max`],o=s.getBasePixel();for(const a of r){const l=t[a];Array.isArray(l)?i[a]=l.map(c=>n?o:s.getPixelForValue(c,e)):typeof l=="number"?i[a]=n?o:s.getPixelForValue(l,e):i[a]=null}}function gp(i,t,e,s,n){const r=n.animation,o=[`${e.axis}Min`,`${e.axis}Max`],a=l=>{const c=e.getDistanceFromCenterForValue(l),h=r.animateScale?0:c;return s?h:c};for(const l of o){const c=t[l];Array.isArray(c)?i[l]=c.map(a):typeof c=="number"?i[l]=a(c):i[l]=null}}function Xn(i){return Array.isArray(i)?i.slice().reverse():i}function ql(i){const t=Zl(i.element.horizontal),e=$a.defaults.callbacks.label.call(this,i),s=i.chart.data.datasets[i.datasetIndex].data[i.dataIndex];return s==null||t.every(n=>s[n]==null)?e:`${e} (${Xn(s[t[0]])} .. ${s[t[1]]})`}function pp(i){const t=i.chart.data.datasets[i.datasetIndex].data[i.dataIndex],e=(s,n)=>{const r=Zl(n);return t==null||r.every(o=>t[o]==null)?s:`${s} [${Xn(t[r[0]])} .. ${t[r[1]]}]`};return`(${e(i.label,!0)}, ${e(i.parsed.y,!1)})`}function bp(i){const t=Ft.overrides.plugins.tooltip.callbacks.label.call(this,i),e=i.chart.data.datasets[i.datasetIndex].data[i.dataIndex],s=["rMin","rMax"];return e==null||s.every(n=>e[n]==null)?t:`${t} [${Xn(e[s[0]])} .. ${e[s[1]]}]`}const Xl={color(i,t,e){const s=i||"transparent",n=t||"transparent";if(s===n)return t;const r=ds(s),o=r.valid&&ds(n);return o&&o.valid?o.mix(r,e).hexString():t},number(i,t,e){return i===t?t:i+(t-i)*e}};function Gl(i,t,e,s,n){if(typeof i===s&&typeof t===s)return n(i,t,e);if(Array.isArray(i)&&Array.isArray(t))return i.map((o,a)=>n(o,t[a],e));const r=o=>o&&Array.isArray(o.v);return r(i)&&r(t)?{v:i.v.map((o,a)=>n(o,t.v[a],e))}:t}function yp(i,t,e){return Gl(i,t,e,"number",Xl.number)}function xp(i,t,e){return Gl(i,t,e,"string",Xl.color)}const Is={animations:{numberArray:{fn:yp,properties:wn.concat(Ho.filter(i=>!i.endsWith("Color")),["rMin","rMax"])},colorArray:{fn:xp,properties:Ho.filter(i=>i.endsWith("Color"))}}};function Ls(i,t){const{axis:e}=i;i.axis=`${e}MinMin`;const{min:s}=t(i);i.axis=`${e}MaxMax`;const{max:n}=t(i);return i.axis=e,{min:s,max:n}}function $o(i,t,e){return Array.isArray(t)?e(i,...t):typeof t=="number"?e(i,t):i}function He(i,t,e,s,n){const r=typeof t=="string"?t:t.axis,o=`${r}Min`,a=`${r}Max`,l=`${r}MinMin`,c=`${r}MaxMax`;for(let h=0;h<n;h+=1){const u=h+s,d=i[h];d[o]=typeof e[u]=="object"?e[u][o]:null,d[a]=typeof e[u]=="object"?e[u][a]:null,d[l]=$o(d[r],d[o],Math.min),d[c]=$o(d[r],d[a],Math.max)}}function Jl(i,t,e,s){const{axis:n}=t,r=t.getLabels();for(let o=0;o<s;o+=1){const a=o+e,l=i[o];l[n]=t.parse(r[a],a)}}function Fs(i,t,e,s=[],n=[]){at.addControllers(e),Array.isArray(s)?at.addElements(...s):at.addElements(s),Array.isArray(n)?at.addScales(...n):at.addScales(n);const r=t;return r.type=i,r}class Xe extends te{getMinMax(t,e){return Ls(t,s=>super.getMinMax(s,e))}parsePrimitiveData(t,e,s,n){const r=super.parsePrimitiveData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseObjectData(t,e,s,n){const r=super.parseObjectData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseErrorData(t,e,s,n,r){He(t,e.vScale,s,n,r),Jl(t,e.iScale,n,r)}updateElement(t,e,s,n){typeof e=="number"&&Di(s,this.getParsed(e),e,this._cachedMeta.vScale,n==="reset"),super.updateElement(t,e,s,n)}}Xe.id="barWithErrorBars";Xe.defaults=bt({},[te.defaults,Is,{dataElementType:Ze.id}]);Xe.overrides=bt({},[te.overrides,{plugins:{tooltip:{callbacks:{label:ql}}}}]);Xe.defaultRoutes=te.defaultRoutes;class _p extends ht{constructor(t,e){super(t,Fs("barWithErrorBars",e,Xe,Ze,[Me,We]))}}_p.id=Xe.id;const jo=["linear","logarithmic","time","timeseries"];class Te extends $t{getMinMax(t,e){return Ls(t,s=>super.getMinMax(s,e))}parsePrimitiveData(t,e,s,n){const r=super.parsePrimitiveData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseObjectData(t,e,s,n){const r=super.parseObjectData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseErrorData(t,e,s,n,r){He(t,e.vScale,s,n,r);const o=e.iScale;jo.includes(o.type)?He(t,e.iScale,s,n,r):Jl(t,e.iScale,n,r)}updateElement(t,e,s,n){t instanceof yt&&typeof e=="number"&&this.updateElementScale(e,s,n),super.updateElement(t,e,s,n)}updateElementScale(t,e,s){Di(e,this.getParsed(t),t,this._cachedMeta.vScale,s==="reset");const n=this._cachedMeta.iScale;jo.includes(n.type)&&Di(e,this.getParsed(t),t,this._cachedMeta.iScale,s==="reset")}updateElements(t,e,s,n){const r=n==="reset",a=this.chart._animationsDisabled||r||n==="none";if(super.updateElements(t,e,s,n),!!a)for(let l=e;l<e+s;++l){const c=t[l];c instanceof yt&&this.updateElementScale(l,c,n)}}}Te.id="lineWithErrorBars";Te.defaults=bt({},[$t.defaults,Is,{dataElementType:yt.id}]);Te.overrides=bt({},[$t.overrides,{plugins:{tooltip:{callbacks:{label:ql}}}}]);Te.defaultRoutes=$t.defaultRoutes;class Kl extends ht{constructor(t,e){super(t,Fs("lineWithErrorBars",e,Te,yt,[Me,We]))}}Kl.id=Te.id;class Oe extends pe{getMinMax(t,e){return Ls(t,s=>super.getMinMax(s,e))}parsePrimitiveData(t,e,s,n){const r=super.parsePrimitiveData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseObjectData(t,e,s,n){const r=super.parseObjectData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseErrorData(t,e,s,n,r){He(t,e.xScale,s,n,r),He(t,e.yScale,s,n,r)}updateElement(t,e,s,n){t instanceof yt&&typeof e=="number"&&this.updateElementScale(e,s,n),super.updateElement(t,e,s,n)}updateElementScale(t,e,s){Di(e,this.getParsed(t),t,this._cachedMeta.xScale,s==="reset"),Di(e,this.getParsed(t),t,this._cachedMeta.yScale,s==="reset")}updateElements(t,e,s,n){const r=n==="reset",a=this.chart._animationsDisabled||r||n==="none";if(super.updateElements(t,e,s,n),!!a)for(let l=e;l<e+s;++l){const c=t[l];c instanceof yt&&this.updateElementScale(l,c,n)}}}Oe.id="scatterWithErrorBars";Oe.defaults=bt({},[pe.defaults,Is,{dataElementType:yt.id}]);Oe.overrides=bt({},[pe.overrides,{plugins:{tooltip:{callbacks:{label:pp}}}}]);Oe.defaultRoutes=$t.defaultRoutes;class Ql extends ht{constructor(t,e){super(t,Fs("scatterWithErrorBars",e,Oe,yt,[Me]))}}Ql.id=Oe.id;class Ge extends Ft{getMinMaxImpl(t){const e=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((n,r)=>{const o=this.getParsed(r)[t.axis];Number.isNaN(o)||!this.chart.getDataVisibility(r)||(o<s.min&&(s.min=o),o>s.max&&(s.max=o))}),s}getMinMax(t){return Ls(t,e=>this.getMinMaxImpl(e))}countVisibleElements(){const t=this._cachedMeta;return t.data.reduce((e,s,n)=>!Number.isNaN(t._parsed[n].r)&&this.chart.getDataVisibility(n)?e+1:e,0)}parsePrimitiveData(t,e,s,n){const r=super.parsePrimitiveData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseObjectData(t,e,s,n){const r=super.parseObjectData(t,e,s,n);return this.parseErrorData(r,t,e,s,n),r}parseErrorData(t,e,s,n,r){const o=e.rScale;for(let a=0;a<r;a+=1){const l=a+n,c=s[l],h=o.parse(c[o.axis],l);t[a]={[o.axis]:h}}He(t,o,s,n,r)}updateElement(t,e,s,n){typeof e=="number"&&gp(s,this.getParsed(e),this._cachedMeta.rScale,n==="reset",this.chart.options),super.updateElement(t,e,s,n)}updateElements(t,e,s,n){const r=this.chart.scales.r,o=r.getDistanceFromCenterForValue;r.getDistanceFromCenterForValue=function(l){return typeof l=="number"?o.call(this,l):o.call(this,l.r)},super.updateElements(t,e,s,n),r.getDistanceFromCenterForValue=o}}Ge.id="polarAreaWithErrorBars";Ge.defaults=bt({},[Ft.defaults,Is,{dataElementType:qe.id}]);Ge.overrides=bt({},[Ft.overrides,{plugins:{tooltip:{callbacks:{label:bp}}}}]);Ge.defaultRoutes=Ft.defaultRoutes;class vp extends ht{constructor(t,e){super(t,Fs("polarAreaWithErrorBars",e,Ge,qe,[Le]))}}vp.id=Ge.id;ht.register(Te,Kl,yt,Ql,Oe,Me,We);class wp{constructor(t,e){k(this,"chart");k(this,"startTime");k(this,"endTime");k(this,"timeAggregation");k(this,"options");k(this,"chartOptions");k(this,"dataStorage");k(this,"status");k(this,"activeFields");this.chart=t,this.options=e,this.startTime=O.now().minus(e.timeInterval),this.endTime=O.now(),e.startTime&&e.endTime&&(this.startTime=O.fromISO(e.startTime).setZone("UTC"),this.endTime=O.fromISO(e.endTime).setZone("UTC")),this.options.timeAggregation&&(this.timeAggregation=this.options.timeAggregation),this.options.retries=this.options.retries?this.options.retries:5,this.options.normalize=this.options.normalize?this.options.normalize:!1,this.options.showMinMax=this.options.showMinMax?this.options.showMinMax:!1,this.dataStorage={},this.options.features.forEach((s,n)=>this.dataStorage[n]={}),this.status="ready",this.chartOptions={scales:{x:{type:"time",min:this.startTime.toISODate(),max:this.endTime.toISODate(),ticks:{minRotation:0,maxRotation:0}}},interaction:{axis:"x",mode:"nearest",intersect:!1},plugins:{legend:{labels:{usePointStyle:!0,pointStyle:"rect",padding:5,sort:(s,n)=>s.text.localeCompare(n.text)},position:"right",onClick:(s,n)=>{if(n.hidden)this.setActiveFields([...this.activeFields,n.text]);else{const r=this.activeFields.indexOf(n.text),o=this.activeFields;o.splice(r,1),this.setActiveFields(o)}}},tooltip:{callbacks:{title:s=>{var r;return((r=s[0])==null?void 0:r.raw).x.toISODate()},label:s=>{const n=s.raw;return`${s.dataset.label}: ↔ ${n.y.toPrecision(3)}; ↓ ${n.yMin.toPrecision(3)}, ↑ ${n.yMax.toPrecision(3)}`}}}}}}checkLoadingStatus(){const t=document.getElementById("loadingIndicator");let e=!1;Object.keys(this.dataStorage).forEach((s,n)=>{Object.keys(this.dataStorage[n]).forEach(r=>{this.dataStorage[n][r].status==="fetching"&&(e=!0)})}),t.className=e?"loader":"loader hidden"}fetchSignals(t,e,s){const n=this.options.features[t].map(c=>`feature=${c}`).join("&"),r=`${e?"&start_date="+e.toISODate():""}${s?"&end_date="+s.toISODate():""}`,o=`${this.options.endpoint}?source=${this.options.source}&${n}${r}`,a=this.options.geometry;async function l(){const c=await fetch(o,{headers:{"Content-Type":"application/json; charset=utf-8"},method:"POST",mode:"cors",body:JSON.stringify({geometry:a})});if(c.status===404)throw new Ul(c.statusText);if(c.status!==200)throw Error(c.statusText);return c}return hp(l,{onFailedAttempt:c=>{console.log(`Attempt ${c.attemptNumber} failed. There are ${c.retriesLeft} retries left.`)},retries:this.options.retries}).then(function(c){return c.json()})}updateChart(){this.checkLoadingStatus(),this.chart.options=this.chartOptions;const t=[];this.options.features.flat().forEach((e,s)=>{let n=-1;if(this.options.features.forEach((r,o)=>{r.includes(e)&&(n=o)}),n!==-1){let r=[];Object.keys(this.dataStorage[n]).forEach(u=>{const d=this.dataStorage[n][u];d.status==="finished"?Object.keys(d.data).length!==0&&Object.keys(d.data).includes(e)&&r.push(...d.data[e]):r.push({date:"missing"})});let o=!1,a=Number.MIN_VALUE,l=Number.MAX_VALUE,c=r.map(u=>{let d={};if(u&&u.date!=="missing"){const f=u.basicStats;this.options.showMinMax?(l=f.min<l?f.min:l,a=f.max>a?f.max:a):(l=f.mean<l?f.mean:l,a=f.mean>a?f.mean:a),d={x:O.fromISO(u.date).setZone("UTC"),y:u.basicStats.mean,yMin:u.basicStats.min,yMax:u.basicStats.max},o=!0}return d});if(o&&this.timeAggregation){a=Number.MIN_VALUE,l=Number.MAX_VALUE;const u=[];let d=0,f=O.fromObject({year:this.startTime.year,month:this.startTime.month,day:this.startTime.day});for(;f<this.endTime;){let m=0,g=0,p=0;for(;d<c.length&&(Object.keys(c[d]).length===0||c[d].x<f);)d++;const b=d;for(;d<c.length&&(Object.keys(c[d]).length===0||c[d].x<f.plus(this.timeAggregation));){const _=c[d];m+=_.y,g+=_.yMin,p+=_.yMax,d++}const v=d-b;if(v>0){const _=m/v,x=g/v,w=p/v;this.options.showMinMax?(l=x<l?x:l,a=w>a?w:a):(l=_<l?_:l,a=_>a?_:a),u.push({x:f,y:_,yMin:x,yMax:w})}f=f.plus(this.timeAggregation)}c=u}o&&this.options.normalize&&(c=c.map(u=>(u.y=(u.y-l)/(a-l),u.yMin=(u.yMin-l)/(a-l),u.yMax=(u.yMax-l)/(a-l),u)));let h={type:"line",label:e,data:c,hidden:!this.activeFields.includes(e)};if(this.options.showMinMax&&(h={type:"lineWithErrorBars",label:e,data:c,hidden:!this.activeFields.includes(e),errorBarWhiskerLineWidth:2,errorBarColor:"#00000000"}),this.options.colors&&this.options.colors.length>=s){const u=this.options.colors[s];h.backgroundColor=u,h.borderColor=u,this.options.showMinMax&&(h={type:"lineWithErrorBars",label:e,data:c,hidden:!this.activeFields.includes(e),errorBarWhiskerLineWidth:2,errorBarColor:"#00000000",errorBarWhiskerColor:u,errorBarWhiskerSize:10,backgroundColor:u,borderColor:u})}t.push(h)}}),this.chart.data={datasets:t},this.chart.update("none")}retrieveMissingData(){const t=[];this.activeFields.forEach(n=>{this.options.features.forEach((r,o)=>{r.includes(n)&&!t.includes(o)&&t.push(o)})});let e=O.fromObject({year:this.endTime.year,month:this.endTime.month}).plus({month:1}).minus({second:1});const s=O.fromObject({year:this.startTime.year,month:this.startTime.month}).plus({month:1}).minus({second:1});for(;e>s;){const n=e.toFormat("yyyyMM");t.forEach(r=>{if(!(n in this.dataStorage[r])){const o=this.fetchSignals(r,O.fromObject({year:e.year,month:e.month}),O.fromObject({year:e.year,month:e.month}).plus({month:1}).minus({second:1})).then(a=>{this.dataStorage[r][n].data=a,this.dataStorage[r][n].status="finished",this.updateChart()}).catch(()=>{this.dataStorage[r][n].status="failed",this.updateChart()});this.dataStorage[r][n]={request:o,status:"fetching"}}}),e=e.minus({months:1})}}triggerCSVDownload(){const t=[],e=[],s=this.activeFields;s.forEach((l,c)=>{let h=-1;if(this.options.features.forEach((u,d)=>{u.includes(l)&&(h=d)}),h!==-1){let u=[];Object.keys(this.dataStorage[h]).forEach(d=>{const f=this.dataStorage[h][d];f.status==="finished"&&Object.keys(f.data).length!==0&&Object.keys(f.data).includes(l)&&u.push(...f.data[l])}),u.length>0&&(e.push(s[c]),t.push(u))}});const n={};e.forEach((l,c)=>{t[c].forEach(h=>{n[h.date]||(n[h.date]={}),n[h.date][l]=h.basicStats})});let r="time,";const o=e.map(l=>[l,`${l}_max`,`${l}_min`]);r+=o.flat().join(","),r+=`
|
|
24
24
|
`,Object.keys(n).forEach(l=>{const c=[l];e.forEach(h=>{const u=n[l][h]?n[l][h]:null;u!=null?c.push(u.mean,u.max,u.min):c.push("","","")}),r+=c.join(","),r+=`
|
|
25
|
-
`});var a=document.createElement("a");a.href="data:text/csv;charset=utf-8,"+encodeURI(r),a.target="_blank",a.download="chart_data.csv",a.click()}setGeometry(t){this.dataStorage={},this.options.features.forEach((e,s)=>this.dataStorage[s]={}),this.options.geometry=t,this.retrieveMissingData(),this.updateChart()}setActiveFields(t){this.activeFields=t,this.retrieveMissingData(),this.updateChart()}setTimeInterval(t,e){this.startTime=t,this.endTime=e,this.chartOptions.scales.x.min=t.toISODate(),this.chartOptions.scales.x.max=e.toISODate(),this.retrieveMissingData(),this.updateChart()}setNormalize(t){this.options.normalize=t,this.updateChart()}setShowMinMax(t){this.options.showMinMax=t,this.updateChart()}setTimeAggregation(t){this.timeAggregation=t,this.updateChart()}}class Mp{constructor(t,e,s,n){k(this,"element");k(this,"sdm");k(this,"sdmOptions");k(this,"options");this.element=t,this.sdm=e,this.options=n,this.sdmOptions=s,this.generateTimeAggregationOptions(),this.addNormalizeCheckbox(),this.addShowMinMax(),this.addCSVDownload(),this.generateTimeSelectionOptions();const r=document.createElement("span");r.id="loadingIndicator",r.className="loader hidden",this.element.appendChild(r)}removeStartEndInputs(){const t=document.getElementById("startInput"),e=document.getElementById("endInput"),s=document.getElementById("setTime");t&&e&&s&&(t.remove(),e.remove(),s.remove())}addStartEndInputs(){const t=document.createElement("input");t.id="startInput",t.size=8,t.value=this.sdm.startTime.toISODate();const e=document.createElement("input");e.id="endInput",e.size=8,e.value=this.sdm.endTime.toISODate(),this.element.appendChild(t),this.element.appendChild(e);var s=document.createElement("button");s.id="setTime",s.textContent="ok",this.element.appendChild(s),s.addEventListener("click",()=>{const n=O.fromISO(t.value),r=O.fromISO(e.value);n.isValid&&r.isValid?(this.sdm.setTimeInterval(n,r),this.removeStartEndInputs()):(t.className=n.isValid?"":"parsingError",e.className=r.isValid?"":"parsingError")})}addNormalizeCheckbox(){var t=document.createElement("input");t.type="checkbox",t.id="normalize",t.value="normalize",t.checked=this.sdmOptions.normalize;var e=document.createElement("label");e.htmlFor="normalize",e.appendChild(document.createTextNode("normalize")),this.element.appendChild(e),this.element.appendChild(t),t.addEventListener("change",()=>{this.sdm.setNormalize(t.checked)})}addShowMinMax(){var t=document.createElement("input");t.type="checkbox",t.id="showMinMax",t.value="showMinMax",t.checked=this.sdmOptions.showMinMax;var e=document.createElement("label");e.htmlFor="showMinMax",e.appendChild(document.createTextNode("show min/max")),this.element.appendChild(e),this.element.appendChild(t),t.addEventListener("change",()=>{this.sdm.setShowMinMax(t.checked)})}addCSVDownload(){var t=document.createElement("button");t.id="csvDownload",t.textContent="download csv",this.element.appendChild(t),t.addEventListener("click",()=>{this.sdm.triggerCSVDownload()})}generateTimeSelectionOptions(){const t=[{text:"3 months back",value:"month-3"},{text:"6 months back",value:"month-6"},{text:"1 year back",value:"year-1"},{text:"2 years back",value:"year-2"},{text:"3 years back",value:"year-3"},{text:"custom",value:"custom"}],e=document.createElement("select");t.forEach(s=>{const n=document.createElement("option");n.text=s.text,n.value=s.value,e.appendChild(n)}),this.element.appendChild(e),e.addEventListener("change",s=>{const n=O.now(),[r,o]=s.target.value.split("-");switch(this.removeStartEndInputs(),r){case"month":this.sdm.setTimeInterval(n.minus({month:Number(o)}),n);break;case"year":this.sdm.setTimeInterval(n.minus({year:Number(o)}),n);break;case"custom":this.addStartEndInputs();break}})}generateTimeAggregationOptions(){const t=[{text:"no aggregation",value:"none"},{text:"1 week",value:"week-1"},{text:"2 weeks",value:"week-2"},{text:"1 month",value:"month-1"},{text:"3 months",value:"month-3"},{text:"6 months",value:"month-6"}],e=document.createElement("select");t.forEach(n=>{const r=document.createElement("option");r.text=n.text,r.value=n.value,e.appendChild(r)}),this.element.appendChild(e),e.addEventListener("change",n=>{const[r,o]=n.target.value.split("-");switch(r){case"none":this.sdm.setTimeAggregation(null);break;case"week":this.sdm.setTimeAggregation({week:Number(o)});break;case"month":this.sdm.setTimeAggregation({month:Number(o)});break;case"year":this.sdm.setTimeAggregation({year:Number(o)});break}});const s=document.createElement("span");s.id="loadingIndicator",s.className="loader hidden",this.element.appendChild(s)}}const de=new ht(document.getElementById("chart"),{data:{labels:[],datasets:[]},plugins:[{id:"selectionLineHighlight",afterDraw:i=>{if(i&&i.tooltip){const t=i.tooltip.getActiveElements();if(t!=null&&t.length){let e=t[0].element.x,s=i.scales.y,n=i.ctx;n.save(),n.beginPath(),n.moveTo(e,s.top),n.lineTo(e,s.bottom),n.lineWidth=1,n.strokeStyle="rgba(0, 0, 255, 0.4)",n.stroke(),n.restore()}}}}]});let vi=null,Mn;window.addEventListener("message",i=>{i.data==="init"&&(Mn=i.ports[0],Mn.onmessage=Sp)});const Sp=i=>{if(i.data.ts)switch(i.data.type){case"getFoo":console.log(i.data.body),Mn.postMessage({ts:i.data.ts,body:"foo bar"});break}else switch(i.data.type){case"setData":de.data=i.data.body.data,de.update("none");break;case"setSignalsEndpoint":kp(i.data.body.options);break;case"setSignalsGeometry":Tp(i.data.body.
|
|
25
|
+
`});var a=document.createElement("a");a.href="data:text/csv;charset=utf-8,"+encodeURI(r),a.target="_blank",a.download="chart_data.csv",a.click()}setGeometry(t){this.dataStorage={},this.options.features.forEach((e,s)=>this.dataStorage[s]={}),this.options.geometry=t,this.retrieveMissingData(),this.updateChart()}setActiveFields(t){this.activeFields=t,this.retrieveMissingData(),this.updateChart()}setTimeInterval(t,e){this.startTime=t,this.endTime=e,this.chartOptions.scales.x.min=t.toISODate(),this.chartOptions.scales.x.max=e.toISODate(),this.retrieveMissingData(),this.updateChart()}setNormalize(t){this.options.normalize=t,this.updateChart()}setShowMinMax(t){this.options.showMinMax=t,this.updateChart()}setTimeAggregation(t){this.timeAggregation=t,this.updateChart()}}class Mp{constructor(t,e,s,n){k(this,"element");k(this,"sdm");k(this,"sdmOptions");k(this,"options");this.element=t,this.sdm=e,this.options=n,this.sdmOptions=s,this.generateTimeAggregationOptions(),this.addNormalizeCheckbox(),this.addShowMinMax(),this.addCSVDownload(),this.generateTimeSelectionOptions();const r=document.createElement("span");r.id="loadingIndicator",r.className="loader hidden",this.element.appendChild(r)}removeStartEndInputs(){const t=document.getElementById("startInput"),e=document.getElementById("endInput"),s=document.getElementById("setTime");t&&e&&s&&(t.remove(),e.remove(),s.remove())}addStartEndInputs(){const t=document.createElement("input");t.id="startInput",t.size=8,t.value=this.sdm.startTime.toISODate();const e=document.createElement("input");e.id="endInput",e.size=8,e.value=this.sdm.endTime.toISODate(),this.element.appendChild(t),this.element.appendChild(e);var s=document.createElement("button");s.id="setTime",s.textContent="ok",this.element.appendChild(s),s.addEventListener("click",()=>{const n=O.fromISO(t.value),r=O.fromISO(e.value);n.isValid&&r.isValid?(this.sdm.setTimeInterval(n,r),this.removeStartEndInputs()):(t.className=n.isValid?"":"parsingError",e.className=r.isValid?"":"parsingError")})}addNormalizeCheckbox(){var t=document.createElement("input");t.type="checkbox",t.id="normalize",t.value="normalize",t.checked=this.sdmOptions.normalize;var e=document.createElement("label");e.htmlFor="normalize",e.appendChild(document.createTextNode("normalize")),this.element.appendChild(e),this.element.appendChild(t),t.addEventListener("change",()=>{this.sdm.setNormalize(t.checked)})}addShowMinMax(){var t=document.createElement("input");t.type="checkbox",t.id="showMinMax",t.value="showMinMax",t.checked=this.sdmOptions.showMinMax;var e=document.createElement("label");e.htmlFor="showMinMax",e.appendChild(document.createTextNode("show min/max")),this.element.appendChild(e),this.element.appendChild(t),t.addEventListener("change",()=>{this.sdm.setShowMinMax(t.checked)})}addCSVDownload(){var t=document.createElement("button");t.id="csvDownload",t.textContent="download csv",this.element.appendChild(t),t.addEventListener("click",()=>{this.sdm.triggerCSVDownload()})}generateTimeSelectionOptions(){const t=[{text:"3 months back",value:"month-3"},{text:"6 months back",value:"month-6"},{text:"1 year back",value:"year-1"},{text:"2 years back",value:"year-2"},{text:"3 years back",value:"year-3"},{text:"custom",value:"custom"}],e=document.createElement("select");t.forEach(s=>{const n=document.createElement("option");n.text=s.text,n.value=s.value,e.appendChild(n)}),this.element.appendChild(e),e.addEventListener("change",s=>{const n=O.now(),[r,o]=s.target.value.split("-");switch(this.removeStartEndInputs(),r){case"month":this.sdm.setTimeInterval(n.minus({month:Number(o)}),n);break;case"year":this.sdm.setTimeInterval(n.minus({year:Number(o)}),n);break;case"custom":this.addStartEndInputs();break}})}generateTimeAggregationOptions(){const t=[{text:"no aggregation",value:"none"},{text:"1 week",value:"week-1"},{text:"2 weeks",value:"week-2"},{text:"1 month",value:"month-1"},{text:"3 months",value:"month-3"},{text:"6 months",value:"month-6"}],e=document.createElement("select");t.forEach(n=>{const r=document.createElement("option");r.text=n.text,r.value=n.value,e.appendChild(r)}),this.element.appendChild(e),e.addEventListener("change",n=>{const[r,o]=n.target.value.split("-");switch(r){case"none":this.sdm.setTimeAggregation(null);break;case"week":this.sdm.setTimeAggregation({week:Number(o)});break;case"month":this.sdm.setTimeAggregation({month:Number(o)});break;case"year":this.sdm.setTimeAggregation({year:Number(o)});break}});const s=document.createElement("span");s.id="loadingIndicator",s.className="loader hidden",this.element.appendChild(s)}}const de=new ht(document.getElementById("chart"),{data:{labels:[],datasets:[]},plugins:[{id:"selectionLineHighlight",afterDraw:i=>{if(i&&i.tooltip){const t=i.tooltip.getActiveElements();if(t!=null&&t.length){let e=t[0].element.x,s=i.scales.y,n=i.ctx;n.save(),n.beginPath(),n.moveTo(e,s.top),n.lineTo(e,s.bottom),n.lineWidth=1,n.strokeStyle="rgba(0, 0, 255, 0.4)",n.stroke(),n.restore()}}}}]});let vi=null,Mn;window.addEventListener("message",i=>{i.data==="init"&&(Mn=i.ports[0],Mn.onmessage=Sp)});const Sp=i=>{if(i.data.ts)switch(i.data.type){case"getFoo":console.log(i.data.body),Mn.postMessage({ts:i.data.ts,body:"foo bar"});break}else switch(i.data.type){case"setData":de.data=i.data.body.data,de.update("none");break;case"setSignalsEndpoint":kp(i.data.body.options);break;case"setSignalsGeometry":Tp(i.data.body.geometry);break;case"setSignalsData":de.data={datasets:Object.entries(i.data.body.data).map(([t,e])=>({type:"line",label:t,data:e}))},de.update("none");break;case"setOptions":de.options=i.data.body.options,de.update("none");break}},kp=i=>{vi=new wp(de,i),new Mp(document.getElementById("controls"),vi,i),vi.setActiveFields(i.active)},Tp=i=>{vi&&vi.setGeometry(i)};
|
package/dist/index.html
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>EOxElements Chart</title>
|
|
6
6
|
<style>
|
|
7
|
-
*{
|
|
7
|
+
* {
|
|
8
8
|
font-family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
|
|
9
9
|
font-size: 0.95em;
|
|
10
10
|
}
|
|
11
|
-
label{
|
|
11
|
+
label {
|
|
12
12
|
margin-top: 2.5px;
|
|
13
13
|
}
|
|
14
14
|
html,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
visibility: hidden;
|
|
27
27
|
}
|
|
28
28
|
.loader {
|
|
29
|
-
position: absolute;
|
|
29
|
+
position: absolute;
|
|
30
30
|
top: 5px;
|
|
31
31
|
right: 30px;
|
|
32
32
|
width: 24px;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
animation: rotation 1s linear infinite;
|
|
40
40
|
}
|
|
41
41
|
.loader::after {
|
|
42
|
-
content:
|
|
42
|
+
content: "";
|
|
43
43
|
box-sizing: border-box;
|
|
44
44
|
position: absolute;
|
|
45
45
|
left: 0;
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
flex-direction: row;
|
|
68
68
|
}
|
|
69
69
|
.parsingError {
|
|
70
|
-
background-color
|
|
70
|
+
background-color: #ff6d6d;
|
|
71
71
|
}
|
|
72
72
|
#chart {
|
|
73
73
|
padding-top: 30px;
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
|
-
<script type="module" crossorigin src="./assets/main-
|
|
76
|
+
<script type="module" crossorigin src="./assets/main-7bb39df5.js"></script>
|
|
77
77
|
</head>
|
|
78
78
|
<body>
|
|
79
79
|
<div id="controls" class="controls" data-cy="controls"></div>
|
package/dist/interface.mjs
CHANGED
|
@@ -1,53 +1,108 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var x = (s, t, e) => t in s ? f(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var h = (s, t, e) => (x(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
const b = "@eox/chart", w = "2.0.0-alpha9", v = {
|
|
5
|
+
"chart.js": "^4.2.1",
|
|
6
|
+
"chartjs-adapter-luxon": "^1.3.1",
|
|
7
|
+
"chartjs-chart-error-bars": "^4.1.2"
|
|
8
|
+
}, D = {
|
|
9
|
+
"@eox/eslint-config": "^1.0.0",
|
|
10
|
+
"@types/luxon": "^3.2.0",
|
|
11
|
+
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
12
|
+
"@typescript-eslint/parser": "^5.50.0",
|
|
13
|
+
cypress: "^12.6.0",
|
|
14
|
+
"cypress-vite": "^1.3.0",
|
|
15
|
+
"eslint-plugin-cypress": "^2.12.1",
|
|
16
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
17
|
+
install: "^0.13.0",
|
|
18
|
+
luxon: "^3.3.0",
|
|
19
|
+
npm: "^9.6.3",
|
|
20
|
+
"p-retry": "^5.1.2",
|
|
21
|
+
"pre-commit": "^1.2.2",
|
|
22
|
+
"start-server-and-test": "^1.15.2",
|
|
23
|
+
typescript: "^4.9.3",
|
|
24
|
+
vite: "^4.0.0"
|
|
25
|
+
}, M = {
|
|
26
|
+
npm: ">=8.0.0",
|
|
27
|
+
node: ">=18.0.0"
|
|
28
|
+
}, j = [
|
|
29
|
+
"dist",
|
|
30
|
+
"scripts",
|
|
31
|
+
"src",
|
|
32
|
+
"typings"
|
|
33
|
+
], S = "./dist/interface.mjs", C = {
|
|
34
|
+
start: "vite",
|
|
35
|
+
build: "tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",
|
|
36
|
+
watch: "node scripts/watch.mjs",
|
|
37
|
+
preview: "vite preview",
|
|
38
|
+
format: "prettier --write .",
|
|
39
|
+
lint: "eslint --ext .js,.ts .",
|
|
40
|
+
"lint:fix": "eslint --ext .js,.ts . --fix",
|
|
41
|
+
cypress: "start-server-and-test start 5173 'cypress open'",
|
|
42
|
+
test: "start-server-and-test start 5173 'cypress run'"
|
|
43
|
+
}, E = {
|
|
44
|
+
name: b,
|
|
45
|
+
version: w,
|
|
46
|
+
dependencies: v,
|
|
47
|
+
devDependencies: D,
|
|
48
|
+
engines: M,
|
|
49
|
+
files: j,
|
|
50
|
+
main: S,
|
|
51
|
+
scripts: C,
|
|
52
|
+
"pre-commit": [
|
|
53
|
+
"format",
|
|
54
|
+
"lint:fix"
|
|
55
|
+
]
|
|
56
|
+
}, u = new MessageChannel(), n = u.port1;
|
|
57
|
+
class k {
|
|
6
58
|
constructor(t) {
|
|
7
|
-
|
|
59
|
+
h(this, "iframe");
|
|
8
60
|
this.iframe = t;
|
|
9
61
|
}
|
|
10
62
|
setData(t) {
|
|
11
|
-
|
|
63
|
+
n.postMessage({ type: "setData", body: { data: t } });
|
|
12
64
|
}
|
|
13
65
|
setSignalsData(t) {
|
|
14
|
-
|
|
66
|
+
n.postMessage({ type: "setSignalsData", body: { data: t } });
|
|
15
67
|
}
|
|
16
68
|
setSignalsEndpoint(t) {
|
|
17
|
-
|
|
69
|
+
n.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
|
|
18
70
|
}
|
|
19
71
|
setSignalsGeometry(t) {
|
|
20
|
-
|
|
72
|
+
n.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
|
|
21
73
|
}
|
|
22
74
|
setOptions(t) {
|
|
23
|
-
|
|
75
|
+
n.postMessage({ type: "setOptions", body: { options: t } });
|
|
24
76
|
}
|
|
25
77
|
getFoo() {
|
|
26
78
|
return new Promise((t) => {
|
|
27
79
|
const e = Date.now();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
80
|
+
n.onmessage = (o) => {
|
|
81
|
+
o.data.ts === e && t(o.data.body);
|
|
82
|
+
}, n.postMessage({ ts: e, type: "getFoo", body: "hello world" });
|
|
31
83
|
});
|
|
32
84
|
}
|
|
33
85
|
}
|
|
34
|
-
const
|
|
35
|
-
var
|
|
86
|
+
const $ = (s) => s ? new Promise((t) => {
|
|
87
|
+
var a, c, p, l;
|
|
36
88
|
const e = document.createElement("iframe");
|
|
37
|
-
e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
|
|
89
|
+
if (e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
|
|
38
90
|
"src",
|
|
39
|
-
(
|
|
40
|
-
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
91
|
+
(c = (a = import.meta) == null ? void 0 : a.url) != null && c.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
|
|
92
|
+
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), !((l = (p = import.meta) == null ? void 0 : p.url) != null && l.includes("localhost"))) {
|
|
93
|
+
const r = `https://www.unpkg.com/@eox/chart@${E.version}/dist`;
|
|
94
|
+
fetch(`${r}/index.html`).then((i) => i.text()).then((i) => {
|
|
95
|
+
var d, m, g;
|
|
96
|
+
const y = i.replace("./assets/", `${r}/assets/`);
|
|
97
|
+
(d = e.contentDocument) == null || d.open(), (m = e.contentDocument) == null || m.write(y), (g = e.contentDocument) == null || g.close();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
let o = !1;
|
|
46
101
|
e.onload = () => {
|
|
47
|
-
var
|
|
48
|
-
|
|
102
|
+
var r;
|
|
103
|
+
o || ((r = e.contentWindow) == null || r.postMessage("init", "*", [u.port2]), o = !0, t(new k(e)));
|
|
49
104
|
};
|
|
50
105
|
}) : (console.error("no div selected"), null);
|
|
51
106
|
export {
|
|
52
|
-
|
|
107
|
+
$ as createChart
|
|
53
108
|
};
|
package/dist/interface.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s
|
|
1
|
+
(function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.Interface={}))})(this,function(n){"use strict";var v=Object.defineProperty;var S=(n,s,o)=>s in n?v(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o;var y=(n,s,o)=>(S(n,typeof s!="symbol"?s+"":s,o),o);const g={name:"@eox/chart",version:"2.0.0-alpha9",dependencies:{"chart.js":"^4.2.1","chartjs-adapter-luxon":"^1.3.1","chartjs-chart-error-bars":"^4.1.2"},devDependencies:{"@eox/eslint-config":"^1.0.0","@types/luxon":"^3.2.0","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",cypress:"^12.6.0","cypress-vite":"^1.3.0","eslint-plugin-cypress":"^2.12.1","eslint-plugin-typescript":"^0.14.0",install:"^0.13.0",luxon:"^3.3.0",npm:"^9.6.3","p-retry":"^5.1.2","pre-commit":"^1.2.2","start-server-and-test":"^1.15.2",typescript:"^4.9.3",vite:"^4.0.0"},engines:{npm:">=8.0.0",node:">=18.0.0"},files:["dist","scripts","src","typings"],main:"./dist/interface.mjs",scripts:{start:"vite",build:"tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",watch:"node scripts/watch.mjs",preview:"vite preview",format:"prettier --write .",lint:"eslint --ext .js,.ts .","lint:fix":"eslint --ext .js,.ts . --fix",cypress:"start-server-and-test start 5173 'cypress open'",test:"start-server-and-test start 5173 'cypress run'"},"pre-commit":["format","lint:fix"]},d=new MessageChannel,i=d.port1;class b{constructor(e){y(this,"iframe");this.iframe=e}setData(e){i.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){i.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){i.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){i.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){i.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const t=Date.now();i.onmessage=c=>{c.data.ts===t&&e(c.data.body)},i.postMessage({ts:t,type:"getFoo",body:"hello world"})})}}const w=r=>r?new Promise(e=>{var l,u;const t=document.createElement("iframe");if(t.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",t.setAttribute("src",(l=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&l.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),t.setAttribute("id","EOxChart"),r==null||r.appendChild(t),!((u=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&u.includes("localhost"))){const a=`https://www.unpkg.com/@eox/chart@${g.version}/dist`;fetch(`${a}/index.html`).then(p=>p.text()).then(p=>{var f,m,h;const x=p.replace("./assets/",`${a}/assets/`);(f=t.contentDocument)==null||f.open(),(m=t.contentDocument)==null||m.write(x),(h=t.contentDocument)==null||h.close()})}let c=!1;t.onload=()=>{var a;c||((a=t.contentWindow)==null||a.postMessage("init","*",[d.port2]),c=!0,e(new b(t)))}}):(console.error("no div selected"),null);n.createChart=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/chart",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-alpha9",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"chart.js": "^4.2.1",
|
|
6
6
|
"chartjs-adapter-luxon": "^1.3.1",
|
|
@@ -28,6 +28,13 @@
|
|
|
28
28
|
"npm": ">=8.0.0",
|
|
29
29
|
"node": ">=18.0.0"
|
|
30
30
|
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"scripts",
|
|
34
|
+
"src",
|
|
35
|
+
"typings"
|
|
36
|
+
],
|
|
37
|
+
"main": "./dist/interface.mjs",
|
|
31
38
|
"scripts": {
|
|
32
39
|
"start": "vite",
|
|
33
40
|
"build": "tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",
|
package/src/interface.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import pkg from "../package.json";
|
|
2
|
+
|
|
1
3
|
const channel = new MessageChannel();
|
|
2
4
|
const port1 = channel.port1;
|
|
3
5
|
|
|
@@ -62,16 +64,17 @@ const createChart = (div: HTMLElement | null) => {
|
|
|
62
64
|
iframe.setAttribute("id", "EOxChart");
|
|
63
65
|
div?.appendChild(iframe);
|
|
64
66
|
if (!import.meta?.url?.includes("localhost")) {
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
const hostUrl = `https://www.unpkg.com/@eox/chart@${pkg.version}/dist`;
|
|
68
|
+
fetch(`${hostUrl}/index.html`)
|
|
69
|
+
.then((response) => {
|
|
70
|
+
return response.text();
|
|
71
|
+
})
|
|
72
|
+
.then((text) => {
|
|
73
|
+
const html = text.replace("./assets/", `${hostUrl}/assets/`);
|
|
74
|
+
iframe.contentDocument?.open();
|
|
75
|
+
iframe.contentDocument?.write(html);
|
|
76
|
+
iframe.contentDocument?.close();
|
|
77
|
+
});
|
|
75
78
|
}
|
|
76
79
|
let iframeLoaded = false;
|
|
77
80
|
iframe.onload = () => {
|
package/src/main.ts
CHANGED
|
@@ -65,7 +65,7 @@ const onMessage = (event: MessageEvent) => {
|
|
|
65
65
|
setSignalsEndpoint(event.data.body.options);
|
|
66
66
|
break;
|
|
67
67
|
case "setSignalsGeometry":
|
|
68
|
-
setSignalsGeometry(event.data.body.
|
|
68
|
+
setSignalsGeometry(event.data.body.geometry);
|
|
69
69
|
break;
|
|
70
70
|
case "setSignalsData":
|
|
71
71
|
eoxchart.data = {
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/.prettierignore
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createChart } from "../../src/interface";
|
|
2
|
-
|
|
3
|
-
describe("general", () => {
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
cy.visit("../../public/test.html");
|
|
6
|
-
});
|
|
7
|
-
it("loads the chart", () => {
|
|
8
|
-
cy.document().then((doc) => {
|
|
9
|
-
const init = async () => {
|
|
10
|
-
const chart = await createChart(doc.querySelector("#chart"));
|
|
11
|
-
const data = {
|
|
12
|
-
datasets: [
|
|
13
|
-
{
|
|
14
|
-
type: "bar",
|
|
15
|
-
label: "Bar Dataset",
|
|
16
|
-
data: [1, 2, 3, 4],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: "line",
|
|
20
|
-
label: "Line Dataset",
|
|
21
|
-
data: [6, 6, 6, 6],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
labels: ["January", "February", "March", "April"],
|
|
25
|
-
};
|
|
26
|
-
chart?.setData(data);
|
|
27
|
-
const test = await chart?.getFoo();
|
|
28
|
-
console.log(test);
|
|
29
|
-
};
|
|
30
|
-
init();
|
|
31
|
-
});
|
|
32
|
-
cy.get('[data-cy="chart"] > iframe').should("exist");
|
|
33
|
-
});
|
|
34
|
-
});
|
package/cypress/e2e/sh.json
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"evi": [
|
|
3
|
-
{
|
|
4
|
-
"basicStats": {
|
|
5
|
-
"max": 0.3550589084625244,
|
|
6
|
-
"mean": 0.22059480493460512,
|
|
7
|
-
"min": 0.12014900892972946,
|
|
8
|
-
"stDev": 0.05062963384869639
|
|
9
|
-
},
|
|
10
|
-
"date": "2022-03-15"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"basicStats": {
|
|
14
|
-
"max": 0.4187798798084259,
|
|
15
|
-
"mean": 0.24745809068146724,
|
|
16
|
-
"min": 0.12343892455101013,
|
|
17
|
-
"stDev": 0.062029942348332034
|
|
18
|
-
},
|
|
19
|
-
"date": "2022-03-25"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"basicStats": {
|
|
23
|
-
"max": 0.48604267835617065,
|
|
24
|
-
"mean": 0.3150590416963138,
|
|
25
|
-
"min": 0.15982015430927277,
|
|
26
|
-
"stDev": 0.07354433835077807
|
|
27
|
-
},
|
|
28
|
-
"date": "2022-04-04"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"basicStats": {
|
|
32
|
-
"max": 0.598889172077179,
|
|
33
|
-
"mean": 0.38407523801360854,
|
|
34
|
-
"min": 0.19289220869541168,
|
|
35
|
-
"stDev": 0.08956019341871195
|
|
36
|
-
},
|
|
37
|
-
"date": "2022-04-14"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"basicStats": {
|
|
41
|
-
"max": 0.6682642102241516,
|
|
42
|
-
"mean": 0.39702817576240396,
|
|
43
|
-
"min": 0.19576843082904816,
|
|
44
|
-
"stDev": 0.09375953665992383
|
|
45
|
-
},
|
|
46
|
-
"date": "2022-04-24"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"basicStats": {
|
|
50
|
-
"max": 0.6155948638916016,
|
|
51
|
-
"mean": 0.4098868370971465,
|
|
52
|
-
"min": 0.22542662918567657,
|
|
53
|
-
"stDev": 0.06999486010331954
|
|
54
|
-
},
|
|
55
|
-
"date": "2022-05-04"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"basicStats": {
|
|
59
|
-
"max": 0.5713241100311279,
|
|
60
|
-
"mean": 0.39737077568219487,
|
|
61
|
-
"min": 0.2379172444343567,
|
|
62
|
-
"stDev": 0.05901234972947041
|
|
63
|
-
},
|
|
64
|
-
"date": "2022-05-14"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"basicStats": {
|
|
68
|
-
"max": 0.5792034864425659,
|
|
69
|
-
"mean": 0.35908391015600294,
|
|
70
|
-
"min": 0.2872035503387451,
|
|
71
|
-
"stDev": 0.03605644542093036
|
|
72
|
-
},
|
|
73
|
-
"date": "2022-05-24"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"basicStats": {
|
|
77
|
-
"max": 0.5466872453689575,
|
|
78
|
-
"mean": 0.32375791539711063,
|
|
79
|
-
"min": 0.25171026587486267,
|
|
80
|
-
"stDev": 0.036041907916295454
|
|
81
|
-
},
|
|
82
|
-
"date": "2022-06-03"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
"nddi": [
|
|
86
|
-
{
|
|
87
|
-
"basicStats": {
|
|
88
|
-
"max": 18.90780258178711,
|
|
89
|
-
"mean": 1.3850002521340155,
|
|
90
|
-
"min": 0.40726199746131897,
|
|
91
|
-
"stDev": 2.6123725693138953
|
|
92
|
-
},
|
|
93
|
-
"date": "2022-03-15"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"basicStats": {
|
|
97
|
-
"max": 10.200146675109863,
|
|
98
|
-
"mean": 0.9182252266121623,
|
|
99
|
-
"min": 0.2709024250507355,
|
|
100
|
-
"stDev": 1.3994401896631248
|
|
101
|
-
},
|
|
102
|
-
"date": "2022-03-25"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"basicStats": {
|
|
106
|
-
"max": 4.332663059234619,
|
|
107
|
-
"mean": 0.5509570467408071,
|
|
108
|
-
"min": 0.13095761835575104,
|
|
109
|
-
"stDev": 0.6298421233922363
|
|
110
|
-
},
|
|
111
|
-
"date": "2022-04-04"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"basicStats": {
|
|
115
|
-
"max": 1.9867826700210571,
|
|
116
|
-
"mean": 0.33416227769519363,
|
|
117
|
-
"min": 0.10483401268720627,
|
|
118
|
-
"stDev": 0.25612107549976254
|
|
119
|
-
},
|
|
120
|
-
"date": "2022-04-14"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"basicStats": {
|
|
124
|
-
"max": 2.3523149490356445,
|
|
125
|
-
"mean": 0.3511467087700553,
|
|
126
|
-
"min": 0.11805409938097,
|
|
127
|
-
"stDev": 0.305879751198955
|
|
128
|
-
},
|
|
129
|
-
"date": "2022-04-24"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"basicStats": {
|
|
133
|
-
"max": 1.3965336084365845,
|
|
134
|
-
"mean": 0.33400160022681136,
|
|
135
|
-
"min": 0.09463103860616684,
|
|
136
|
-
"stDev": 0.21766109465658331
|
|
137
|
-
},
|
|
138
|
-
"date": "2022-05-04"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"basicStats": {
|
|
142
|
-
"max": 1.2820371389389038,
|
|
143
|
-
"mean": 0.3267598677598587,
|
|
144
|
-
"min": 0.10988888889551163,
|
|
145
|
-
"stDev": 0.20093533591817903
|
|
146
|
-
},
|
|
147
|
-
"date": "2022-05-14"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"basicStats": {
|
|
151
|
-
"max": 0.7473884224891663,
|
|
152
|
-
"mean": 0.2954656333254665,
|
|
153
|
-
"min": 0.05666257068514824,
|
|
154
|
-
"stDev": 0.11693275787472403
|
|
155
|
-
},
|
|
156
|
-
"date": "2022-05-24"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"basicStats": {
|
|
160
|
-
"max": 0.5366320013999939,
|
|
161
|
-
"mean": 0.2969953213320961,
|
|
162
|
-
"min": 0.023719042539596558,
|
|
163
|
-
"stDev": 0.10104303610714575
|
|
164
|
-
},
|
|
165
|
-
"date": "2022-06-03"
|
|
166
|
-
}
|
|
167
|
-
],
|
|
168
|
-
"ndvi": [
|
|
169
|
-
{
|
|
170
|
-
"basicStats": {
|
|
171
|
-
"max": 0.6014397740364075,
|
|
172
|
-
"mean": 0.41612433722993136,
|
|
173
|
-
"min": 0.2957623302936554,
|
|
174
|
-
"stDev": 0.0727004516062551
|
|
175
|
-
},
|
|
176
|
-
"date": "2022-03-15"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"basicStats": {
|
|
180
|
-
"max": 0.6564452052116394,
|
|
181
|
-
"mean": 0.45588806082428046,
|
|
182
|
-
"min": 0.2966938614845276,
|
|
183
|
-
"stDev": 0.08344269797103256
|
|
184
|
-
},
|
|
185
|
-
"date": "2022-03-25"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"basicStats": {
|
|
189
|
-
"max": 0.7504225373268127,
|
|
190
|
-
"mean": 0.5504008913693121,
|
|
191
|
-
"min": 0.36974036693573,
|
|
192
|
-
"stDev": 0.08940500540419291
|
|
193
|
-
},
|
|
194
|
-
"date": "2022-04-04"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"basicStats": {
|
|
198
|
-
"max": 0.8306431770324707,
|
|
199
|
-
"mean": 0.6314340978642626,
|
|
200
|
-
"min": 0.4089595377445221,
|
|
201
|
-
"stDev": 0.09460136548487377
|
|
202
|
-
},
|
|
203
|
-
"date": "2022-04-14"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"basicStats": {
|
|
207
|
-
"max": 0.8457924127578735,
|
|
208
|
-
"mean": 0.632236462448655,
|
|
209
|
-
"min": 0.40922072529792786,
|
|
210
|
-
"stDev": 0.09419082557226978
|
|
211
|
-
},
|
|
212
|
-
"date": "2022-04-24"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"basicStats": {
|
|
216
|
-
"max": 0.7968989014625549,
|
|
217
|
-
"mean": 0.6313434431669995,
|
|
218
|
-
"min": 0.42545709013938904,
|
|
219
|
-
"stDev": 0.07541881706154915
|
|
220
|
-
},
|
|
221
|
-
"date": "2022-05-04"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"basicStats": {
|
|
225
|
-
"max": 0.7625213861465454,
|
|
226
|
-
"mean": 0.6106250831621499,
|
|
227
|
-
"min": 0.43760743737220764,
|
|
228
|
-
"stDev": 0.06402189222438505
|
|
229
|
-
},
|
|
230
|
-
"date": "2022-05-14"
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
"basicStats": {
|
|
234
|
-
"max": 0.785315990447998,
|
|
235
|
-
"mean": 0.563478274933021,
|
|
236
|
-
"min": 0.4446161687374115,
|
|
237
|
-
"stDev": 0.04710273399829552
|
|
238
|
-
},
|
|
239
|
-
"date": "2022-05-24"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"basicStats": {
|
|
243
|
-
"max": 0.7467761039733887,
|
|
244
|
-
"mean": 0.5033061891265151,
|
|
245
|
-
"min": 0.3754289746284485,
|
|
246
|
-
"stDev": 0.054429291442119304
|
|
247
|
-
},
|
|
248
|
-
"date": "2022-06-03"
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
"ndwi": [
|
|
252
|
-
{
|
|
253
|
-
"basicStats": {
|
|
254
|
-
"max": 0.24447646737098694,
|
|
255
|
-
"mean": 0.05385102006389305,
|
|
256
|
-
"min": -0.2715572714805603,
|
|
257
|
-
"stDev": 0.1168021100517783
|
|
258
|
-
},
|
|
259
|
-
"date": "2022-03-15"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"basicStats": {
|
|
263
|
-
"max": 0.3765927255153656,
|
|
264
|
-
"mean": 0.11764056809086258,
|
|
265
|
-
"min": -0.25011956691741943,
|
|
266
|
-
"stDev": 0.13192276855001103
|
|
267
|
-
},
|
|
268
|
-
"date": "2022-03-25"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"basicStats": {
|
|
272
|
-
"max": 0.5369506478309631,
|
|
273
|
-
"mean": 0.23535562727847764,
|
|
274
|
-
"min": -0.23376944661140442,
|
|
275
|
-
"stDev": 0.16413171444187102
|
|
276
|
-
},
|
|
277
|
-
"date": "2022-04-04"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"basicStats": {
|
|
281
|
-
"max": 0.6277323961257935,
|
|
282
|
-
"mean": 0.3532735487179871,
|
|
283
|
-
"min": -0.16249069571495056,
|
|
284
|
-
"stDev": 0.16010121907504435
|
|
285
|
-
},
|
|
286
|
-
"date": "2022-04-14"
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"basicStats": {
|
|
290
|
-
"max": 0.645155131816864,
|
|
291
|
-
"mean": 0.351150626651568,
|
|
292
|
-
"min": -0.17455558478832245,
|
|
293
|
-
"stDev": 0.16545804551039875
|
|
294
|
-
},
|
|
295
|
-
"date": "2022-04-24"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"basicStats": {
|
|
299
|
-
"max": 0.6346530914306641,
|
|
300
|
-
"mean": 0.34658381395074894,
|
|
301
|
-
"min": -0.07039669901132584,
|
|
302
|
-
"stDev": 0.14425695710507297
|
|
303
|
-
},
|
|
304
|
-
"date": "2022-05-04"
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
"basicStats": {
|
|
308
|
-
"max": 0.607755720615387,
|
|
309
|
-
"mean": 0.33509889218710587,
|
|
310
|
-
"min": -0.05635707825422287,
|
|
311
|
-
"stDev": 0.12977527934165456
|
|
312
|
-
},
|
|
313
|
-
"date": "2022-05-14"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"basicStats": {
|
|
317
|
-
"max": 0.6228088736534119,
|
|
318
|
-
"mean": 0.3137814263790035,
|
|
319
|
-
"min": 0.07944389432668686,
|
|
320
|
-
"stDev": 0.08356455075568822
|
|
321
|
-
},
|
|
322
|
-
"date": "2022-05-24"
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
"basicStats": {
|
|
326
|
-
"max": 0.6241552233695984,
|
|
327
|
-
"mean": 0.2761122933283006,
|
|
328
|
-
"min": 0.16474543511867523,
|
|
329
|
-
"stDev": 0.06336799660603812
|
|
330
|
-
},
|
|
331
|
-
"date": "2022-06-03"
|
|
332
|
-
}
|
|
333
|
-
],
|
|
334
|
-
"savi": [
|
|
335
|
-
{
|
|
336
|
-
"basicStats": {
|
|
337
|
-
"max": 0.3519461750984192,
|
|
338
|
-
"mean": 0.22617715640549646,
|
|
339
|
-
"min": 0.12689147889614105,
|
|
340
|
-
"stDev": 0.04863405880644912
|
|
341
|
-
},
|
|
342
|
-
"date": "2022-03-15"
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
"basicStats": {
|
|
346
|
-
"max": 0.40694671869277954,
|
|
347
|
-
"mean": 0.25231215516135524,
|
|
348
|
-
"min": 0.1301409751176834,
|
|
349
|
-
"stDev": 0.05846165534856253
|
|
350
|
-
},
|
|
351
|
-
"date": "2022-03-25"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
"basicStats": {
|
|
355
|
-
"max": 0.4673684239387512,
|
|
356
|
-
"mean": 0.3158992708741373,
|
|
357
|
-
"min": 0.17074868083000183,
|
|
358
|
-
"stDev": 0.06709622103071823
|
|
359
|
-
},
|
|
360
|
-
"date": "2022-04-04"
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"basicStats": {
|
|
364
|
-
"max": 0.5567160844802856,
|
|
365
|
-
"mean": 0.38005226624888183,
|
|
366
|
-
"min": 0.20187601447105408,
|
|
367
|
-
"stDev": 0.07953739023924075
|
|
368
|
-
},
|
|
369
|
-
"date": "2022-04-14"
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
"basicStats": {
|
|
373
|
-
"max": 0.6135095953941345,
|
|
374
|
-
"mean": 0.39059067392503727,
|
|
375
|
-
"min": 0.20191919803619385,
|
|
376
|
-
"stDev": 0.0823907296413076
|
|
377
|
-
},
|
|
378
|
-
"date": "2022-04-24"
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
"basicStats": {
|
|
382
|
-
"max": 0.5714061856269836,
|
|
383
|
-
"mean": 0.4011334329381139,
|
|
384
|
-
"min": 0.23138704895973206,
|
|
385
|
-
"stDev": 0.06171800387554556
|
|
386
|
-
},
|
|
387
|
-
"date": "2022-05-04"
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"basicStats": {
|
|
391
|
-
"max": 0.5369637608528137,
|
|
392
|
-
"mean": 0.38993105218270996,
|
|
393
|
-
"min": 0.24143381416797638,
|
|
394
|
-
"stDev": 0.05271926633766714
|
|
395
|
-
},
|
|
396
|
-
"date": "2022-05-14"
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
"basicStats": {
|
|
400
|
-
"max": 0.5449269413948059,
|
|
401
|
-
"mean": 0.3545232835597487,
|
|
402
|
-
"min": 0.2914884090423584,
|
|
403
|
-
"stDev": 0.03233048622917166
|
|
404
|
-
},
|
|
405
|
-
"date": "2022-05-24"
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
"basicStats": {
|
|
409
|
-
"max": 0.5156502723693848,
|
|
410
|
-
"mean": 0.3215323156575666,
|
|
411
|
-
"min": 0.2626720666885376,
|
|
412
|
-
"stDev": 0.031769682098438216
|
|
413
|
-
},
|
|
414
|
-
"date": "2022-06-03"
|
|
415
|
-
}
|
|
416
|
-
]
|
|
417
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createChart } from "../../src/interface";
|
|
2
|
-
import signalsData from "./sh.json";
|
|
3
|
-
|
|
4
|
-
describe("shDisplay", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
cy.visit("../../public/test.html");
|
|
7
|
-
});
|
|
8
|
-
it("loads data retrieved from signals-api endpoint", () => {
|
|
9
|
-
cy.document().then((doc) => {
|
|
10
|
-
const init = async () => {
|
|
11
|
-
const chart = await createChart(doc.querySelector("#chart"));
|
|
12
|
-
|
|
13
|
-
const options = {
|
|
14
|
-
parsing: {
|
|
15
|
-
xAxisKey: "date",
|
|
16
|
-
yAxisKey: "basicStats.mean",
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
chart?.setOptions(options);
|
|
20
|
-
chart?.setSignalsData(signalsData);
|
|
21
|
-
};
|
|
22
|
-
init();
|
|
23
|
-
});
|
|
24
|
-
cy.get('[data-cy="chart"] > iframe').should("exist");
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { createChart } from "../../src/interface";
|
|
2
|
-
|
|
3
|
-
describe("shDisplay", () => {
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
cy.visit("../../public/test.html");
|
|
6
|
-
});
|
|
7
|
-
it("configures signals endpoint for chart to retrieve data", () => {
|
|
8
|
-
cy.document().then((doc) => {
|
|
9
|
-
const init = async () => {
|
|
10
|
-
const chart = await createChart(doc.querySelector("#chart"));
|
|
11
|
-
|
|
12
|
-
const options = {
|
|
13
|
-
endpoint:
|
|
14
|
-
"https://prototype-gftb1dhets8kbrfhr3zdka.ddc.hub.eox.at/eo-signals-api/eo-signals-for-geometry",
|
|
15
|
-
source: "sentinelhub",
|
|
16
|
-
features: [
|
|
17
|
-
[
|
|
18
|
-
"s1_rvi",
|
|
19
|
-
"s2_ndvi",
|
|
20
|
-
"s2_ndwi",
|
|
21
|
-
"s2_mndwi",
|
|
22
|
-
"s2_nddi",
|
|
23
|
-
"s2_ndmi",
|
|
24
|
-
"s2_nbsi",
|
|
25
|
-
"s2_evi",
|
|
26
|
-
"s2_savi",
|
|
27
|
-
"spei",
|
|
28
|
-
"pni",
|
|
29
|
-
"spi",
|
|
30
|
-
],
|
|
31
|
-
["s2_vci"],
|
|
32
|
-
[
|
|
33
|
-
"modis_ndvi",
|
|
34
|
-
"modis_ndwi",
|
|
35
|
-
"modis_savi",
|
|
36
|
-
"modis_evi",
|
|
37
|
-
"modis_nddi",
|
|
38
|
-
],
|
|
39
|
-
["s3_ndvi", "s3_otci", "s2_lai", "s2_fapar"],
|
|
40
|
-
],
|
|
41
|
-
colors: [
|
|
42
|
-
"#ff0029",
|
|
43
|
-
"#377eb8",
|
|
44
|
-
"#66a61e",
|
|
45
|
-
"#984ea3",
|
|
46
|
-
"#00d2d5",
|
|
47
|
-
"#ff7f00",
|
|
48
|
-
"#af8d00",
|
|
49
|
-
"#7f80cd",
|
|
50
|
-
"#b3e900",
|
|
51
|
-
"#c42e60",
|
|
52
|
-
"#a65628",
|
|
53
|
-
"#f781bf",
|
|
54
|
-
"#8dd3c7",
|
|
55
|
-
"#bebada",
|
|
56
|
-
"#fb8072",
|
|
57
|
-
"#80b1d3",
|
|
58
|
-
"#fdb462",
|
|
59
|
-
"#fccde5",
|
|
60
|
-
"#bc80bd",
|
|
61
|
-
"#ffed6f",
|
|
62
|
-
"#c4eaff",
|
|
63
|
-
"#cf8c00",
|
|
64
|
-
],
|
|
65
|
-
// retries: 5,
|
|
66
|
-
// normalize: true,
|
|
67
|
-
active: ["modis_ndvi"],
|
|
68
|
-
// timeAggregation: { week: 1 },
|
|
69
|
-
timeInterval: {
|
|
70
|
-
months: 3,
|
|
71
|
-
},
|
|
72
|
-
startTime: "2023-01-01",
|
|
73
|
-
endTime: "2023-03-30",
|
|
74
|
-
geometry: {
|
|
75
|
-
type: "Polygon",
|
|
76
|
-
coordinates: [
|
|
77
|
-
[
|
|
78
|
-
[20.13079927, 47.10302768],
|
|
79
|
-
[20.13084045, 47.1028265],
|
|
80
|
-
[20.1358676, 47.10146968],
|
|
81
|
-
[20.13740927, 47.10014585],
|
|
82
|
-
[20.13947607, 47.09893601],
|
|
83
|
-
[20.14091366, 47.09999145],
|
|
84
|
-
[20.1449318, 47.10150223],
|
|
85
|
-
[20.14791146, 47.10230676],
|
|
86
|
-
[20.15021132, 47.10395088],
|
|
87
|
-
[20.15405271, 47.10427089],
|
|
88
|
-
[20.15892741, 47.10398568],
|
|
89
|
-
[20.15852441, 47.10137122],
|
|
90
|
-
[20.15762095, 47.09983277],
|
|
91
|
-
[20.15739972, 47.0975736],
|
|
92
|
-
[20.15803736, 47.09471102],
|
|
93
|
-
[20.16078555, 47.09278008],
|
|
94
|
-
[20.16202649, 47.09216975],
|
|
95
|
-
[20.15674646, 47.08971359],
|
|
96
|
-
[20.14955762, 47.08650222],
|
|
97
|
-
[20.13871746, 47.08287273],
|
|
98
|
-
[20.13206638, 47.08157835],
|
|
99
|
-
[20.12726444, 47.08162372],
|
|
100
|
-
[20.12231283, 47.0824622],
|
|
101
|
-
[20.11401767, 47.08174784],
|
|
102
|
-
[20.11216468, 47.08018127],
|
|
103
|
-
[20.10948393, 47.07862235],
|
|
104
|
-
[20.10265513, 47.07664915],
|
|
105
|
-
[20.09653792, 47.07715786],
|
|
106
|
-
[20.08739187, 47.07520495],
|
|
107
|
-
[20.08127912, 47.07681145],
|
|
108
|
-
[20.07655974, 47.08095206],
|
|
109
|
-
[20.06658042, 47.07842296],
|
|
110
|
-
[20.05716056, 47.0777923],
|
|
111
|
-
[20.05220315, 47.08017979],
|
|
112
|
-
[20.04630443, 47.08419526],
|
|
113
|
-
[20.04133418, 47.08864202],
|
|
114
|
-
[20.03220524, 47.08935493],
|
|
115
|
-
[20.03172385, 47.09164789],
|
|
116
|
-
[20.03114258, 47.09606486],
|
|
117
|
-
[20.03149467, 47.09719311],
|
|
118
|
-
[20.03319485, 47.09955417],
|
|
119
|
-
[20.03803622, 47.10154872],
|
|
120
|
-
[20.04451973, 47.10273689],
|
|
121
|
-
[20.04782854, 47.10248179],
|
|
122
|
-
[20.05408279, 47.1002776],
|
|
123
|
-
[20.05902427, 47.09876342],
|
|
124
|
-
[20.06282968, 47.0985035],
|
|
125
|
-
[20.06912826, 47.09867377],
|
|
126
|
-
[20.07212495, 47.0994389],
|
|
127
|
-
[20.08114396, 47.10320425],
|
|
128
|
-
[20.08584159, 47.10621624],
|
|
129
|
-
[20.08800841, 47.10687536],
|
|
130
|
-
[20.09697203, 47.10769864],
|
|
131
|
-
[20.10840521, 47.10770649],
|
|
132
|
-
[20.12110234, 47.10464688],
|
|
133
|
-
[20.12769884, 47.1031142],
|
|
134
|
-
[20.13079927, 47.10302768],
|
|
135
|
-
],
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
chart?.setSignalsEndpoint(options);
|
|
140
|
-
};
|
|
141
|
-
init();
|
|
142
|
-
});
|
|
143
|
-
cy.get('[data-cy="chart"] > iframe').should("exist");
|
|
144
|
-
});
|
|
145
|
-
});
|
package/cypress.config.ts
DELETED
package/index.html
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title>EOxElements Chart</title>
|
|
6
|
-
<style>
|
|
7
|
-
*{
|
|
8
|
-
font-family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
|
|
9
|
-
font-size: 0.95em;
|
|
10
|
-
}
|
|
11
|
-
label{
|
|
12
|
-
margin-top: 2.5px;
|
|
13
|
-
}
|
|
14
|
-
html,
|
|
15
|
-
body {
|
|
16
|
-
margin: 0;
|
|
17
|
-
padding: 0;
|
|
18
|
-
}
|
|
19
|
-
html,
|
|
20
|
-
body,
|
|
21
|
-
.chart {
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
}
|
|
25
|
-
.hidden {
|
|
26
|
-
visibility: hidden;
|
|
27
|
-
}
|
|
28
|
-
.loader {
|
|
29
|
-
position: absolute;
|
|
30
|
-
top: 5px;
|
|
31
|
-
right: 30px;
|
|
32
|
-
width: 24px;
|
|
33
|
-
height: 24px;
|
|
34
|
-
border-radius: 50%;
|
|
35
|
-
display: inline-block;
|
|
36
|
-
border-top: 4px solid #000;
|
|
37
|
-
border-right: 4px solid transparent;
|
|
38
|
-
box-sizing: border-box;
|
|
39
|
-
animation: rotation 1s linear infinite;
|
|
40
|
-
}
|
|
41
|
-
.loader::after {
|
|
42
|
-
content: '';
|
|
43
|
-
box-sizing: border-box;
|
|
44
|
-
position: absolute;
|
|
45
|
-
left: 0;
|
|
46
|
-
top: 0;
|
|
47
|
-
width: 24px;
|
|
48
|
-
height: 24px;
|
|
49
|
-
border-radius: 50%;
|
|
50
|
-
border-left: 4px solid #004170;
|
|
51
|
-
border-bottom: 4px solid transparent;
|
|
52
|
-
animation: rotation 0.5s linear infinite reverse;
|
|
53
|
-
}
|
|
54
|
-
@keyframes rotation {
|
|
55
|
-
0% {
|
|
56
|
-
transform: rotate(0deg);
|
|
57
|
-
}
|
|
58
|
-
100% {
|
|
59
|
-
transform: rotate(360deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
#controls {
|
|
63
|
-
position: absolute;
|
|
64
|
-
width: 100%;
|
|
65
|
-
display: flex;
|
|
66
|
-
gap: 5px;
|
|
67
|
-
flex-direction: row;
|
|
68
|
-
}
|
|
69
|
-
.parsingError {
|
|
70
|
-
background-color : #ff6d6d;
|
|
71
|
-
}
|
|
72
|
-
#chart {
|
|
73
|
-
padding-top: 30px;
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
76
|
-
</head>
|
|
77
|
-
<body>
|
|
78
|
-
<div id="controls" class="controls" data-cy="controls"></div>
|
|
79
|
-
<canvas id="chart" class="chart" data-cy="chart"></canvas>
|
|
80
|
-
<script type="module" src="./src/main.ts"></script>
|
|
81
|
-
</body>
|
|
82
|
-
</html>
|
package/public/interface.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var y = Object.defineProperty;
|
|
2
|
-
var b = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
-
var d = (s, t, e) => (b(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
const g = new MessageChannel(), o = g.port1;
|
|
5
|
-
class f {
|
|
6
|
-
constructor(t) {
|
|
7
|
-
d(this, "iframe");
|
|
8
|
-
this.iframe = t;
|
|
9
|
-
}
|
|
10
|
-
setData(t) {
|
|
11
|
-
o.postMessage({ type: "setData", body: { data: t } });
|
|
12
|
-
}
|
|
13
|
-
setSignalsData(t) {
|
|
14
|
-
o.postMessage({ type: "setSignalsData", body: { data: t } });
|
|
15
|
-
}
|
|
16
|
-
setSignalsEndpoint(t) {
|
|
17
|
-
o.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
|
|
18
|
-
}
|
|
19
|
-
setSignalsGeometry(t) {
|
|
20
|
-
o.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
|
|
21
|
-
}
|
|
22
|
-
setOptions(t) {
|
|
23
|
-
o.postMessage({ type: "setOptions", body: { options: t } });
|
|
24
|
-
}
|
|
25
|
-
getFoo() {
|
|
26
|
-
return new Promise((t) => {
|
|
27
|
-
const e = Date.now();
|
|
28
|
-
o.onmessage = (a) => {
|
|
29
|
-
a.data.ts === e && t(a.data.body);
|
|
30
|
-
}, o.postMessage({ ts: e, type: "getFoo", body: "hello world" });
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const D = (s) => s ? new Promise((t) => {
|
|
35
|
-
var r, l, c, i;
|
|
36
|
-
const e = document.createElement("iframe");
|
|
37
|
-
e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
|
|
38
|
-
"src",
|
|
39
|
-
(l = (r = import.meta) == null ? void 0 : r.url) != null && l.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
|
|
40
|
-
), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (i = (c = import.meta) == null ? void 0 : c.url) != null && i.includes("localhost") || fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then((n) => n.text()).then((n) => {
|
|
41
|
-
var m, p, h;
|
|
42
|
-
const u = n.replace("./assets/", "https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");
|
|
43
|
-
(m = e.contentDocument) == null || m.open(), (p = e.contentDocument) == null || p.write(u), (h = e.contentDocument) == null || h.close();
|
|
44
|
-
});
|
|
45
|
-
let a = !1;
|
|
46
|
-
e.onload = () => {
|
|
47
|
-
var n;
|
|
48
|
-
a || ((n = e.contentWindow) == null || n.postMessage("init", "*", [g.port2]), a = !0, t(new f(e)));
|
|
49
|
-
};
|
|
50
|
-
}) : (console.error("no div selected"), null);
|
|
51
|
-
export {
|
|
52
|
-
D as createChart
|
|
53
|
-
};
|
package/public/interface.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.Interface={}))})(this,function(s){"use strict";var g=Object.defineProperty;var b=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var f=(s,t,n)=>(b(s,typeof t!="symbol"?t+"":t,n),n);const t=new MessageChannel,n=t.port1;class m{constructor(e){f(this,"iframe");this.iframe=e}setData(e){n.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){n.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){n.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){n.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){n.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const o=Date.now();n.onmessage=i=>{i.data.ts===o&&e(i.data.body)},n.postMessage({ts:o,type:"getFoo",body:"hello world"})})}}const h=a=>a?new Promise(e=>{var c,d;const o=document.createElement("iframe");o.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",o.setAttribute("src",(c=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&c.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),o.setAttribute("id","EOxChart"),a==null||a.appendChild(o),(d=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&d.includes("localhost")||fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then(r=>r.text()).then(r=>{var l,u,p;const y=r.replace("./assets/","https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");(l=o.contentDocument)==null||l.open(),(u=o.contentDocument)==null||u.write(y),(p=o.contentDocument)==null||p.close()});let i=!1;o.onload=()=>{var r;i||((r=o.contentWindow)==null||r.postMessage("init","*",[t.port2]),i=!0,e(new m(o)))}}):(console.error("no div selected"),null);s.createChart=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/public/test.html
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title>Simple Chart</title>
|
|
6
|
-
<style>
|
|
7
|
-
html,
|
|
8
|
-
body {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
}
|
|
12
|
-
html,
|
|
13
|
-
body,
|
|
14
|
-
.chart {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div id="chart" class="chart" data-cy="chart"></div>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
package/test.html
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title>Simple Chart</title>
|
|
6
|
-
<style>
|
|
7
|
-
html,
|
|
8
|
-
body {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
}
|
|
12
|
-
html,
|
|
13
|
-
body,
|
|
14
|
-
.chart {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<canvas id="chart" class="chart" data-cy="chart"></canvas>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"strictNullChecks": false,
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"lib": ["ESNext", "DOM"],
|
|
8
|
-
"moduleResolution": "Node",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"noUnusedLocals": true,
|
|
14
|
-
"noUnusedParameters": true,
|
|
15
|
-
"noImplicitReturns": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"typeRoots": ["./typings"],
|
|
18
|
-
"types": ["cypress"]
|
|
19
|
-
},
|
|
20
|
-
"include": ["**/*.ts"]
|
|
21
|
-
}
|
package/vite.config.interface.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
|
|
4
|
-
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
build: {
|
|
7
|
-
emptyOutDir: false,
|
|
8
|
-
lib: {
|
|
9
|
-
entry: resolve(__dirname, "src/interface.ts"),
|
|
10
|
-
name: "Interface",
|
|
11
|
-
fileName: "interface",
|
|
12
|
-
},
|
|
13
|
-
rollupOptions: {
|
|
14
|
-
output: {
|
|
15
|
-
dir: "public",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
});
|
package/vite.config.map.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
|
|
4
|
-
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
base: "./",
|
|
7
|
-
build: {
|
|
8
|
-
// emptyOutDir: false,
|
|
9
|
-
rollupOptions: {
|
|
10
|
-
input: {
|
|
11
|
-
main: resolve(__dirname, "index.html"),
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|