UNPKG

graphdb-workbench

Version:
2 lines 6.58 kB
export const __webpack_esm_id__=86670;export const __webpack_esm_ids__=[8642,86670];export const __webpack_esm_modules__={8642(t,e,r){r.d(e,{h:()=>o});var a=r(18301);class o{static get DEFAULT_MULTIPLIER(){return 1.2}static get MAXIMUM_DIVISIONS(){return 10}static get COLORS(){return[o.cssVar("--gw-secondary-base"),o.cssVar("--gw-primary-base"),o.cssVar("--gw-tertiary-base"),o.cssVar("--gw-neutral-base")]}static get AREA_BAR_OPACITY(){return.5}static cssVar(t){return getComputedStyle(document.documentElement).getPropertyValue(t)}constructor(t,e,r,a){this.filter=a,this.disableRangeUpdate=e,this.disableOldDataRemoval=r,this.translateService=t,this.refreshHandlers=[],this.initialChartSetup()}registerRefreshHandler(t){this.refreshHandlers.push(t)}unregisterRefreshHandler(t){const e=this.refreshHandlers.indexOf(t);e>-1&&this.refreshHandlers.splice(e,1)}initialChartSetup(t=!0){this.range=150,this.chartOptions=this.getDefaultChartOptions(this.translateService),t&&(this.dataHolder=this.createDataHolder(),this.chartOptions.series=this.dataHolder,this.firstLoad=!0),this.chartSetup(this.chartOptions)}refresh(t=!1){t||(this.chartSetup(this.chartOptions),this.updateRange(this.dataHolder)),this.refreshHandlers.forEach(t=>t(this.chartOptions))}setSubTitle(t,e=0){this.chartOptions.title.show=!0;let r="";t.forEach((a,o)=>{if(Array.isArray(a.value)&&!a.value.length)return;const l=Array.isArray(a.value)?a.value.join("/"):a.value;r+=`{a|${a.label}}`,void 0!==l&&(r+=`{b|${l}}`),o+1<t.length&&(r+=e>0&&(o+1)%e===0?"\n":"{a| · }")}),this.chartOptions.title.text=r}chartSetup(t){}createDataHolder(){throw new Error("Must implement data holder creation")}addData(t,e){this.removeOldData(this.dataHolder,this.range),this.addNewData(this.dataHolder,t,e,this.isFirstLoad()),this.hasSelectedSeries()&&(this.updateRange(this.dataHolder),this.firstLoad&&(this.firstLoad=!1),this.refresh(!0))}hasSelectedSeries(){return!this.selectedSeries||Object.values(this.selectedSeries).some(t=>!0===t)}removeOldData(t,e){this.disableOldDataRemoval||t[0].data.length>e&&t.forEach(t=>t.data.shift())}addNewData(t,e,r,a){}setSelectedSeries(t){this.selectedSeries=t}updateRange(t,e){if(this.disableRangeUpdate)return;const[r]=o.calculateMaxChartValueAndDivisions(t,e,this.selectedSeries);this.chartOptions.yAxis.max=r}isFirstLoad(){return this.firstLoad}getDefaultChartOptions(){return{title:{show:!1,text:"",left:"center",textStyle:{overflow:"breakAll",rich:{a:{fontWeight:400,fontSize:14},b:{color:o.cssVar("--gw-secondary-base"),fontWeight:400,fontSize:14}}}},animation:!1,color:o.COLORS,legend:{right:"15%",top:"6%",textStyle:{overflow:"truncate"},icon:"circle"},tooltip:{trigger:"axis",axisPointer:{animation:!1,label:{formatter:function(t){return a.kB.format(t.value,"{HH}:{mm}:{ss}",!1)}}}},emphasis:{disabled:!0},grid:{containLabel:!0,left:40},xAxis:{type:"time",splitLine:{show:!0},axisLabel:{hideOverlap:!0,padding:8,formatter:{hour:"{bold|{HH}:{mm}}",minute:"{bold|{HH}:{mm}}",second:"{HH}:{mm}:{ss}"},color:o.cssVar("--gw-neutral-dark"),rich:{bold:{fontWeight:500}}}},yAxis:{type:"value",splitLine:{show:!0},axisLabel:{color:o.cssVar("--gw-neutral-dark")},axisTick:{lineStyle:{type:"solid"}}},textStyle:{fontFamily:o.cssVar("--main-font"),fontWeight:400},backgroundColor:o.cssVar("--gw-default-background")}}static getMaxValueFromDataHolder(t,e){const r=t.filter(t=>!e||angular.isUndefined(e[t.name])||!0===e[t.name]).map(t=>o.getMaxValueForDataSeries(t));return Math.max(1,...r)}static getMaxValueForDataSeries(t){return Math.max(...t.data.map(t=>t.value[1]))}static calculateMaxChartValueAndDivisions(t,e,r){let a;a=Array.isArray(t)?o.getMaxValueFromDataHolder(t,r):o.getMaxValueForDataSeries(t);const l=Math.ceil(a*(e||o.DEFAULT_MULTIPLIER))||1;return[l,Math.ceil(l/o.MAXIMUM_DIVISIONS)]}static getIntegerRangeForValues(t,e,r){const[a,l]=o.calculateMaxChartValueAndDivisions(t,e,r);return[a,l]}static formatBytesValue(t,e,r){let a=t;e&&(a=o.getMaxValueFromDataHolder(e,r));const l=Math.floor(Math.log(a)/Math.log(1024));return`${(parseFloat(t)/Math.pow(1024,l)).toFixed(2)} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][l]}`}formatNumber(t){if(!angular.isUndefined(t)&&this.filter)return this.filter("currency")(t,"",0)}}},86670(t,e,r){r.d(e,{R:()=>l});var a=r(18301),o=r(8642);class l{static LIGHT_THEME="gwLight";static DARK_THEME="gwDark";static initThemes(){const t=l.getGwDarkTheme(),e=l.getGwLightTheme();a.bf(l.DARK_THEME,t),a.bf(l.LIGHT_THEME,e)}static getGwLightTheme(){return{tooltip:{backgroundColor:`color-mix(in srgb, ${o.h.cssVar("--gw-tooltip-background")}, transparent 10%)`,textStyle:{color:o.h.cssVar("--gw-tooltip-color")},borderWidth:0}}}static getGwDarkTheme(){return{...l.getEchartsDarkTheme(),tooltip:{backgroundColor:`color-mix(in srgb, ${o.h.cssVar("--gw-tooltip-background")}, transparent 10%)`,textStyle:{color:o.h.cssVar("--gw-tooltip-color")},borderWidth:0}}}static getEchartsDarkTheme(){const t="#B9B8CE",e="#100C2A",r=function(){return{axisLine:{lineStyle:{color:t}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},a=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],o={darkMode:!0,color:a,backgroundColor:e,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:t}},textStyle:{color:t},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:t}},dataZoom:{borderColor:"#71708A",textStyle:{color:t},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:t}},timeline:{lineStyle:{color:t},label:{color:t},controlStyle:{color:t,borderColor:t}},calendar:{itemStyle:{color:e},dayLabel:{color:t},monthLabel:{color:t},yearLabel:{color:t}},timeAxis:r(),logAxis:r(),valueAxis:r(),categoryAxis:r(),line:{symbol:"circle"},graph:{color:a},gauge:{title:{color:t}},candlestick:{itemStyle:{color:"#FD1050",color0:"#0CF49B",borderColor:"#FD1050",borderColor0:"#0CF49B"}}};return o.categoryAxis.splitLine.show=!1,o}}}}; //# sourceMappingURL=86670.24678e931b7dd1ff7ead.bundle.js.map