@fluid-topics/ft-analytics-sessions-chart 1.0.35 → 1.0.36
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.
|
@@ -13,7 +13,7 @@ u.version="2.29.4",r=jn,u.fn=Gi,u.min=function(){return In("isBefore",[].slice.c
|
|
|
13
13
|
}
|
|
14
14
|
`;var ve=function(t,n,i,e){for(var r,s=arguments.length,u=s<3?n:null===e?e=Object.getOwnPropertyDescriptor(n,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(u=(s<3?r(u):s>3?r(n,i,u):r(n,i))||u);return s>3&&u&&Object.defineProperty(n,i,u),u};null==window.echarts&&console.warn("Echarts is not available");let Ye=class extends n.FtLitElement{constructor(){super(...arguments),this.xAxisName="date",this.yAxisName="",this.valueLabels=void 0,this.valueLabelsSingular=void 0,this.barChart=!1,this.period=ce.DAY,this.data=[]}render(){return i.html`
|
|
15
15
|
<div class="sessions-chart"></div>
|
|
16
|
-
`}firstUpdated(t){var n;super.firstUpdated(t),this.myChart=null===(n=window.echarts)||void 0===n?void 0:n.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const n=this.getOptions();n&&this.myChart&&this.myChart.setOption(n)}getOptions(){const t=this;return{tooltip:{trigger:"axis",formatter:n=>t.getTooltip(n)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:n=>t.period===ce.DAY||t.period===ce.WEEK?u.utc(1e3*n).format("DD MMM YYYY"):(t.period,ce.MONTH,u.utc(1e3*n).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(t){const n=u.utc(1e3*t[0].data.value[0]),i=t.map((t=>t.data.value[1]));let e,r,s="";switch(this.period){case ce.DAY:e=n.format("DD MMM YYYY"),r="on",this.isThisPeriod(n,ce.DAY)&&(s=" so far");break;case ce.WEEK:e=n.format("DD MMM YYYY"),r="during the week of",this.isThisPeriod(n,ce.WEEK)&&(s=" so far");break;case ce.MONTH:r="in",e=n.format("MMMM YYYY"),this.isThisPeriod(n,ce.MONTH)&&(s=" so far")}let o="";for(let t=0;t<i.length;t++){let n=this.valueLabels?this.valueLabels[t]:this.yAxisName,u=this.valueLabelsSingular?this.valueLabelsSingular[t]:n;const h=1===i[t]?u:n;o+=`${i[t].toLocaleString()} ${h} ${r} ${e}${s}</br>`}return o.substring(0,o.length-5)}isThisPeriod(t,n,i=u.utc()){switch(n){case ce.DAY:return t.format("YYYY-MM-DD")===i.clone().startOf("day").format("YYYY-MM-DD");case ce.WEEK:return t.clone().startOf("isoWeek").format("YYYY-MM-DD")===i.clone().startOf("isoWeek").format("YYYY-MM-DD");case ce.MONTH:return t.month()===i.month()&&t.year()===i.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let n=[];for(let i=0;i<t;i++)n[i]={type:this.barChart?"bar":"line",data:this.getData(i)};return n}getData(t){return this.data.map((n=>({value:[n[0],n[t+1]]}))
|
|
16
|
+
`}firstUpdated(t){var n;super.firstUpdated(t),this.myChart=null===(n=window.echarts)||void 0===n?void 0:n.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const n=this.getOptions();n&&this.myChart&&this.myChart.setOption(n)}getOptions(){const t=this;return{tooltip:{trigger:"axis",formatter:n=>t.getTooltip(n)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:n=>t.period===ce.DAY||t.period===ce.WEEK?u.utc(1e3*n).format("DD MMM YYYY"):(t.period,ce.MONTH,u.utc(1e3*n).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(t){const n=u.utc(1e3*t[0].data.value[0]),i=t.map((t=>t.data.value[1]));let e,r,s="";switch(this.period){case ce.DAY:e=n.format("DD MMM YYYY"),r="on",this.isThisPeriod(n,ce.DAY)&&(s=" so far");break;case ce.WEEK:e=n.format("DD MMM YYYY"),r="during the week of",this.isThisPeriod(n,ce.WEEK)&&(s=" so far");break;case ce.MONTH:r="in",e=n.format("MMMM YYYY"),this.isThisPeriod(n,ce.MONTH)&&(s=" so far")}let o="";for(let t=0;t<i.length;t++){let n=this.valueLabels?this.valueLabels[t]:this.yAxisName,u=this.valueLabelsSingular?this.valueLabelsSingular[t]:n;const h=1===i[t]?u:n;o+=`${i[t].toLocaleString()} ${h} ${r} ${e}${s}</br>`}return o.substring(0,o.length-5)}isThisPeriod(t,n,i=u.utc()){switch(n){case ce.DAY:return t.format("YYYY-MM-DD")===i.clone().startOf("day").format("YYYY-MM-DD");case ce.WEEK:return t.clone().startOf("isoWeek").format("YYYY-MM-DD")===i.clone().startOf("isoWeek").format("YYYY-MM-DD");case ce.MONTH:return t.month()===i.month()&&t.year()===i.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let n=[];for(let i=0;i<t;i++)n[i]={type:this.barChart?"bar":"line",data:this.getData(i)};return n}getData(t){return this.data.map((n=>this.isThisPeriod(u.unix(n[0]),this.period)?{value:[n[0],n[t+1]],itemStyle:{opacity:.5}}:{value:[n[0],n[t+1]]}))}};Ye.styles=me,ve([e.property({type:String})],Ye.prototype,"xAxisName",void 0),ve([e.property({type:String})],Ye.prototype,"yAxisName",void 0),ve([n.jsonProperty(void 0)],Ye.prototype,"valueLabels",void 0),ve([n.jsonProperty(void 0)],Ye.prototype,"valueLabelsSingular",void 0),ve([e.property({type:Boolean})],Ye.prototype,"barChart",void 0),ve([e.property({type:String})],Ye.prototype,"period",void 0),ve([n.jsonProperty([])],Ye.prototype,"data",void 0),ve([e.query(".sessions-chart")],Ye.prototype,"container",void 0),Ye=ve([n.customElement("ft-chart")],Ye),n.customElement("ft-chart")(Ye);const Me=i.css`
|
|
17
17
|
.session-chart {
|
|
18
18
|
width: 100%;
|
|
19
19
|
height: 100%;
|
|
@@ -93,7 +93,7 @@ Nt.version="2.29.4",xt=ee,Nt.fn=qe,Nt.min=function(){return oe("isBefore",[].sli
|
|
|
93
93
|
}
|
|
94
94
|
`;var Ar=function(t,i,n,e){for(var r,s=arguments.length,o=s<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,n):e,u=t.length-1;u>=0;u--)(r=t[u])&&(o=(s<3?r(o):s>3?r(i,n,o):r(i,n))||o);return s>3&&o&&Object.defineProperty(i,n,o),o};null==window.echarts&&console.warn("Echarts is not available");let Wr=class extends bt{constructor(){super(...arguments),this.xAxisName="date",this.yAxisName="",this.valueLabels=void 0,this.valueLabelsSingular=void 0,this.barChart=!1,this.period=Tr.DAY,this.data=[]}render(){return P`
|
|
95
95
|
<div class="sessions-chart"></div>
|
|
96
|
-
`}firstUpdated(t){var i;super.firstUpdated(t),this.myChart=null===(i=window.echarts)||void 0===i?void 0:i.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const i=this.getOptions();i&&this.myChart&&this.myChart.setOption(i)}getOptions(){const t=this;return{tooltip:{trigger:"axis",formatter:i=>t.getTooltip(i)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:i=>t.period===Tr.DAY||t.period===Tr.WEEK?Nt.utc(1e3*i).format("DD MMM YYYY"):(t.period,Tr.MONTH,Nt.utc(1e3*i).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(t){const i=Nt.utc(1e3*t[0].data.value[0]),n=t.map((t=>t.data.value[1]));let e,r,s="";switch(this.period){case Tr.DAY:e=i.format("DD MMM YYYY"),r="on",this.isThisPeriod(i,Tr.DAY)&&(s=" so far");break;case Tr.WEEK:e=i.format("DD MMM YYYY"),r="during the week of",this.isThisPeriod(i,Tr.WEEK)&&(s=" so far");break;case Tr.MONTH:r="in",e=i.format("MMMM YYYY"),this.isThisPeriod(i,Tr.MONTH)&&(s=" so far")}let o="";for(let t=0;t<n.length;t++){let i=this.valueLabels?this.valueLabels[t]:this.yAxisName,u=this.valueLabelsSingular?this.valueLabelsSingular[t]:i;const a=1===n[t]?u:i;o+=`${n[t].toLocaleString()} ${a} ${r} ${e}${s}</br>`}return o.substring(0,o.length-5)}isThisPeriod(t,i,n=Nt.utc()){switch(i){case Tr.DAY:return t.format("YYYY-MM-DD")===n.clone().startOf("day").format("YYYY-MM-DD");case Tr.WEEK:return t.clone().startOf("isoWeek").format("YYYY-MM-DD")===n.clone().startOf("isoWeek").format("YYYY-MM-DD");case Tr.MONTH:return t.month()===n.month()&&t.year()===n.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let i=[];for(let n=0;n<t;n++)i[n]={type:this.barChart?"bar":"line",data:this.getData(n)};return i}getData(t){return this.data.map((i=>({value:[i[0],i[t+1]]}))
|
|
96
|
+
`}firstUpdated(t){var i;super.firstUpdated(t),this.myChart=null===(i=window.echarts)||void 0===i?void 0:i.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const i=this.getOptions();i&&this.myChart&&this.myChart.setOption(i)}getOptions(){const t=this;return{tooltip:{trigger:"axis",formatter:i=>t.getTooltip(i)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:i=>t.period===Tr.DAY||t.period===Tr.WEEK?Nt.utc(1e3*i).format("DD MMM YYYY"):(t.period,Tr.MONTH,Nt.utc(1e3*i).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(t){const i=Nt.utc(1e3*t[0].data.value[0]),n=t.map((t=>t.data.value[1]));let e,r,s="";switch(this.period){case Tr.DAY:e=i.format("DD MMM YYYY"),r="on",this.isThisPeriod(i,Tr.DAY)&&(s=" so far");break;case Tr.WEEK:e=i.format("DD MMM YYYY"),r="during the week of",this.isThisPeriod(i,Tr.WEEK)&&(s=" so far");break;case Tr.MONTH:r="in",e=i.format("MMMM YYYY"),this.isThisPeriod(i,Tr.MONTH)&&(s=" so far")}let o="";for(let t=0;t<n.length;t++){let i=this.valueLabels?this.valueLabels[t]:this.yAxisName,u=this.valueLabelsSingular?this.valueLabelsSingular[t]:i;const a=1===n[t]?u:i;o+=`${n[t].toLocaleString()} ${a} ${r} ${e}${s}</br>`}return o.substring(0,o.length-5)}isThisPeriod(t,i,n=Nt.utc()){switch(i){case Tr.DAY:return t.format("YYYY-MM-DD")===n.clone().startOf("day").format("YYYY-MM-DD");case Tr.WEEK:return t.clone().startOf("isoWeek").format("YYYY-MM-DD")===n.clone().startOf("isoWeek").format("YYYY-MM-DD");case Tr.MONTH:return t.month()===n.month()&&t.year()===n.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let i=[];for(let n=0;n<t;n++)i[n]={type:this.barChart?"bar":"line",data:this.getData(n)};return i}getData(t){return this.data.map((i=>this.isThisPeriod(Nt.unix(i[0]),this.period)?{value:[i[0],i[t+1]],itemStyle:{opacity:.5}}:{value:[i[0],i[t+1]]}))}};Wr.styles=_r,Ar([e({type:String})],Wr.prototype,"xAxisName",void 0),Ar([e({type:String})],Wr.prototype,"yAxisName",void 0),Ar([u(void 0)],Wr.prototype,"valueLabels",void 0),Ar([u(void 0)],Wr.prototype,"valueLabelsSingular",void 0),Ar([e({type:Boolean})],Wr.prototype,"barChart",void 0),Ar([e({type:String})],Wr.prototype,"period",void 0),Ar([u([])],Wr.prototype,"data",void 0),Ar([
|
|
97
97
|
/**
|
|
98
98
|
* @license
|
|
99
99
|
* Copyright 2017 Google LLC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-analytics-sessions-chart",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"description": "Display sessions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.0.36",
|
|
23
23
|
"lit": "2.7.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"moment": "2.29.4"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "7ace912b9fec53f21ded2d3b32ba7d723118d334"
|
|
29
29
|
}
|