@fluid-topics/ft-chart 2.2.21 → 2.2.24

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.
@@ -26,7 +26,7 @@ export declare class FtChart extends FtLitElement implements FtChartProperties {
26
26
  data: number[][];
27
27
  private container;
28
28
  private myChart?;
29
- render(): import("lit-html").TemplateResult<1>;
29
+ render(): import("lit").TemplateResult<1>;
30
30
  protected firstUpdated(_changedProperties: PropertyValues): void;
31
31
  protected updated(props: PropertyValues): void;
32
32
  private getOptions;
@@ -12,7 +12,7 @@ Arguments: `+Array.prototype.slice.call(s).join("")+`
12
12
  `}firstUpdated(t){var r;super.firstUpdated(t),this.myChart=(r=window.echarts)===null||r===void 0?void 0:r.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",()=>{var s;(s=this.myChart)===null||s===void 0||s.resize()})}updated(t){super.updated(t);let r=this.getOptions();r&&this.myChart&&this.myChart.setOption(r)}getOptions(){let t=this;return{tooltip:{axisPointer:{type:"shadow",shadowStyle:{color:t.hoverColor}},trigger:"axis",formatter(r){return t.getTooltip(r)},backgroundColor:t.tooltipBackgroundColor,borderColor:t.tooltipBorderColor,textStyle:{color:t.tooltipTextColor},borderRadius:t.tooltipBorderRadius},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter(r){return t.period===T.DAY||t.period===T.WEEK?u.utc(r*1e3).format("DD MMM YYYY"):t.period===T.MONTH?u.utc(r*1e3).format("MMMM YYYY"):u.utc(r*1e3).format("MMMM YYYY")}}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},color:this.graphColor,series:this.getSeries()}}getTooltip(t){let r=u.utc(t[0].data.value[0]*1e3),s=t.map(h=>h.data.value[1]),a,i,n="";switch(this.period){case T.DAY:{a=r.format("DD MMM YYYY"),i="on",this.isThisPeriod(r,T.DAY)&&(n=" so far");break}case T.WEEK:{a=r.format("DD MMM YYYY"),i="during the week of",this.isThisPeriod(r,T.WEEK)&&(n=" so far");break}case T.MONTH:{i="in",a=r.format("MMMM YYYY"),this.isThisPeriod(r,T.MONTH)&&(n=" so far");break}}let l="";for(let h=0;h<s.length;h++){let c=this.valueLabels?this.valueLabels[h]:this.yAxisName,S=this.valueLabelsSingular?this.valueLabelsSingular[h]:c,I=s[h]===1?S:c;l+=`${s[h].toLocaleString()} ${I} ${i} ${a}${n}</br>`}return l.substring(0,l.length-5)}isThisPeriod(t,r,s=u.utc()){switch(r){case T.DAY:return t.format("YYYY-MM-DD")===s.clone().startOf("day").format("YYYY-MM-DD");case T.WEEK:return t.clone().startOf("isoWeek").format("YYYY-MM-DD")===s.clone().startOf("isoWeek").format("YYYY-MM-DD");case T.MONTH:return t.month()===s.month()&&t.year()===s.year()}return!1}getSeries(){if(this.data.length==0)return[];let t=this.data[0].length-1;if(t==0)return[];let r=[];for(let s=0;s<t;s++)r[s]={type:this.barChart?"bar":"line",data:this.getData(s)};return r}getData(t){return this.data.map(r=>this.isThisPeriod(u.unix(r[0]),this.period)?{value:[r[0],r[t+1]],itemStyle:{opacity:.5}}:{value:[r[0],r[t+1]]})}};x.styles=jr;W([(0,F.property)({type:String})],x.prototype,"xAxisName",void 0);W([(0,F.property)({type:String})],x.prototype,"yAxisName",void 0);W([(0,F.property)({type:String})],x.prototype,"graphColor",void 0);W([(0,F.property)({type:String})],x.prototype,"hoverColor",void 0);W([(0,F.property)({type:String})],x.prototype,"tooltipBackgroundColor",void 0);W([(0,F.property)({type:String})],x.prototype,"tooltipBorderColor",void 0);W([(0,F.property)({type:String})],x.prototype,"tooltipTextColor",void 0);W([(0,F.property)({type:String})],x.prototype,"tooltipBorderRadius",void 0);W([(0,we.jsonProperty)(void 0)],x.prototype,"valueLabels",void 0);W([(0,we.jsonProperty)(void 0)],x.prototype,"valueLabelsSingular",void 0);W([(0,F.property)({type:Boolean})],x.prototype,"barChart",void 0);W([(0,F.property)({type:String})],x.prototype,"period",void 0);W([(0,we.jsonProperty)([])],x.prototype,"data",void 0);W([(0,F.query)(".sessions-chart")],x.prototype,"container",void 0);var $r={"ft-chart":x};(0,Zr.customElements)($r);})();
13
13
  /*! Bundled license information:
14
14
 
15
- moment/dist/moment.js:
15
+ .store/moment-npm-2.31.0-f6e03a269c/package/dist/moment.js:
16
16
  (*! moment.js *)
17
17
  (*! version : 2.31.0 *)
18
18
  (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)