pacem 0.51.4 → 0.51.5-archimedes
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/dist/css/pacem-dark-content.min.css +1 -1
- package/dist/css/pacem-dark-shell.min.css +1 -1
- package/dist/css/pacem-dark.min.css +1 -1
- package/dist/css/pacem-light-content.min.css +1 -1
- package/dist/css/pacem-light-shell.min.css +1 -1
- package/dist/css/pacem-light.min.css +1 -1
- package/dist/css/pacem-phousys-content.min.css +1 -1
- package/dist/css/pacem-phousys-shell.min.css +1 -1
- package/dist/css/pacem-phousys.min.css +1 -1
- package/dist/js/azure-maps.d.ts +1 -1
- package/dist/js/pacem-2d.d.ts +1 -1
- package/dist/js/pacem-2d.js +1 -1
- package/dist/js/pacem-2d.min.js +1 -1
- package/dist/js/pacem-3d.d.ts +1 -1
- package/dist/js/pacem-3d.js +1 -1
- package/dist/js/pacem-3d.min.js +1 -1
- package/dist/js/pacem-charts.d.ts +1 -1
- package/dist/js/pacem-charts.js +15 -10
- package/dist/js/pacem-charts.min.js +2 -2
- package/dist/js/pacem-cms.d.ts +1 -1
- package/dist/js/pacem-cms.js +1 -1
- package/dist/js/pacem-cms.min.js +1 -1
- package/dist/js/pacem-core.d.ts +1 -1
- package/dist/js/pacem-core.js +1 -1
- package/dist/js/pacem-core.min.js +1 -1
- package/dist/js/pacem-foundation.d.ts +1 -1
- package/dist/js/pacem-foundation.js +1 -1
- package/dist/js/pacem-foundation.min.js +1 -1
- package/dist/js/pacem-fx.d.ts +1 -1
- package/dist/js/pacem-fx.js +1 -1
- package/dist/js/pacem-fx.min.js +1 -1
- package/dist/js/pacem-logging.d.ts +1 -1
- package/dist/js/pacem-logging.js +1 -1
- package/dist/js/pacem-logging.min.js +1 -1
- package/dist/js/pacem-maps.d.ts +1 -1
- package/dist/js/pacem-maps.js +1 -1
- package/dist/js/pacem-maps.min.js +1 -1
- package/dist/js/pacem-media.d.ts +1 -1
- package/dist/js/pacem-media.js +1 -1
- package/dist/js/pacem-media.min.js +1 -1
- package/dist/js/pacem-networking.d.ts +1 -1
- package/dist/js/pacem-networking.js +1 -1
- package/dist/js/pacem-networking.min.js +1 -1
- package/dist/js/pacem-numerical.d.ts +1 -1
- package/dist/js/pacem-numerical.js +1 -1
- package/dist/js/pacem-numerical.min.js +1 -1
- package/dist/js/pacem-plus.d.ts +1 -1
- package/dist/js/pacem-plus.js +1 -1
- package/dist/js/pacem-plus.min.js +1 -1
- package/dist/js/pacem-scaffolding.d.ts +1 -1
- package/dist/js/pacem-scaffolding.js +1 -1
- package/dist/js/pacem-scaffolding.min.js +1 -1
- package/dist/js/pacem-ui.d.ts +1 -1
- package/dist/js/pacem-ui.js +1 -1
- package/dist/js/pacem-ui.min.js +1 -1
- package/dist/js/swagger-types.d.ts +1 -1
- package/package.json +1 -1
package/dist/js/azure-maps.d.ts
CHANGED
package/dist/js/pacem-2d.d.ts
CHANGED
package/dist/js/pacem-2d.js
CHANGED
package/dist/js/pacem-2d.min.js
CHANGED
package/dist/js/pacem-3d.d.ts
CHANGED
package/dist/js/pacem-3d.js
CHANGED
package/dist/js/pacem-3d.min.js
CHANGED
package/dist/js/pacem-charts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.51.
|
|
2
|
+
* pacem v0.51.5-archimedes (https://js.pacem.it)
|
|
3
3
|
* Copyright 2025 Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -17,9 +17,9 @@ var Pacem;
|
|
|
17
17
|
(function (Charts) {
|
|
18
18
|
Charts.MANAGED_EVENTS = ['keydown', 'keyup', 'click', 'dblclick', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'mousedown', 'mouseup', 'mousemove', 'contextmenu'];
|
|
19
19
|
;
|
|
20
|
-
function logN(N, x) {
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
//function logN(N, x) {
|
|
21
|
+
// return Math.log10(x) / Math.log10(N);
|
|
22
|
+
//}
|
|
23
23
|
const MSECS_PER_DAY = 1000 * 60 * 60 * 24;
|
|
24
24
|
const MAX_X_LABELS = 10;
|
|
25
25
|
const MAX_Y_LABELS = 10;
|
|
@@ -66,7 +66,8 @@ var Pacem;
|
|
|
66
66
|
}
|
|
67
67
|
return retval;
|
|
68
68
|
}
|
|
69
|
-
function getRoundedBoundaries(min, max, desiredSteps
|
|
69
|
+
function getRoundedBoundaries(min, max, desiredSteps) {
|
|
70
|
+
desiredSteps ??= Math.min(bestGuessedDensity(min, max), MAX_Y_LABELS);
|
|
70
71
|
const roughStep = (max - min) / desiredSteps;
|
|
71
72
|
const magnitude = Math.pow(10, Math.floor(Math.log10(roughStep)));
|
|
72
73
|
const step = [1, 2, 5, 10].map(n => n * magnitude).filter(s => s >= roughStep).reduce((min, s) => Math.min(min, s), Number.POSITIVE_INFINITY);
|
|
@@ -599,8 +600,6 @@ var Pacem;
|
|
|
599
600
|
if (Pacem.Utils.isNull(this.yAxisMax))
|
|
600
601
|
maxY = Math.max.apply(null, accumulator.positive);
|
|
601
602
|
}
|
|
602
|
-
// estimate y-axis max width
|
|
603
|
-
const paddingYAxis = Math.max(padding, this.estimateYAxisLabelWidth(maxY) + PADDING_PIXELS * .5);
|
|
604
603
|
if (maxX === 0 && maxX === minX) {
|
|
605
604
|
maxX = 1;
|
|
606
605
|
}
|
|
@@ -615,8 +614,11 @@ var Pacem;
|
|
|
615
614
|
if (topGrid === bottomGrid) {
|
|
616
615
|
return;
|
|
617
616
|
}
|
|
617
|
+
// estimate y-axis max width
|
|
618
|
+
const halfPad = PADDING_PIXELS * .5;
|
|
619
|
+
const paddingYAxis = grid.y.reduce((max, i) => Math.max(max, this.estimateYAxisLabelWidth(i) + halfPad), padding);
|
|
618
620
|
/** width of the WHOLE series dedicated area */
|
|
619
|
-
const seriesWidth = size.width -
|
|
621
|
+
const seriesWidth = size.width - paddingYAxis - padding;
|
|
620
622
|
/** height of the WHOLE series dedicated area */
|
|
621
623
|
const gridHeight = (size.height - 2 * padding);
|
|
622
624
|
const seriesHeight = gridHeight * (1 - (topGrid - bottomGrid - (maxY - minY)) / (topGrid - bottomGrid));
|
|
@@ -1016,14 +1018,17 @@ var Pacem;
|
|
|
1016
1018
|
}
|
|
1017
1019
|
}
|
|
1018
1020
|
}
|
|
1019
|
-
// estimate y-axis max width
|
|
1020
|
-
const paddingYAxisEnd = Math.max(padding, this.estimateXAxisLabelWidth(minX) * .5 + PADDING_PIXELS), paddingYAxis = Math.max(paddingYAxisEnd, this.estimateYAxisLabelWidth(maxY) + PADDING_PIXELS * .5);
|
|
1021
1021
|
/** virtual grid made of x- and y-axis labels */
|
|
1022
1022
|
const withValues = datasource.find(i => !Pacem.Utils.isNullOrEmpty(i.values));
|
|
1023
1023
|
const grid = this._getVirtualGrid(withValues.values, minX, maxX, minY, maxY, xAxisType, this.yAxisDensity, this.xAxisDensity);
|
|
1024
1024
|
const topGrid = grid.y[grid.y.length - 1], bottomGrid = grid.y[0];
|
|
1025
1025
|
if (topGrid === bottomGrid)
|
|
1026
1026
|
return;
|
|
1027
|
+
// estimate y-axis max width
|
|
1028
|
+
const halfPad = padding * .5;
|
|
1029
|
+
const maxYLabelLength = grid.y.reduce((max, i) => Math.max(max, this.estimateYAxisLabelWidth(i) + halfPad), padding);
|
|
1030
|
+
const maxXLabelHalfLength = grid.x.reduce((max, i) => Math.max(max, this.estimateXAxisLabelWidth(i)), padding) * .5;
|
|
1031
|
+
const paddingYAxis = Math.max(maxXLabelHalfLength, maxYLabelLength), paddingYAxisEnd = maxXLabelHalfLength; // Math.max(padding, this.estimateXAxisLabelWidth(minX) * .5 + PADDING_PIXELS);
|
|
1027
1032
|
/** width of the WHOLE series dedicated area */
|
|
1028
1033
|
const seriesWidth = size.width - paddingYAxis - paddingYAxisEnd;
|
|
1029
1034
|
/** height of the WHOLE series dedicated area */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.51.
|
|
2
|
+
* pacem v0.51.5-archimedes (https://js.pacem.it)
|
|
3
3
|
* Copyright 2025 Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
var Pacem,__decorate=this&&this.__decorate||function(t,e,i,r){var s,a=arguments.length,n=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(n=(a<3?s(n):a>3?s(e,i,n):s(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n};!function(t){!function(e){!function(i){i.MANAGED_EVENTS=["keydown","keyup","click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"];const r=864e5,s="pacem:chart-series:dataitem",a="pacem:chart-series:series";function n(t,e,i=o(t,e)){const r=(e-t)/i,s=Math.pow(10,Math.floor(Math.log10(r))),a=[1,2,5,10].map((t=>t*s)).filter((t=>t>=r)).reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY);return{min:Math.floor(t/a)*a,max:Math.ceil(e/a)*a,round:a}}function o(t,e){const i=e-t;if(!(i>0))return 2;const r=Math.floor(Math.log10(i)),s=Math.pow(10,-r);if(0!=r)return o(t*s,e*s);const a=t=>{const e=Math.floor(10*Math.abs(t));return(e+10-e%10).roundoff()},n=a(i);let h=10;0!==t&&(h=a(Math.abs(e)));const c=l(h,n);return 1===c?n:Math.max(c,10-c)}function l(t,e){return t<=0?e:l(e%t,t)}class ChartEvent extends t.CustomUIEvent{constructor(t,e,i){super(t,e,i)}}i.ChartEvent=ChartEvent;let h=class PacemChartSeriesElement extends e.PacemItemElement{get values(){return this.datasource}};__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],h.prototype,"datasource",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"label",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"color",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],h.prototype,"datapoints",void 0),__decorate([t.Watch()],h.prototype,"_uiElements",void 0),h=__decorate([t.CustomElement({tagName:t.P+"-chart-series"})],h),i.PacemChartSeriesElement=h;const c="http://www.w3.org/2000/svg";class PacemSeriesChartElement extends e.PacemItemsContainerElement{constructor(){super(),this._itemPropertyChangedCallback=t=>{const e=t.detail.propertyName;"datasource"!==e&&"label"!==e&&"datapoints"!==e&&"cssClass"!==e&&"color"!==e||this.draw()},this._series=[],this._resizeHandler=t=>{this._size=t.detail,this.draw()},this._broadcastHandler=e=>{const i=e.currentTarget,r=t.CustomElementUtils.getAttachedPropertyValue(i,s);if(t.Utils.isNull(r))return;const n=this.getAnchorPoint(i),o=new ChartEvent("item"+e.type,{detail:{dataItem:r,anchorPoint:n}},e),l=t.CustomElementUtils.getAttachedPropertyValue(i,a);l instanceof h&&l.dispatchEvent(o),this.dispatchEvent(o)},this._key=t.Utils.uniqueCode()}validate(t){return t instanceof h}register(e){return!!super.register(e)&&(e.addEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}unregister(e){return!!super.unregister(e)&&(e.removeEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._div!=i&&this._div&&this._div.remove(),this._div=null,this._body=null;const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this._ensureResizer(),this.draw()}else if(!s)switch(e){case"items":this._databindAndDrawDebounced();break;case"datasource":this._databind();case"yAxisDensity":case"xAxisDensity":case"xAxisType":case"yAxisMax":case"xAxisPosition":case"yAxisFormat":this.draw()}}_databindAndDrawDebounced(){cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame((()=>{this._databind(),this.draw()}))}_databind(){this._datasource=t.Utils.isNullOrEmpty(this.datasource)?this.items:this.datasource}disconnectedCallback(){this._div&&this._div.remove();const e=this._resizer;t.Utils.isNull(e)||(e.removeEventListener(t.Components.ResizeEventName,this._resizeHandler,!1),e.remove(),this._resizer=null),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureResizer(),this._databind(),this.draw()}_ensureResizer(i=this.target||this._div){if(t.Utils.isNull(this._resizer)){const i=t.CustomElementUtils.findAncestorShell(this);(this._resizer=i.appendChild(new e.PacemResizeElement)).addEventListener(t.Components.ResizeEventName,this._resizeHandler,!1)}this._resizer.target=i}get chartSize(){return this._size}get chartSeries(){return this._series}get chartBody(){return this._body}get chartGrid(){return this._grid}get chartMask(){return this._mask}get chartKey(){return this._key}get chartContainer(){return this._div}assignUiBehaviors(e,r,n,o){const l=!t.Utils.isNull(t.CustomElementUtils.getAttachedPropertyValue(e,s)),h=t.Utils.extend({series:r.label,color:o||r.color},n);t.CustomElementUtils.setAttachedPropertyValue(e,s,h),t.CustomElementUtils.setAttachedPropertyValue(e,a,r),l||i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}disposeUiBehaviors(e){t.CustomElementUtils.deleteAttachedPropertyValue(e,s),t.CustomElementUtils.deleteAttachedPropertyValue(e,a),i.MANAGED_EVENTS.forEach((t=>{e.removeEventListener(t,this._broadcastHandler)}))}ensureChartContainer(){if(t.Utils.isNull(this._div)){let e=this._div=this.target||document.createElement("div");e.classList.add(t.PCSS+"-chart-area"),e!=this.target&&this.parentElement.insertBefore(e,this)}return this._div}ensureChartBody(e,i,r){if(t.Utils.isNull(this._body)){let i=this._body=document.createElementNS(c,"svg");i.setAttribute("pacem",""),i.setAttribute("class",t.PCSS+"-"+e+"-chart"),i.setAttribute("preserveAspectRatio","xMinYMax slice");const r=this._grid=document.createElementNS(c,"svg");r.setAttribute("pacem",""),r.setAttribute("class","chart-grid");let s=document.createElementNS(c,"defs"),a=this._mask=document.createElementNS(c,"mask"),n=document.createElementNS(c,"rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width","100%"),n.setAttribute("height","100%");let o=document.createElementNS(c,"rect");o.setAttribute("y","0"),o.setAttribute("width","100%"),o.setAttribute("fill","#fff"),a.id="gnrc_mask_"+this._key,a.appendChild(n),a.appendChild(o),s.appendChild(a),i.appendChild(s),i.appendChild(r),this._div.appendChild(i)}return this._body}chartDataItemToPoint(e,i){switch(this.xAxisType||"string"){case"number":return{x:parseFloat(e.label),y:e.value};case"date":return{x:t.Utils.parseDate(e.label).valueOf(),y:e.value};case"string":return{x:i.findIndex((t=>t.label==e.label)),y:e.value};default:throw"Not supported."}}getVirtualGrid(e,i,s,a,o,l=this.xAxisType,h,c){const d=n(a,o,h),u=d.round;var m=[];for(let t=d.min;t<=d.max;t+=u)m.push(t.roundoff());let p=t.Utils.lang(this),v=null;const g=this.xAxisFormat;if(!t.Utils.isNullOrEmpty(g))switch(l){case"number":v=t=>Intl.NumberFormat(p,g).format(t);break;case"date":v=e=>Intl.DateTimeFormat(p,g).format(t.Utils.parseDate(e))}const y=function(e,i,s,a,n,o=10){const l="number"===i||"date"===i?a-s:Math.max(1,e.length-1);for(var h=[],c=1,d=o-1;d>1;d--)if(l%d==0){c=l/d;break}1===c&&l>o&&(c=l);const u="function"==typeof n?n:c>=r?t=>t.toLocaleDateString(n):t=>t.toLocaleTimeString(n),m="function"==typeof n?n:c<r?t=>t.toLocaleString(n):u,p="function"==typeof n?n:t=>t.toLocaleString(n);for(var v=0;v<=l;v+=c){let r;switch(i){case"string":if(v>=e.length)continue;r=e[v].label;break;case"number":r=p(s+v);break;case"date":r=(0==v?m:u)(t.Utils.parseDate(s+v));break;default:throw"Not supported."}h.push(r)}return h}(e,l,i,s,v??p,c);return{x:y,y:m}}wipeOut(t=this._series,e=0){for(var i=t.length-1;i>=e;i--)t[i].remove();t.splice(e)}buildLinearGradient(e,i=!1){const r=document.createElementNS(c,"linearGradient");r.id=this.chartKey+"_grad"+e+(i?"_inverted":""),i&&t.Utils.addClass(r,"bottom-up"),r.setAttribute("x1","0%"),r.setAttribute("x2","0%"),r.setAttribute("y1","0%"),r.setAttribute("y2","100%"),r.setAttribute("spreadMethod","pad");const s=document.createElementNS(c,"stop");s.setAttribute("offset","0%");const a=document.createElementNS(c,"stop");return a.setAttribute("offset","100%"),r.appendChild(s),r.appendChild(a),r}setGradientColor(t,e){for(let i=0;i<t.children.length;i++){const r=t.children.item(i);r instanceof SVGStopElement&&(r.style.stopColor=e)}}estimateYAxisLabelWidth(t){const e=this.formatYAxisLabel(t);return this.estimateLabelWidth(e)}estimateLabelWidth(e){const i=this._grid;if(t.Utils.isNull(i))throw new Error("Unable to estimate label without an underlying grid available.");const r=document.createElementNS(c,"text");r.textContent=e,i.appendChild(r);const s=t.Utils.offset(r);return r.remove(),s.width}formatYAxisLabel(e){const i=this.yAxisFormat;return t.Utils.isNullOrEmpty(i)?e.toString():Intl.NumberFormat(t.Utils.lang(this),i).format(e)}estimateXAxisLabelWidth(t){const e=this.formatXAxisLabel(t);return this.estimateLabelWidth(e)}formatXAxisLabel(e){const i=this.xAxisFormat,r=t.Utils.lang(this);switch(this.xAxisType){case"date":const s=t.Utils.Dates.parse(e);return t.Utils.isNullOrEmpty(i)?s.toLocaleString(r):Intl.DateTimeFormat(r,i).format(s);case"number":const a=e;return t.Utils.isNullOrEmpty(i)?a.toLocaleString(r):Intl.NumberFormat(r,i).format(a);default:return e}}draw(){this.drawSeries(this._datasource)}getAnchorPoint(e){const i=t.Utils.offset(e);return{x:i.left+.5*i.width,y:i.top+.5*i.height}}}__decorate([t.Watch({converter:t.PropertyConverters.Element})],PacemSeriesChartElement.prototype,"target",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisType",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisPosition",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"datasource",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisDensity",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"xAxisDensity",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisMin",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisMax",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"yAxisFormat",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"xAxisFormat",void 0),__decorate([t.Throttle(!0)],PacemSeriesChartElement.prototype,"draw",null),i.PacemSeriesChartElement=PacemSeriesChartElement}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){const i="http://www.w3.org/2000/svg";let r=class PacemColumnChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),this.groupWidth=0}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),"type"!==t&&"groupWidth"!==t||this.draw()}_safen(t=this.groupWidth){return Math.min(1,Math.max(t||.75,0))}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const r=this.type||"cluster",s=24;var a=this.chartSize;if(a.height<=s||a.width<=s)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this.wipeOut();const n=this.ensureChartBody("column",a.width,a.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${r} chart.`);const o=this.xAxisType||"string";let l=this.yAxisMin??0,h=this.yAxisMax??0,c=0,d=0,u=0,m=1;const p={negative:[],positive:[]};for(let i of e){let e=i.values;if(!t.Utils.isNullOrEmpty(e)){let i=0;for(let r of e){p.positive[i]=p.positive[i]||0,p.negative[i]=p.negative[i]||0;let s=this.chartDataItemToPoint(r,e);t.Utils.isNull(this.yAxisMin)&&(l=Math.min(l,s.y)),t.Utils.isNull(this.yAxisMax)&&(h=Math.max(h,s.y)),c=Math.min(c,s.x),d=Math.max(d,s.x),s.y>0?p.positive[i]+=s.y:s.y<0&&(p.negative[i]+=s.y),i++}u=Math.max(u,e.length)}}const v="stack"===r;v&&(t.Utils.isNull(this.yAxisMin)&&(l=Math.min.apply(null,p.negative)),t.Utils.isNull(this.yAxisMax)&&(h=Math.max.apply(null,p.positive)));const g=Math.max(s,this.estimateYAxisLabelWidth(h)+12);0===d&&d===c&&(d=1);const y=(d-c)/u,_=.5*y,C=y*this._safen(this.groupWidth),f=.5*C,b=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),x=this.getVirtualGrid(b.values,c-_,d+_,l,h,o,this.yAxisDensity,this.xAxisDensity),A=x.y[x.y.length-1],E=x.y[0];if(A===E)return;const w=a.width-2*g,N=a.height-48,S=N*(1-(A-E-(h-l))/(A-E)),P=N*(A-h)/(A-E);m=w/S,n.setAttribute("height",a.height.toString()),n.setAttribute("width",a.width.toString()),n.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`);let M=0;const U=100*m/(d-c),k=100/(h-l),$=2400/S,L=this.chartSeries,W=this.chartGrid,D=(_-c)*U,O=(t,e)=>{const i=this.chartDataItemToPoint(t,e);return{x:D+2*i.x*D,y:i.y*k}};var T=new Array(u);for(let r of e){let s,a,n,o;if(L.length>M)s=L[M],a=s.firstElementChild.firstElementChild,n=s.firstElementChild.lastElementChild,o=s.lastElementChild;else{s=document.createElementNS(i,"svg"),s.setAttribute("pacem",""),W.insertAdjacentElement("afterend",s);const t=document.createElementNS(i,"defs");t.appendChild(a=this.buildLinearGradient(M)),t.appendChild(n=this.buildLinearGradient(M,!0)),s.appendChild(t),s.appendChild(o=document.createElementNS(i,"g")),L.push(s)}var B="chart-series series-fill";t.Utils.isNullOrEmpty(r.className)||(B+=" "+r.className),s.setAttribute("class",B),s.setAttribute("x",g.toString()),s.setAttribute("y",P.toString()),s.setAttribute("width",w.toString()),s.setAttribute("height",(S+48).toString());const l=r.values,h=t=>{for(;t>=o.children.length;)o.appendChild(document.createElementNS(i,"rect"));const e=o.children.item(t);e.style.stroke=r.color;const s=l[t].value<0?n:a;return this.setGradientColor(s,r.color),e.style.fill=`url(#${s.id})`,e},c=10,d=(t,e,i,r=e)=>{const s=-Math.max(e.y,i.y),a=Math.abs(i.y-e.y),n=()=>{t.setAttribute("y",s.toFixed(c)),t.setAttribute("height",a.toFixed(c))};t.hasAttribute("y")?n():(t.setAttribute("y","-"+r.y.toFixed(c)),t.setAttribute("height","0"),requestAnimationFrame(n))};if(!t.Utils.isNullOrEmpty(l)){const i=O({value:0,label:l[0].label},l);if(v){const e=f*U,s=(C*U).toFixed(c);for(let a=0;a<l.length;a++){const n=l[a];t.Utils.isNullOrEmpty(T[a])&&(T[a]={positive:0,negative:0});const o=T[a];let u=o.positive,m=o.negative;const p=n.value<0,v=p?m:u+n.value,g=p?m+n.value:u,y=O({label:n.label,value:v},l),_=O({label:n.label,value:g},l),C=y.x-e,f=h(a);this.assignUiBehaviors(f,r,n),f.setAttribute("x",C.toFixed(c)),f.setAttribute("width",s),d(f,_,y,i),p?o.negative=g:o.positive=v}}else{const t=f*U,s=2*t/e.length,a=s.toFixed(c);for(let e=0;e<l.length;e++){const n=l[e],o=O(n,l),u=o.x-t+s*M,m=h(e);this.assignUiBehaviors(m,r,n),m.setAttribute("x",u.toFixed(c)),m.setAttribute("width",a),d(m,i,o)}}}for(let t=o.children.length-1;t>=l?.length;t--){const e=o.children.item(t);this.disposeUiBehaviors(e),e.remove()}M++}this.wipeOut(L,M);const H=`0 ${-(h*k+$)} ${100*m} ${100+2*$}`;for(var I of L)I.setAttribute("viewBox",H);let V,G=this.chartMask.children.item(1);if(G.setAttribute("x",(0).toString()),G.setAttribute("height",(a.height-s).toString()),W.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`),x.x.length<1||x.y.length<=1){for(let t=W.children.length-1;t>=0;t--)W.children.item(t).remove();return}W.children.length>0?V=W.children.item(0):(V=document.createElementNS(i,"path"),W.appendChild(V));let z=0,F=(t,e,r,s)=>{const a=t+1;let n;return W.children.length<=a?(n=document.createElementNS(i,"text"),W.appendChild(n)):n=W.children.item(a),n.textContent=s,n.setAttribute("x",e.toString()),n.setAttribute("y",r.toString()),n},R=`M${g},24 v${N}`,Y=0;const q=w/x.x.length,J=N/(x.y.length-1);if("none"!==this.xAxisPosition){const t=.5*q+g;for(var j of x.x){let e=t+Y*q;if("top"===this.xAxisPosition){R+=` M${e},24 v-6`;let t=F(z++,e,0,j);t.setAttribute("text-anchor","middle"),t.setAttribute("alignment-baseline","hanging")}else{let t=N+s;R+=` M${e},${t} v6`,F(z++,e,t+s,j).setAttribute("text-anchor","middle")}Y++}}for(var X of(Y=0,x.y)){const t=N+s-Y*J,e=g-6;R+=` M${e},${t} H${w+g}`,F(z++,e-6,t,this.formatYAxisLabel(X)).setAttribute("text-anchor","end"),Y++}V.setAttribute("d",R);for(let t=W.children.length-1;t>z;t--)W.children.item(t).remove()}};__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"groupWidth",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-column-chart"})],r),e.PacemColumnChartElement=r}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){function i(e,i,r){let s=e,a=e;const n=t.Utils.isNull(i),o=t.Utils.isNull(r);if(!n||!o){const t=3;let l,h;n||(l=(e.y-i.y)/(e.x-i.x)),o||(h=(r.y-e.y)/(r.x-e.x));const c=((h||l||0)+(l||h||0))/2,d=n?0:(e.x-i.x)/t,u=o?0:(r.x-e.x)/t;s={x:e.x-d,y:e.y-d*c},a={x:e.x+u,y:e.y+u*c}}return{c0:s,c1:a}}const r=t.CustomElementUtils.getAttachedPropertyValue,s=t.CustomElementUtils.setAttachedPropertyValue,a=(t.CustomElementUtils.deleteAttachedPropertyValue,"pacem:chart-series:area"),n="http://www.w3.org/2000/svg";let o=class PacemChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),this.#t=!1,this._enterHandler=t=>{this.#t=!0},this._leaveHandler=t=>{this.#t=!1},this._moveHandler=t=>{this.#t},this._chartFillSeries=[]}_getVirtualGrid(t,e,i,r,s,a=this.xAxisType,n,o){return super.getVirtualGrid(t,e,i,r,s,a,n,o)}_wipe(t=this.chartSeries,e=0){super.wipeOut(t,e)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupBehavior()}disconnectedCallback(){this._dismantleBehavior(),super.disconnectedCallback()}propertyChangedCallback(t,e,i,r){switch(super.propertyChangedCallback(t,e,i,r),t){case"type":case"aspectRatio":this.draw()}}_setupBehavior(){this.addEventListener("mouseenter",this._enterHandler,!1),this.addEventListener("mouseleave",this._enterHandler,!1),this.addEventListener("mousemove",this._moveHandler,!1)}_dismantleBehavior(){this.removeEventListener("mouseenter",this._enterHandler,!1),this.removeEventListener("mouseleave",this._leaveHandler,!1),this.removeEventListener("mousemove",this._moveHandler,!1)}#t;_buildLinearGradient(t){return super.buildLinearGradient(t)}_setGradientColor(t,e){super.setGradientColor(t,e)}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const o=this.type||"line",l=24;var h=this.chartSize;if(h.height<=l||h.width<=l)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this._wipe();const c=this.ensureChartBody("line",h.width,h.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${o} chart.`);const d=this.xAxisType||"string";let u=this.yAxisMin??Number.NaN,m=this.yAxisMax??Number.NaN,p=Number.NaN,v=Number.NaN,g=1;for(let i of e){let e=i.values;if(e&&e.length){let i=0;for(let r of e){let s=this.chartDataItemToPoint(r,e);t.Utils.isNull(this.yAxisMin)&&(u=isNaN(u)?s.y:Math.min(u,s.y)),t.Utils.isNull(this.yAxisMax)&&(m=isNaN(m)?s.y:Math.max(m,s.y)),0===i?p=isNaN(p)?s.x:Math.min(p,s.x):i===e.length-1&&(v=isNaN(v)?s.x:Math.max(v,s.x)),i++}}}const y=Math.max(l,.5*this.estimateXAxisLabelWidth(p)+24),_=Math.max(y,this.estimateYAxisLabelWidth(m)+12),C=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),f=this._getVirtualGrid(C.values,p,v,u,m,d,this.yAxisDensity,this.xAxisDensity),b=f.y[f.y.length-1],x=f.y[0];if(b===x)return;const A=h.width-_-y,E=h.height-48,w=E*(1-(b-x-(m-u))/(b-x)),N=E*(b-m)/(b-x);("number"!==d||"monometric"!==this.aspectRatio&&"logaritmic"!==this.aspectRatio)&&(g=A/w,c.setAttribute("height",h.height.toString()),c.setAttribute("width",h.width.toString())),c.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`);let S=0;const P=100*g/(v-p),M=100/(m-u),U=2400/w,k=(t,e)=>{let i=this.chartDataItemToPoint(t,e);return i.y*=M,i.x=(i.x-p)*P,i},$=this.chartSeries,L=this._chartFillSeries,W=this.chartGrid,D="spline"===o||"splinearea"===o;for(let l of e){let e,h,d;if($.length>S)e=$[S],h=L[S],d=h.firstElementChild.firstElementChild;else{e=document.createElementNS(n,"svg"),e.setAttribute("pacem",""),c.appendChild(e),h=document.createElementNS(n,"svg"),h.setAttribute("pacem",""),c.insertBefore(h,c.children.item(S+2));const t=document.createElementNS(n,"defs");t.appendChild(d=this._buildLinearGradient(S)),h.appendChild(t),h.appendChild(document.createElementNS(n,"path")),L.push(h),e.appendChild(document.createElementNS(n,"path")),$.push(e)}let m="chart-series";const p="area"===o||"splinearea"===o;t.Utils.isNullOrEmpty(l.className)||(m+=" "+l.className),[e,h].forEach((t=>{t.setAttribute("class",m),t.setAttribute("x",_.toString()),t.setAttribute("y",N.toString()),t.setAttribute("width",A.toString()),t.setAttribute("height",(w+48).toString())})),t.Utils.addClass(h,t.PCSS+"-inert");let v=h.children.item(1),g=e.firstElementChild;g.style.stroke=l.color,v.style.stroke=g.style.fill="none",this._setGradientColor(d,l.color),v.style.fill=`url(#${d.id})`,v.style.display=p?"":"none";let y="",C=l.values;if(C&&C.length){const o=(t,i,r,s,a)=>{const o=i+1;let l;e.children.length>o?l=e.children.item(o):(l=document.createElementNS(n,"line"),l.setAttribute("class","circle"),e.appendChild(l));const h=t.x.toString(),c=(-t.y).toString();l.setAttribute("x1",h),l.setAttribute("y1",c),l.setAttribute("x2",h),l.setAttribute("y2",c),l.style.stroke=a,this.assignUiBehaviors(l,r,s,a)},h=()=>{const t=l.datapoints?C.length+1:1;for(let r=e.children.length-1;r>=t;r--){var i=e.children.item(r);this.disposeUiBehaviors(i),i.remove()}};if(D){let e,n,h;for(let c=0;c<C.length;c++){const d=C[c];if(isNaN(d.value))continue;let u;n||(n=k(d,C)),D&&c<C.length-1&&(u=k(C[c+1],C));let m=r(l,a,0);m+=d.value,s(l,a,m);var O=i(n,e,u);y+=t.Utils.isNullOrEmpty(y)?`M${n.x},${-n.y} `:`C${h.x},${-h.y} ${O.c0.x},${-O.c0.y} ${n.x},${-n.y} `,l.datapoints&&o(n,c,l,d,l.color),e=n,n=u,h=O.c1}}else{let e=0;for(let i of C){if(isNaN(i.value))continue;const n=k(i,C);let h=r(l,a,0);h+=i.value,s(l,a,h),y+=t.Utils.isNullOrEmpty(y)?`M${n.x},${-n.y} `:`L${n.x},${-n.y} `,l.datapoints&&o(n,e,l,i,l.color),e++}}h()}g.setAttribute("d",y),v.setAttribute("d",y+`V${-u*M} H0 Z`),S++}this._wipe(L,S),this._wipe($,S);const T=`0 ${-(m*M+U)} ${100*g} ${100+2*U}`;for(var B of $.concat(L))B.setAttribute("viewBox",T);let H,I=this.chartMask.children.item(1);if(I.setAttribute("x",(0).toString()),I.setAttribute("height",(h.height-l).toString()),W.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`),f.x.length<=1||f.y.length<=1){for(let t=W.children.length-1;t>=0;t--)W.children.item(t).remove();return}W.children.length>0?H=W.children.item(0):(H=document.createElementNS(n,"path"),W.appendChild(H));let V=0,G=(t,e,i,r)=>{const s=t+1;let a;return W.children.length<=s?(a=document.createElementNS(n,"text"),W.appendChild(a)):a=W.children.item(s),a.textContent=r,a.setAttribute("x",e.toString()),a.setAttribute("y",i.toString()),a},z=`M${_},24 v${E}`,F=0;const R=A/(f.x.length-1),Y=E/(f.y.length-1);if("none"!==this.xAxisPosition)for(var q of f.x){const t=_+F*R;if("top"===this.xAxisPosition){z+=` M${t},24 v-6`;let e=G(V++,t,0,q);e.setAttribute("text-anchor","middle"),e.setAttribute("alignment-baseline","hanging")}else{let e=E+l;z+=` M${t},${e} v6`,G(V++,t,e+l,q).setAttribute("text-anchor","middle")}F++}for(var J of(F=0,f.y)){const t=E+l-F*Y,e=_-6;z+=` M${e},${t} H${A+_}`,G(V++,e-6,t,this.formatYAxisLabel(J)).setAttribute("text-anchor","end"),F++}H.setAttribute("d",z);for(let t=W.children.length-1;t>V;t--)W.children.item(t).remove()}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],o.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],o.prototype,"aspectRatio",void 0),o=__decorate([t.CustomElement({tagName:t.P+"-chart"})],o),e.PacemChartElement=o}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(i){let r=class PacemPieSliceElement extends e.PacemItemElement{constructor(){super(...arguments),this._broadcastHandler=t=>{this.emit(t)}}findContainer(){return t.CustomElementUtils.findAncestorOfType(this,n)}get chart(){return this.container}getCenterOfMass(){const e=this.chart&&this.chart.area;if(t.Utils.isNull(e))return null;const i=t.Utils.offset(e),r=i.width/2+i.left,s=i.top+i.height/2,n=.5*Math.min(i.width,i.height),o=this.normalizedPolarCoords,l=a-o.angle;return{y:s-n*o.radius*Math.sin(l),x:r+n*o.radius*Math.cos(l)}}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),!r&&this.chart&&"normalizedPolarCoords"!=t&&this.chart.draw()}_assignUi(t){const e=this._ui=t;i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}_disposeUi(){t.Utils.isNull(this._ui)||i.MANAGED_EVENTS.forEach((t=>{this._ui.removeEventListener(t,this._broadcastHandler)}))}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"value",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"label",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"color",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Json})],r.prototype,"normalizedPolarCoords",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-pie-slice"})],r),i.PacemPieSliceElement=r;const s=2*Math.PI,a=.5*Math.PI;let n=class PacemPieChartElement extends e.PacemItemsContainerElement{constructor(){super(),this.cutout=0,this.slicePadding=0,this._slices=new WeakMap,this._key=t.Utils.uniqueCode()}validate(t){return t instanceof r}viewActivatedCallback(){super.viewActivatedCallback(),this.draw()}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._g=null,this._div&&this._div.remove();const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this.draw()}else s||"cutout"!==e&&"items"!==e&&"slicePadding"!==e||this.draw()}get area(){return this._svg}disconnectedCallback(){this._div&&this._div.remove(),super.disconnectedCallback()}_ensureArea(){if(t.Utils.isNull(this._g)){let e=this.target||(this._div=document.createElement("div"));e.classList.add(t.PCSS+"-chart-area");let i=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("pacem",""),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.setAttribute("viewBox","0 0 100 100"),i.classList.add(t.PCSS+"-pie-chart");let r=document.createElementNS("http://www.w3.org/2000/svg","defs"),s=this._g=document.createElementNS("http://www.w3.org/2000/svg","g");i.appendChild(r),i.appendChild(s),e.appendChild(i),this._div&&this.parentElement.insertBefore(e,this)}if(this.maskBasedRendering){if(t.Utils.isNull(this._mask)){let t=document.createElementNS("http://www.w3.org/2000/svg","mask");t.id="pie_mask_"+this._key;let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x","0"),e.setAttribute("y","0"),e.setAttribute("width","100"),e.setAttribute("height","100"),e.setAttribute("fill","#fff");let i=this._mask=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx","50"),i.setAttribute("cy","50");const r=this._svg.firstElementChild;t.appendChild(e),t.appendChild(i),r.appendChild(t),this._g.setAttribute("mask",`url(#${t.id})`)}const e=50*this._safeCutout;this._mask.setAttribute("r",`${e}`)}else t.Utils.isNull(this._mask)||(this._svg.firstElementChild.innerHTML="",this._mask=null,this._g.removeAttribute("mask"));const e=this._safeSlicePaddingPixels;if(e>0){const i=(e/this._svg.getCTM().a).roundoff(),r=this._sliceMaskId,s=this._svg.firstElementChild;let a=s.querySelector(`#${r}`);t.Utils.isNull(a)?(a=document.createElementNS("http://www.w3.org/2000/svg","mask"),a.id=r,s.appendChild(a)):a.innerHTML="";const n=document.createElementNS("http://www.w3.org/2000/svg","path"),o=`M${50+i},0 H100 V100 H0 V0 H50 V50 h${i} Z`;n.setAttribute("d",o),n.setAttribute("fill","#fff"),a.appendChild(n)}return this._g}get _sliceMaskId(){return"pieslice_mask_"+this._key}get _safeCutout(){return Math.min(1,Math.max(0,this.cutout))||0}get _safeSlicePaddingPixels(){return Math.max(0,this.slicePadding??0)}_drawSlice(t,e,i,r){const a=e.value>.5*i?1:0,n=s*e.value/i,o=360*r/i,l=e.value>=i?49.9:50*(1+Math.sin(n)),h=50*(1-Math.cos(n)),c=this._safeCutout,d=50*c;t.style.fill=e.color,t.style.transform=`rotate(${o}deg)`,t.style.transformOrigin="50% 50%";const u=this.maskBasedRendering?`M50,50 V0 A50,50 0 ${a} 1 ${l} ${h} L50,50 Z`:`M50,0 A50,50 0 ${a} 1 ${l} ${h} l${(50-l)*(1-c)},${(50-h)*(1-c)} A${d},${d} 0 ${a} 0 50,${50-d} Z`;t.setAttribute("d",u),e.normalizedPolarCoords={radius:c+Math.SQRT1_2*(1-c),angle:Math.PI*o/180+n/2}}_isSliceOk(t){return!t.disabled}_padSlice(t){this._safeSlicePaddingPixels>0?t.setAttribute("mask",`url(#${this._sliceMaskId})`):t.removeAttribute("mask")}draw(){const e=this._ensureArea(),i=e.children.length,r=this._svg.parentElement;let s=0,a=0,n=0;if(t.Utils.isNullOrEmpty(this.items))e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else{t.Utils.addClass(r,"chart-has-data");for(let t of this.items)this._isSliceOk(t)&&(a+=t.value);if(a<=0)e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else for(let r of this.items){if(!this._isSliceOk(r))continue;let o;if(s>=i){const i=document.createElementNS("http://www.w3.org/2000/svg","g");i.setAttribute("class","chart-series "+t.PCSS+"-pie-slice"+(t.Utils.isNullOrEmpty(r.className)?"":" "+r.className)),o=document.createElementNS("http://www.w3.org/2000/svg","path"),i.appendChild(o),e.appendChild(i),r._assignUi(i),this._slices.set(i,r)}else o=e.children.item(s).firstElementChild;r.value>0?(this._drawSlice(o,r,a,n),this._padSlice(o),n+=r.value,o.removeAttribute("display")):o.setAttribute("display","none"),s++}}for(;s<e.children.length;){const t=this._slices,i=e.children.item(s);t.has(i)&&(t.get(i)._disposeUi(),t.delete(i)),e.removeChild(i)}}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],n.prototype,"cutout",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Element})],n.prototype,"target",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Boolean})],n.prototype,"maskBasedRendering",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],n.prototype,"slicePadding",void 0),__decorate([t.Debounce(!0)],n.prototype,"draw",null),n=__decorate([t.CustomElement({tagName:t.P+"-pie-chart"})],n),i.PacemPieChartElement=n}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={}));
|
|
6
|
+
var Pacem,__decorate=this&&this.__decorate||function(t,e,i,r){var s,a=arguments.length,n=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(n=(a<3?s(n):a>3?s(e,i,n):s(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n};!function(t){!function(e){!function(i){i.MANAGED_EVENTS=["keydown","keyup","click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"];const r=864e5,s="pacem:chart-series:dataitem",a="pacem:chart-series:series";function n(t,e,i){i??=Math.min(o(t,e),10);const r=(e-t)/i,s=Math.pow(10,Math.floor(Math.log10(r))),a=[1,2,5,10].map((t=>t*s)).filter((t=>t>=r)).reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY);return{min:Math.floor(t/a)*a,max:Math.ceil(e/a)*a,round:a}}function o(t,e){const i=e-t;if(!(i>0))return 2;const r=Math.floor(Math.log10(i)),s=Math.pow(10,-r);if(0!=r)return o(t*s,e*s);const a=t=>{const e=Math.floor(10*Math.abs(t));return(e+10-e%10).roundoff()},n=a(i);let h=10;0!==t&&(h=a(Math.abs(e)));const c=l(h,n);return 1===c?n:Math.max(c,10-c)}function l(t,e){return t<=0?e:l(e%t,t)}class ChartEvent extends t.CustomUIEvent{constructor(t,e,i){super(t,e,i)}}i.ChartEvent=ChartEvent;let h=class PacemChartSeriesElement extends e.PacemItemElement{get values(){return this.datasource}};__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],h.prototype,"datasource",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"label",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"color",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],h.prototype,"datapoints",void 0),__decorate([t.Watch()],h.prototype,"_uiElements",void 0),h=__decorate([t.CustomElement({tagName:t.P+"-chart-series"})],h),i.PacemChartSeriesElement=h;const c="http://www.w3.org/2000/svg";class PacemSeriesChartElement extends e.PacemItemsContainerElement{constructor(){super(),this._itemPropertyChangedCallback=t=>{const e=t.detail.propertyName;"datasource"!==e&&"label"!==e&&"datapoints"!==e&&"cssClass"!==e&&"color"!==e||this.draw()},this._series=[],this._resizeHandler=t=>{this._size=t.detail,this.draw()},this._broadcastHandler=e=>{const i=e.currentTarget,r=t.CustomElementUtils.getAttachedPropertyValue(i,s);if(t.Utils.isNull(r))return;const n=this.getAnchorPoint(i),o=new ChartEvent("item"+e.type,{detail:{dataItem:r,anchorPoint:n}},e),l=t.CustomElementUtils.getAttachedPropertyValue(i,a);l instanceof h&&l.dispatchEvent(o),this.dispatchEvent(o)},this._key=t.Utils.uniqueCode()}validate(t){return t instanceof h}register(e){return!!super.register(e)&&(e.addEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}unregister(e){return!!super.unregister(e)&&(e.removeEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._div!=i&&this._div&&this._div.remove(),this._div=null,this._body=null;const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this._ensureResizer(),this.draw()}else if(!s)switch(e){case"items":this._databindAndDrawDebounced();break;case"datasource":this._databind();case"yAxisDensity":case"xAxisDensity":case"xAxisType":case"yAxisMax":case"xAxisPosition":case"yAxisFormat":this.draw()}}_databindAndDrawDebounced(){cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame((()=>{this._databind(),this.draw()}))}_databind(){this._datasource=t.Utils.isNullOrEmpty(this.datasource)?this.items:this.datasource}disconnectedCallback(){this._div&&this._div.remove();const e=this._resizer;t.Utils.isNull(e)||(e.removeEventListener(t.Components.ResizeEventName,this._resizeHandler,!1),e.remove(),this._resizer=null),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureResizer(),this._databind(),this.draw()}_ensureResizer(i=this.target||this._div){if(t.Utils.isNull(this._resizer)){const i=t.CustomElementUtils.findAncestorShell(this);(this._resizer=i.appendChild(new e.PacemResizeElement)).addEventListener(t.Components.ResizeEventName,this._resizeHandler,!1)}this._resizer.target=i}get chartSize(){return this._size}get chartSeries(){return this._series}get chartBody(){return this._body}get chartGrid(){return this._grid}get chartMask(){return this._mask}get chartKey(){return this._key}get chartContainer(){return this._div}assignUiBehaviors(e,r,n,o){const l=!t.Utils.isNull(t.CustomElementUtils.getAttachedPropertyValue(e,s)),h=t.Utils.extend({series:r.label,color:o||r.color},n);t.CustomElementUtils.setAttachedPropertyValue(e,s,h),t.CustomElementUtils.setAttachedPropertyValue(e,a,r),l||i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}disposeUiBehaviors(e){t.CustomElementUtils.deleteAttachedPropertyValue(e,s),t.CustomElementUtils.deleteAttachedPropertyValue(e,a),i.MANAGED_EVENTS.forEach((t=>{e.removeEventListener(t,this._broadcastHandler)}))}ensureChartContainer(){if(t.Utils.isNull(this._div)){let e=this._div=this.target||document.createElement("div");e.classList.add(t.PCSS+"-chart-area"),e!=this.target&&this.parentElement.insertBefore(e,this)}return this._div}ensureChartBody(e,i,r){if(t.Utils.isNull(this._body)){let i=this._body=document.createElementNS(c,"svg");i.setAttribute("pacem",""),i.setAttribute("class",t.PCSS+"-"+e+"-chart"),i.setAttribute("preserveAspectRatio","xMinYMax slice");const r=this._grid=document.createElementNS(c,"svg");r.setAttribute("pacem",""),r.setAttribute("class","chart-grid");let s=document.createElementNS(c,"defs"),a=this._mask=document.createElementNS(c,"mask"),n=document.createElementNS(c,"rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width","100%"),n.setAttribute("height","100%");let o=document.createElementNS(c,"rect");o.setAttribute("y","0"),o.setAttribute("width","100%"),o.setAttribute("fill","#fff"),a.id="gnrc_mask_"+this._key,a.appendChild(n),a.appendChild(o),s.appendChild(a),i.appendChild(s),i.appendChild(r),this._div.appendChild(i)}return this._body}chartDataItemToPoint(e,i){switch(this.xAxisType||"string"){case"number":return{x:parseFloat(e.label),y:e.value};case"date":return{x:t.Utils.parseDate(e.label).valueOf(),y:e.value};case"string":return{x:i.findIndex((t=>t.label==e.label)),y:e.value};default:throw"Not supported."}}getVirtualGrid(e,i,s,a,o,l=this.xAxisType,h,c){const d=n(a,o,h),u=d.round;var m=[];for(let t=d.min;t<=d.max;t+=u)m.push(t.roundoff());let p=t.Utils.lang(this),v=null;const g=this.xAxisFormat;if(!t.Utils.isNullOrEmpty(g))switch(l){case"number":v=t=>Intl.NumberFormat(p,g).format(t);break;case"date":v=e=>Intl.DateTimeFormat(p,g).format(t.Utils.parseDate(e))}const y=function(e,i,s,a,n,o=10){const l="number"===i||"date"===i?a-s:Math.max(1,e.length-1);for(var h=[],c=1,d=o-1;d>1;d--)if(l%d==0){c=l/d;break}1===c&&l>o&&(c=l);const u="function"==typeof n?n:c>=r?t=>t.toLocaleDateString(n):t=>t.toLocaleTimeString(n),m="function"==typeof n?n:c<r?t=>t.toLocaleString(n):u,p="function"==typeof n?n:t=>t.toLocaleString(n);for(var v=0;v<=l;v+=c){let r;switch(i){case"string":if(v>=e.length)continue;r=e[v].label;break;case"number":r=p(s+v);break;case"date":r=(0==v?m:u)(t.Utils.parseDate(s+v));break;default:throw"Not supported."}h.push(r)}return h}(e,l,i,s,v??p,c);return{x:y,y:m}}wipeOut(t=this._series,e=0){for(var i=t.length-1;i>=e;i--)t[i].remove();t.splice(e)}buildLinearGradient(e,i=!1){const r=document.createElementNS(c,"linearGradient");r.id=this.chartKey+"_grad"+e+(i?"_inverted":""),i&&t.Utils.addClass(r,"bottom-up"),r.setAttribute("x1","0%"),r.setAttribute("x2","0%"),r.setAttribute("y1","0%"),r.setAttribute("y2","100%"),r.setAttribute("spreadMethod","pad");const s=document.createElementNS(c,"stop");s.setAttribute("offset","0%");const a=document.createElementNS(c,"stop");return a.setAttribute("offset","100%"),r.appendChild(s),r.appendChild(a),r}setGradientColor(t,e){for(let i=0;i<t.children.length;i++){const r=t.children.item(i);r instanceof SVGStopElement&&(r.style.stopColor=e)}}estimateYAxisLabelWidth(t){const e=this.formatYAxisLabel(t);return this.estimateLabelWidth(e)}estimateLabelWidth(e){const i=this._grid;if(t.Utils.isNull(i))throw new Error("Unable to estimate label without an underlying grid available.");const r=document.createElementNS(c,"text");r.textContent=e,i.appendChild(r);const s=t.Utils.offset(r);return r.remove(),s.width}formatYAxisLabel(e){const i=this.yAxisFormat;return t.Utils.isNullOrEmpty(i)?e.toString():Intl.NumberFormat(t.Utils.lang(this),i).format(e)}estimateXAxisLabelWidth(t){const e=this.formatXAxisLabel(t);return this.estimateLabelWidth(e)}formatXAxisLabel(e){const i=this.xAxisFormat,r=t.Utils.lang(this);switch(this.xAxisType){case"date":const s=t.Utils.Dates.parse(e);return t.Utils.isNullOrEmpty(i)?s.toLocaleString(r):Intl.DateTimeFormat(r,i).format(s);case"number":const a=e;return t.Utils.isNullOrEmpty(i)?a.toLocaleString(r):Intl.NumberFormat(r,i).format(a);default:return e}}draw(){this.drawSeries(this._datasource)}getAnchorPoint(e){const i=t.Utils.offset(e);return{x:i.left+.5*i.width,y:i.top+.5*i.height}}}__decorate([t.Watch({converter:t.PropertyConverters.Element})],PacemSeriesChartElement.prototype,"target",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisType",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisPosition",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"datasource",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisDensity",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"xAxisDensity",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisMin",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisMax",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"yAxisFormat",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"xAxisFormat",void 0),__decorate([t.Throttle(!0)],PacemSeriesChartElement.prototype,"draw",null),i.PacemSeriesChartElement=PacemSeriesChartElement}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){const i="http://www.w3.org/2000/svg";let r=class PacemColumnChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),this.groupWidth=0}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),"type"!==t&&"groupWidth"!==t||this.draw()}_safen(t=this.groupWidth){return Math.min(1,Math.max(t||.75,0))}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const r=this.type||"cluster",s=24;var a=this.chartSize;if(a.height<=s||a.width<=s)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this.wipeOut();const n=this.ensureChartBody("column",a.width,a.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${r} chart.`);const o=this.xAxisType||"string";let l=this.yAxisMin??0,h=this.yAxisMax??0,c=0,d=0,u=0,m=1;const p={negative:[],positive:[]};for(let i of e){let e=i.values;if(!t.Utils.isNullOrEmpty(e)){let i=0;for(let r of e){p.positive[i]=p.positive[i]||0,p.negative[i]=p.negative[i]||0;let s=this.chartDataItemToPoint(r,e);t.Utils.isNull(this.yAxisMin)&&(l=Math.min(l,s.y)),t.Utils.isNull(this.yAxisMax)&&(h=Math.max(h,s.y)),c=Math.min(c,s.x),d=Math.max(d,s.x),s.y>0?p.positive[i]+=s.y:s.y<0&&(p.negative[i]+=s.y),i++}u=Math.max(u,e.length)}}const v="stack"===r;v&&(t.Utils.isNull(this.yAxisMin)&&(l=Math.min.apply(null,p.negative)),t.Utils.isNull(this.yAxisMax)&&(h=Math.max.apply(null,p.positive))),0===d&&d===c&&(d=1);const g=(d-c)/u,y=.5*g,_=g*this._safen(this.groupWidth),C=.5*_,f=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),b=this.getVirtualGrid(f.values,c-y,d+y,l,h,o,this.yAxisDensity,this.xAxisDensity),x=b.y[b.y.length-1],A=b.y[0];if(x===A)return;const E=b.y.reduce(((t,e)=>Math.max(t,this.estimateYAxisLabelWidth(e)+12)),s),w=a.width-E-s,N=a.height-48,S=N*(1-(x-A-(h-l))/(x-A)),P=N*(x-h)/(x-A);m=w/S,n.setAttribute("height",a.height.toString()),n.setAttribute("width",a.width.toString()),n.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`);let M=0;const U=100*m/(d-c),k=100/(h-l),$=2400/S,L=this.chartSeries,W=this.chartGrid,D=(y-c)*U,O=(t,e)=>{const i=this.chartDataItemToPoint(t,e);return{x:D+2*i.x*D,y:i.y*k}};var T=new Array(u);for(let r of e){let s,a,n,o;if(L.length>M)s=L[M],a=s.firstElementChild.firstElementChild,n=s.firstElementChild.lastElementChild,o=s.lastElementChild;else{s=document.createElementNS(i,"svg"),s.setAttribute("pacem",""),W.insertAdjacentElement("afterend",s);const t=document.createElementNS(i,"defs");t.appendChild(a=this.buildLinearGradient(M)),t.appendChild(n=this.buildLinearGradient(M,!0)),s.appendChild(t),s.appendChild(o=document.createElementNS(i,"g")),L.push(s)}var B="chart-series series-fill";t.Utils.isNullOrEmpty(r.className)||(B+=" "+r.className),s.setAttribute("class",B),s.setAttribute("x",E.toString()),s.setAttribute("y",P.toString()),s.setAttribute("width",w.toString()),s.setAttribute("height",(S+48).toString());const l=r.values,h=t=>{for(;t>=o.children.length;)o.appendChild(document.createElementNS(i,"rect"));const e=o.children.item(t);e.style.stroke=r.color;const s=l[t].value<0?n:a;return this.setGradientColor(s,r.color),e.style.fill=`url(#${s.id})`,e},c=10,d=(t,e,i,r=e)=>{const s=-Math.max(e.y,i.y),a=Math.abs(i.y-e.y),n=()=>{t.setAttribute("y",s.toFixed(c)),t.setAttribute("height",a.toFixed(c))};t.hasAttribute("y")?n():(t.setAttribute("y","-"+r.y.toFixed(c)),t.setAttribute("height","0"),requestAnimationFrame(n))};if(!t.Utils.isNullOrEmpty(l)){const i=O({value:0,label:l[0].label},l);if(v){const e=C*U,s=(_*U).toFixed(c);for(let a=0;a<l.length;a++){const n=l[a];t.Utils.isNullOrEmpty(T[a])&&(T[a]={positive:0,negative:0});const o=T[a];let u=o.positive,m=o.negative;const p=n.value<0,v=p?m:u+n.value,g=p?m+n.value:u,y=O({label:n.label,value:v},l),_=O({label:n.label,value:g},l),C=y.x-e,f=h(a);this.assignUiBehaviors(f,r,n),f.setAttribute("x",C.toFixed(c)),f.setAttribute("width",s),d(f,_,y,i),p?o.negative=g:o.positive=v}}else{const t=C*U,s=2*t/e.length,a=s.toFixed(c);for(let e=0;e<l.length;e++){const n=l[e],o=O(n,l),u=o.x-t+s*M,m=h(e);this.assignUiBehaviors(m,r,n),m.setAttribute("x",u.toFixed(c)),m.setAttribute("width",a),d(m,i,o)}}}for(let t=o.children.length-1;t>=l?.length;t--){const e=o.children.item(t);this.disposeUiBehaviors(e),e.remove()}M++}this.wipeOut(L,M);const H=`0 ${-(h*k+$)} ${100*m} ${100+2*$}`;for(var I of L)I.setAttribute("viewBox",H);let V,G=this.chartMask.children.item(1);if(G.setAttribute("x",(0).toString()),G.setAttribute("height",(a.height-s).toString()),W.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`),b.x.length<1||b.y.length<=1){for(let t=W.children.length-1;t>=0;t--)W.children.item(t).remove();return}W.children.length>0?V=W.children.item(0):(V=document.createElementNS(i,"path"),W.appendChild(V));let z=0,F=(t,e,r,s)=>{const a=t+1;let n;return W.children.length<=a?(n=document.createElementNS(i,"text"),W.appendChild(n)):n=W.children.item(a),n.textContent=s,n.setAttribute("x",e.toString()),n.setAttribute("y",r.toString()),n},R=`M${E},24 v${N}`,Y=0;const q=w/b.x.length,J=N/(b.y.length-1);if("none"!==this.xAxisPosition){const t=.5*q+E;for(var j of b.x){let e=t+Y*q;if("top"===this.xAxisPosition){R+=` M${e},24 v-6`;let t=F(z++,e,0,j);t.setAttribute("text-anchor","middle"),t.setAttribute("alignment-baseline","hanging")}else{let t=N+s;R+=` M${e},${t} v6`,F(z++,e,t+s,j).setAttribute("text-anchor","middle")}Y++}}for(var X of(Y=0,b.y)){const t=N+s-Y*J,e=E-6;R+=` M${e},${t} H${w+E}`,F(z++,e-6,t,this.formatYAxisLabel(X)).setAttribute("text-anchor","end"),Y++}V.setAttribute("d",R);for(let t=W.children.length-1;t>z;t--)W.children.item(t).remove()}};__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"groupWidth",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-column-chart"})],r),e.PacemColumnChartElement=r}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){function i(e,i,r){let s=e,a=e;const n=t.Utils.isNull(i),o=t.Utils.isNull(r);if(!n||!o){const t=3;let l,h;n||(l=(e.y-i.y)/(e.x-i.x)),o||(h=(r.y-e.y)/(r.x-e.x));const c=((h||l||0)+(l||h||0))/2,d=n?0:(e.x-i.x)/t,u=o?0:(r.x-e.x)/t;s={x:e.x-d,y:e.y-d*c},a={x:e.x+u,y:e.y+u*c}}return{c0:s,c1:a}}const r=t.CustomElementUtils.getAttachedPropertyValue,s=t.CustomElementUtils.setAttachedPropertyValue,a=(t.CustomElementUtils.deleteAttachedPropertyValue,"pacem:chart-series:area"),n="http://www.w3.org/2000/svg";let o=class PacemChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),this.#t=!1,this._enterHandler=t=>{this.#t=!0},this._leaveHandler=t=>{this.#t=!1},this._moveHandler=t=>{this.#t},this._chartFillSeries=[]}_getVirtualGrid(t,e,i,r,s,a=this.xAxisType,n,o){return super.getVirtualGrid(t,e,i,r,s,a,n,o)}_wipe(t=this.chartSeries,e=0){super.wipeOut(t,e)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupBehavior()}disconnectedCallback(){this._dismantleBehavior(),super.disconnectedCallback()}propertyChangedCallback(t,e,i,r){switch(super.propertyChangedCallback(t,e,i,r),t){case"type":case"aspectRatio":this.draw()}}_setupBehavior(){this.addEventListener("mouseenter",this._enterHandler,!1),this.addEventListener("mouseleave",this._enterHandler,!1),this.addEventListener("mousemove",this._moveHandler,!1)}_dismantleBehavior(){this.removeEventListener("mouseenter",this._enterHandler,!1),this.removeEventListener("mouseleave",this._leaveHandler,!1),this.removeEventListener("mousemove",this._moveHandler,!1)}#t;_buildLinearGradient(t){return super.buildLinearGradient(t)}_setGradientColor(t,e){super.setGradientColor(t,e)}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const o=this.type||"line",l=24;var h=this.chartSize;if(h.height<=l||h.width<=l)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this._wipe();const c=this.ensureChartBody("line",h.width,h.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${o} chart.`);const d=this.xAxisType||"string";let u=this.yAxisMin??Number.NaN,m=this.yAxisMax??Number.NaN,p=Number.NaN,v=Number.NaN,g=1;for(let i of e){let e=i.values;if(e&&e.length){let i=0;for(let r of e){let s=this.chartDataItemToPoint(r,e);t.Utils.isNull(this.yAxisMin)&&(u=isNaN(u)?s.y:Math.min(u,s.y)),t.Utils.isNull(this.yAxisMax)&&(m=isNaN(m)?s.y:Math.max(m,s.y)),0===i?p=isNaN(p)?s.x:Math.min(p,s.x):i===e.length-1&&(v=isNaN(v)?s.x:Math.max(v,s.x)),i++}}}const y=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),_=this._getVirtualGrid(y.values,p,v,u,m,d,this.yAxisDensity,this.xAxisDensity),C=_.y[_.y.length-1],f=_.y[0];if(C===f)return;const b=_.y.reduce(((t,e)=>Math.max(t,this.estimateYAxisLabelWidth(e)+12)),l),x=.5*_.x.reduce(((t,e)=>Math.max(t,this.estimateXAxisLabelWidth(e))),l),A=Math.max(x,b),E=x,w=h.width-A-E,N=h.height-48,S=N*(1-(C-f-(m-u))/(C-f)),P=N*(C-m)/(C-f);("number"!==d||"monometric"!==this.aspectRatio&&"logaritmic"!==this.aspectRatio)&&(g=w/S,c.setAttribute("height",h.height.toString()),c.setAttribute("width",h.width.toString())),c.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`);let M=0;const U=100*g/(v-p),k=100/(m-u),$=2400/S,L=(t,e)=>{let i=this.chartDataItemToPoint(t,e);return i.y*=k,i.x=(i.x-p)*U,i},W=this.chartSeries,D=this._chartFillSeries,O=this.chartGrid,T="spline"===o||"splinearea"===o;for(let l of e){let e,h,d;if(W.length>M)e=W[M],h=D[M],d=h.firstElementChild.firstElementChild;else{e=document.createElementNS(n,"svg"),e.setAttribute("pacem",""),c.appendChild(e),h=document.createElementNS(n,"svg"),h.setAttribute("pacem",""),c.insertBefore(h,c.children.item(M+2));const t=document.createElementNS(n,"defs");t.appendChild(d=this._buildLinearGradient(M)),h.appendChild(t),h.appendChild(document.createElementNS(n,"path")),D.push(h),e.appendChild(document.createElementNS(n,"path")),W.push(e)}let m="chart-series";const p="area"===o||"splinearea"===o;t.Utils.isNullOrEmpty(l.className)||(m+=" "+l.className),[e,h].forEach((t=>{t.setAttribute("class",m),t.setAttribute("x",A.toString()),t.setAttribute("y",P.toString()),t.setAttribute("width",w.toString()),t.setAttribute("height",(S+48).toString())})),t.Utils.addClass(h,t.PCSS+"-inert");let v=h.children.item(1),g=e.firstElementChild;g.style.stroke=l.color,v.style.stroke=g.style.fill="none",this._setGradientColor(d,l.color),v.style.fill=`url(#${d.id})`,v.style.display=p?"":"none";let y="",_=l.values;if(_&&_.length){const o=(t,i,r,s,a)=>{const o=i+1;let l;e.children.length>o?l=e.children.item(o):(l=document.createElementNS(n,"line"),l.setAttribute("class","circle"),e.appendChild(l));const h=t.x.toString(),c=(-t.y).toString();l.setAttribute("x1",h),l.setAttribute("y1",c),l.setAttribute("x2",h),l.setAttribute("y2",c),l.style.stroke=a,this.assignUiBehaviors(l,r,s,a)},h=()=>{const t=l.datapoints?_.length+1:1;for(let r=e.children.length-1;r>=t;r--){var i=e.children.item(r);this.disposeUiBehaviors(i),i.remove()}};if(T){let e,n,h;for(let c=0;c<_.length;c++){const d=_[c];if(isNaN(d.value))continue;let u;n||(n=L(d,_)),T&&c<_.length-1&&(u=L(_[c+1],_));let m=r(l,a,0);m+=d.value,s(l,a,m);var B=i(n,e,u);y+=t.Utils.isNullOrEmpty(y)?`M${n.x},${-n.y} `:`C${h.x},${-h.y} ${B.c0.x},${-B.c0.y} ${n.x},${-n.y} `,l.datapoints&&o(n,c,l,d,l.color),e=n,n=u,h=B.c1}}else{let e=0;for(let i of _){if(isNaN(i.value))continue;const n=L(i,_);let h=r(l,a,0);h+=i.value,s(l,a,h),y+=t.Utils.isNullOrEmpty(y)?`M${n.x},${-n.y} `:`L${n.x},${-n.y} `,l.datapoints&&o(n,e,l,i,l.color),e++}}h()}g.setAttribute("d",y),v.setAttribute("d",y+`V${-u*k} H0 Z`),M++}this._wipe(D,M),this._wipe(W,M);const H=`0 ${-(m*k+$)} ${100*g} ${100+2*$}`;for(var I of W.concat(D))I.setAttribute("viewBox",H);let V,G=this.chartMask.children.item(1);if(G.setAttribute("x",(0).toString()),G.setAttribute("height",(h.height-l).toString()),O.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`),_.x.length<=1||_.y.length<=1){for(let t=O.children.length-1;t>=0;t--)O.children.item(t).remove();return}O.children.length>0?V=O.children.item(0):(V=document.createElementNS(n,"path"),O.appendChild(V));let z=0,F=(t,e,i,r)=>{const s=t+1;let a;return O.children.length<=s?(a=document.createElementNS(n,"text"),O.appendChild(a)):a=O.children.item(s),a.textContent=r,a.setAttribute("x",e.toString()),a.setAttribute("y",i.toString()),a},R=`M${A},24 v${N}`,Y=0;const q=w/(_.x.length-1),J=N/(_.y.length-1);if("none"!==this.xAxisPosition)for(var j of _.x){const t=A+Y*q;if("top"===this.xAxisPosition){R+=` M${t},24 v-6`;let e=F(z++,t,0,j);e.setAttribute("text-anchor","middle"),e.setAttribute("alignment-baseline","hanging")}else{let e=N+l;R+=` M${t},${e} v6`,F(z++,t,e+l,j).setAttribute("text-anchor","middle")}Y++}for(var X of(Y=0,_.y)){const t=N+l-Y*J,e=A-6;R+=` M${e},${t} H${w+A}`,F(z++,e-6,t,this.formatYAxisLabel(X)).setAttribute("text-anchor","end"),Y++}V.setAttribute("d",R);for(let t=O.children.length-1;t>z;t--)O.children.item(t).remove()}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],o.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],o.prototype,"aspectRatio",void 0),o=__decorate([t.CustomElement({tagName:t.P+"-chart"})],o),e.PacemChartElement=o}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(i){let r=class PacemPieSliceElement extends e.PacemItemElement{constructor(){super(...arguments),this._broadcastHandler=t=>{this.emit(t)}}findContainer(){return t.CustomElementUtils.findAncestorOfType(this,n)}get chart(){return this.container}getCenterOfMass(){const e=this.chart&&this.chart.area;if(t.Utils.isNull(e))return null;const i=t.Utils.offset(e),r=i.width/2+i.left,s=i.top+i.height/2,n=.5*Math.min(i.width,i.height),o=this.normalizedPolarCoords,l=a-o.angle;return{y:s-n*o.radius*Math.sin(l),x:r+n*o.radius*Math.cos(l)}}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),!r&&this.chart&&"normalizedPolarCoords"!=t&&this.chart.draw()}_assignUi(t){const e=this._ui=t;i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}_disposeUi(){t.Utils.isNull(this._ui)||i.MANAGED_EVENTS.forEach((t=>{this._ui.removeEventListener(t,this._broadcastHandler)}))}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"value",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"label",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"color",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Json})],r.prototype,"normalizedPolarCoords",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-pie-slice"})],r),i.PacemPieSliceElement=r;const s=2*Math.PI,a=.5*Math.PI;let n=class PacemPieChartElement extends e.PacemItemsContainerElement{constructor(){super(),this.cutout=0,this.slicePadding=0,this._slices=new WeakMap,this._key=t.Utils.uniqueCode()}validate(t){return t instanceof r}viewActivatedCallback(){super.viewActivatedCallback(),this.draw()}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._g=null,this._div&&this._div.remove();const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this.draw()}else s||"cutout"!==e&&"items"!==e&&"slicePadding"!==e||this.draw()}get area(){return this._svg}disconnectedCallback(){this._div&&this._div.remove(),super.disconnectedCallback()}_ensureArea(){if(t.Utils.isNull(this._g)){let e=this.target||(this._div=document.createElement("div"));e.classList.add(t.PCSS+"-chart-area");let i=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("pacem",""),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.setAttribute("viewBox","0 0 100 100"),i.classList.add(t.PCSS+"-pie-chart");let r=document.createElementNS("http://www.w3.org/2000/svg","defs"),s=this._g=document.createElementNS("http://www.w3.org/2000/svg","g");i.appendChild(r),i.appendChild(s),e.appendChild(i),this._div&&this.parentElement.insertBefore(e,this)}if(this.maskBasedRendering){if(t.Utils.isNull(this._mask)){let t=document.createElementNS("http://www.w3.org/2000/svg","mask");t.id="pie_mask_"+this._key;let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x","0"),e.setAttribute("y","0"),e.setAttribute("width","100"),e.setAttribute("height","100"),e.setAttribute("fill","#fff");let i=this._mask=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx","50"),i.setAttribute("cy","50");const r=this._svg.firstElementChild;t.appendChild(e),t.appendChild(i),r.appendChild(t),this._g.setAttribute("mask",`url(#${t.id})`)}const e=50*this._safeCutout;this._mask.setAttribute("r",`${e}`)}else t.Utils.isNull(this._mask)||(this._svg.firstElementChild.innerHTML="",this._mask=null,this._g.removeAttribute("mask"));const e=this._safeSlicePaddingPixels;if(e>0){const i=(e/this._svg.getCTM().a).roundoff(),r=this._sliceMaskId,s=this._svg.firstElementChild;let a=s.querySelector(`#${r}`);t.Utils.isNull(a)?(a=document.createElementNS("http://www.w3.org/2000/svg","mask"),a.id=r,s.appendChild(a)):a.innerHTML="";const n=document.createElementNS("http://www.w3.org/2000/svg","path"),o=`M${50+i},0 H100 V100 H0 V0 H50 V50 h${i} Z`;n.setAttribute("d",o),n.setAttribute("fill","#fff"),a.appendChild(n)}return this._g}get _sliceMaskId(){return"pieslice_mask_"+this._key}get _safeCutout(){return Math.min(1,Math.max(0,this.cutout))||0}get _safeSlicePaddingPixels(){return Math.max(0,this.slicePadding??0)}_drawSlice(t,e,i,r){const a=e.value>.5*i?1:0,n=s*e.value/i,o=360*r/i,l=e.value>=i?49.9:50*(1+Math.sin(n)),h=50*(1-Math.cos(n)),c=this._safeCutout,d=50*c;t.style.fill=e.color,t.style.transform=`rotate(${o}deg)`,t.style.transformOrigin="50% 50%";const u=this.maskBasedRendering?`M50,50 V0 A50,50 0 ${a} 1 ${l} ${h} L50,50 Z`:`M50,0 A50,50 0 ${a} 1 ${l} ${h} l${(50-l)*(1-c)},${(50-h)*(1-c)} A${d},${d} 0 ${a} 0 50,${50-d} Z`;t.setAttribute("d",u),e.normalizedPolarCoords={radius:c+Math.SQRT1_2*(1-c),angle:Math.PI*o/180+n/2}}_isSliceOk(t){return!t.disabled}_padSlice(t){this._safeSlicePaddingPixels>0?t.setAttribute("mask",`url(#${this._sliceMaskId})`):t.removeAttribute("mask")}draw(){const e=this._ensureArea(),i=e.children.length,r=this._svg.parentElement;let s=0,a=0,n=0;if(t.Utils.isNullOrEmpty(this.items))e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else{t.Utils.addClass(r,"chart-has-data");for(let t of this.items)this._isSliceOk(t)&&(a+=t.value);if(a<=0)e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else for(let r of this.items){if(!this._isSliceOk(r))continue;let o;if(s>=i){const i=document.createElementNS("http://www.w3.org/2000/svg","g");i.setAttribute("class","chart-series "+t.PCSS+"-pie-slice"+(t.Utils.isNullOrEmpty(r.className)?"":" "+r.className)),o=document.createElementNS("http://www.w3.org/2000/svg","path"),i.appendChild(o),e.appendChild(i),r._assignUi(i),this._slices.set(i,r)}else o=e.children.item(s).firstElementChild;r.value>0?(this._drawSlice(o,r,a,n),this._padSlice(o),n+=r.value,o.removeAttribute("display")):o.setAttribute("display","none"),s++}}for(;s<e.children.length;){const t=this._slices,i=e.children.item(s);t.has(i)&&(t.get(i)._disposeUi(),t.delete(i)),e.removeChild(i)}}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],n.prototype,"cutout",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Element})],n.prototype,"target",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Boolean})],n.prototype,"maskBasedRendering",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],n.prototype,"slicePadding",void 0),__decorate([t.Debounce(!0)],n.prototype,"draw",null),n=__decorate([t.CustomElement({tagName:t.P+"-pie-chart"})],n),i.PacemPieChartElement=n}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={}));
|
package/dist/js/pacem-cms.d.ts
CHANGED
package/dist/js/pacem-cms.js
CHANGED
package/dist/js/pacem-cms.min.js
CHANGED
package/dist/js/pacem-core.d.ts
CHANGED
package/dist/js/pacem-core.js
CHANGED
package/dist/js/pacem-fx.d.ts
CHANGED
package/dist/js/pacem-fx.js
CHANGED
package/dist/js/pacem-fx.min.js
CHANGED
package/dist/js/pacem-logging.js
CHANGED
package/dist/js/pacem-maps.d.ts
CHANGED
package/dist/js/pacem-maps.js
CHANGED
package/dist/js/pacem-media.d.ts
CHANGED
package/dist/js/pacem-media.js
CHANGED
package/dist/js/pacem-plus.d.ts
CHANGED
package/dist/js/pacem-plus.js
CHANGED
package/dist/js/pacem-ui.d.ts
CHANGED
package/dist/js/pacem-ui.js
CHANGED
package/dist/js/pacem-ui.min.js
CHANGED
package/package.json
CHANGED