@perses-dev/timeseries-chart-plugin 0.9.0 → 0.9.1
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/__mf/js/{983.b0368f8f.js → 983.9bbeba19.js} +1 -1
- package/__mf/js/{TimeSeriesChart.33363c77.js → TimeSeriesChart.63488d0a.js} +2 -2
- package/__mf/js/async/{409.b4cabab7.js → 409.2808c63e.js} +1 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.cb3d3f05.js +1 -0
- package/__mf/js/{main.beef92ec.js → main.cca17449.js} +1 -1
- package/lib/TimeSeriesChartBase.d.ts.map +1 -1
- package/lib/TimeSeriesChartBase.js +2 -2
- package/lib/TimeSeriesChartBase.js.map +1 -1
- package/lib/cjs/TimeSeriesChartBase.js +2 -2
- package/mf-manifest.json +6 -6
- package/mf-stats.json +6 -6
- package/package.json +1 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.1e16af77.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[]).push([["966"],{81481:function(e,t,l){l.r(t),l.d(t,{TimeSeriesChart:()=>eb});let n={unit:"decimal",shortValues:!0},i={show:!0,label:"",format:n,min:void 0,max:void 0},a="Label",o="Min",r="Max",s={lineWidth:1.25,areaOpacity:0,pointRadius:2.75,connectNulls:!1},d="Line Width",u="slider-line-width",c=.25,h=3,p=.25,v="Area Opacity",m="slider-area-opacity",g=0,y=1,x=.05,f="Stack Series",b="Connect Nulls",C={none:{label:"None"},all:{label:"All"}},j=Object.entries(C).map(e=>{let[t,l]=e;return{id:t,...l}});var S=l(24246),M=l(48565),w=l(75586),E=l(72629),O=l(58891),T=l(5404),I=l(98346),Z=l(71377),A=l(87895);function D(e){let{value:t,onChange:l}=e,n=t.stack??"none",i=C[n];return(0,S.jsxs)(E.OptionsEditorGroup,{title:"Visual",children:[(0,S.jsx)(E.OptionsEditorControl,{label:"Display",control:(0,S.jsxs)(T.Z,{color:"primary",exclusive:!0,value:t.display,onChange:(e,n)=>{l({...t,display:n})},children:[(0,S.jsx)(I.Z,{value:"line",selected:void 0===t.display||"line"===t.display,"aria-label":"display line series",children:"Line"}),(0,S.jsx)(I.Z,{value:"bar","aria-label":"display bar series",children:"Bar"})]})}),(0,S.jsx)(E.OptionsEditorControl,{label:d,control:(0,S.jsx)(Z.ZP,{"data-testid":u,value:t.lineWidth??1.25,valueLabelDisplay:"auto",step:p,marks:!0,min:c,max:h,disabled:"bar"===t.display,onChange:(e,n)=>{let i=Array.isArray(n)?n[0]:n,a=void 0!==i?i+1.5:2.75;l((0,w.Uy)(t,e=>{e.lineWidth=i,e.pointRadius=a}))}})}),(0,S.jsx)(E.OptionsEditorControl,{label:v,control:(0,S.jsx)(Z.ZP,{"data-testid":m,value:t.areaOpacity??0,valueLabelDisplay:"auto",step:x,marks:!0,min:g,max:y,disabled:"bar"===t.display,onChange:(e,n)=>{let i=Array.isArray(n)?n[0]:n;l((0,w.Uy)(t,e=>{e.areaOpacity=i}))}})}),(0,S.jsx)(E.OptionsEditorControl,{label:f,control:(0,S.jsx)(E.SettingsAutocomplete,{value:{...i,id:n},options:j,onChange:(e,n)=>{let i={...t,stack:"none"===n.id?void 0:n.id};"all"!==n.id||t.areaOpacity||(i.areaOpacity=.3),l(i)},disabled:void 0===t,disableClearable:!0})}),(0,S.jsx)(E.OptionsEditorControl,{label:b,control:(0,S.jsx)(A.Z,{checked:t.connectNulls??!1,disabled:"bar"===t.display,onChange:e=>{l({...t,connectNulls:e.target.checked})}})})]})}var L=l(8695);function N(e){let{value:t,onChange:l}=e;return(0,S.jsxs)(E.OptionsEditorGroup,{title:"Y Axis",children:[(0,S.jsx)(E.OptionsEditorControl,{label:"Show",control:(0,S.jsx)(A.Z,{checked:t.show??i.show,onChange:e=>{l({...t,show:e.target.checked})}})}),(0,S.jsx)(E.FormatControls,{value:t.format??n,onChange:e=>l({...t,format:e})}),(0,S.jsx)(E.OptionsEditorControl,{label:a,control:(0,S.jsx)(L.Z,{value:t.label??"",inputProps:{"aria-label":"enter y axis label"},onChange:e=>l({...t,label:e.target.value}),placeholder:"Default"})}),(0,S.jsx)(E.OptionsEditorControl,{label:o,control:(0,S.jsx)(L.Z,{type:"number",value:t.min??"",onChange:e=>{let n=e.target.value?Number(e.target.value):void 0;l({...t,min:n})},placeholder:"Default"})}),(0,S.jsx)(E.OptionsEditorControl,{label:r,control:(0,S.jsx)(L.Z,{type:"number",value:t.max??"",onChange:e=>{let n=e.target.value?Number(e.target.value):void 0;l({...t,max:n})},placeholder:"Default"})})]})}var k=l(75094),P=l(52054),U=l(25283),q=l(10517),R=l(54538),_=l(22446),F=l(33755);function G(e){let{querySettingsList:t,onChange:l}=e,n=(0,R.useRef)(null),i=(0,R.useRef)(!1);(0,R.useEffect)(()=>{var e;n.current&&i.current&&(null===(e=n.current)||void 0===e||e.focus(),i.current=!1)},[null==t?void 0:t.length]);let a=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{let l=null==t?void 0:t[n];l&&(l.queryIndex=parseInt(e.target.value))}))},o=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{if(void 0!==t){let l=t[n];l&&(l.colorMode=e.target.value)}}))},r=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{if(void 0!==t){let l=t[n];l&&(l.colorValue=e)}}))},s=e=>{void 0!==t&&l((0,w.Uy)(t,t=>{t.splice(e,1)}))},d=(0,O.useQueryCountContext)(),u=(0,R.useMemo)(()=>{let e=(null==t?void 0:t.map(e=>e.queryIndex))??[];return Array.from({length:d},(e,t)=>t).filter((t,l)=>!e.includes(l))},[t,d]),c=(0,R.useMemo)(()=>u[0]??-1,[u]),h={queryIndex:c,colorMode:"fixed",colorValue:"#555"};return(0,S.jsx)(E.OptionsEditorGroup,{title:"Query settings",icon:-1!==c?(0,S.jsx)(E.InfoTooltip,{description:"Add query settings",children:(0,S.jsx)(k.Z,{size:"small","aria-label":"add query settings",onClick:()=>{i.current=!0,void 0===t?l([h]):l((0,w.Uy)(t,e=>{e.push(h)}))},children:(0,S.jsx)(F.default,{})})}):null,children:t&&t.length>0?t.map((e,l)=>(0,S.jsx)($,{inputRef:l===t.length-1?n:void 0,querySettings:e,availableQueryIndexes:u,onQueryIndexChange:e=>{a(e,l)},onColorModeChange:e=>o(e,l),onColorValueChange:e=>r(e,l),onDelete:()=>{s(l)}},l)):(0,S.jsx)(P.Z,{mb:2,fontStyle:"italic",children:"No query settings defined"})})}function $(e){let{querySettings:{queryIndex:t,colorMode:l,colorValue:n},availableQueryIndexes:i,onQueryIndexChange:a,onColorModeChange:o,onColorValueChange:r,onDelete:s,inputRef:d}=e,u=i.concat(t).sort((e,t)=>e-t);return(0,S.jsxs)(U.Z,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,S.jsx)(L.Z,{select:!0,inputRef:d,value:t,label:"Query",onChange:a,sx:{minWidth:"75px"},children:u.map(e=>(0,S.jsxs)(q.Z,{value:e,children:["#",e+1]},`query-${e}`))}),(0,S.jsxs)(L.Z,{select:!0,value:l,fullWidth:!0,label:"Color mode",onChange:o,children:[(0,S.jsx)(q.Z,{value:"fixed-single",children:"Fixed (single)"}),(0,S.jsx)(q.Z,{value:"fixed",children:"Fixed"})]}),(0,S.jsx)(E.OptionsColorPicker,{label:"Query n\xb0"+t,color:n,onColorChange:r}),(0,S.jsx)(k.Z,{"aria-label":`delete settings for query n\xb0${t+1}`,size:"small",onClick:s,children:(0,S.jsx)(_.default,{})})]})}var V=l(94776),H=l(36372),W=l(15409),z=l.n(W),Q=l(8193),Y=l(14046),B=l(69481),X=l(74664);function K(e){let t=Math.floor(Math.log10(Math.abs(e)));return Math.floor(e/Math.pow(10,t))*Math.pow(10,t)}var J=l(83915);let ee=new J.Z({hue:{min:20,max:360}}),et=new J.Z({hue:{min:0,max:20}}),el={};var en=l(56141),ei=l.n(en),ea=l(4665),eo=l(36232),er=l(44811),es=l(508),ed=l(65201),eu=l(99635),ec=l(48906),eh=l(98857),ep=l(219),ev=l(17846),em=l(23709),eg=l(55328),ey=l(67745),ex=l(50378);(0,eo.D)([er.N,es.N,ed.N,eu.N,ec.N,eh.N,ep.N,ev.N,em.N,eg.N,ey.N,ex.N]);let ef=(0,R.forwardRef)(function(e,t){var l;let n,{height:i,data:a,seriesMapping:o,timeScale:r,yAxis:s,format:d,grid:u,isStackedBar:c=!1,tooltipConfig:h=E.DEFAULT_TOOLTIP_CONFIG,noDataVariant:p="message",syncGroup:v,onDataZoom:m,onDoubleClick:g,__experimentalEChartsOptionsOverride:y}=e,{chartsTheme:x,enablePinning:f,enableSyncGrouping:b,lastTooltipPinnedCoords:C,setLastTooltipPinnedCoords:j}=(0,E.useChartsContext)(),M=h.enablePinning&&f,w=(0,R.useRef)(),[O,T]=(0,R.useState)(!0),[I,Z]=(0,R.useState)(null),[A,D]=(0,R.useState)(null),[L,N]=(0,R.useState)(!1),[k,P]=(0,R.useState)(0),{timeZone:U}=(0,E.useTimeZone)();if(void 0===r){let e=(0,B.C5)(a);if(void 0===e){let e=new Date,t=new Date(e);t.setFullYear(e.getFullYear()-5);let l=e.getTime(),i=t.getTime();n={startMs:i,endMs:l,stepMs:1,rangeMs:l-i}}else n=e}else n=r;(0,R.useImperativeHandle)(t,()=>({highlightSeries(e){let{name:t}=e;w.current&&w.current.dispatchAction({type:"highlight",seriesId:t})},clearHighlightedSeries:()=>{w.current&&(0,E.clearHighlightedSeries)(w.current)}}),[]);let q=(0,R.useMemo)(()=>({datazoom:e=>{if(void 0===m&&setTimeout(()=>{Z(null)},10),void 0===m||void 0===e.batch[0])return;let t=e.batch[0].startValue,l=e.batch[0].endValue;void 0!==t&&void 0!==l&&m({start:t,end:l})},finished:()=>{void 0!==w.current&&(0,E.enableDataZoom)(w.current)}}),[m,Z]),{noDataOption:_}=x,F=(0,R.useMemo)(()=>{if(null===a||0===a.length&&"message"===p)return _;let e=[],t="local"===U;a.map((l,n)=>{let i=l.values.map(e=>{let[l,n]=e;return[t?l:(0,ea.toZonedTime)(l,U),null===n?"-":n]});e.push({id:n,source:[...i],dimensions:["time","value"]})});let l={dataset:e,series:f&&null!==A?[...o,A]:o,xAxis:{type:"time",min:t?n.startMs:(0,ea.toZonedTime)(n.startMs,U),max:t?n.endMs:(0,ea.toZonedTime)(n.endMs,U),axisLabel:{hideOverlap:!0,formatter:(0,E.getFormattedAxisLabel)(n.rangeMs??0)},axisPointer:{snap:!1}},yAxis:(0,E.getFormattedAxis)(s,d),animation:!1,tooltip:{show:!0,showContent:c,trigger:c?"item":"axis",appendToBody:c},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!1},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:u};return y?y(l):l},[a,o,n,s,d,u,_,y,p,U,c,f,A]);return(0,R.useEffect)(()=>{null===I||null===C||ei()(C,I)||(Z(null),null!==I&&null!==A&&D(null))},[C,o]),(0,S.jsxs)(H.Z,{style:{height:i},onClick:e=>{let t=e.ctrlKey||e.metaKey;t&&e.preventDefault();let l=(0,E.getPointInGrid)(e.nativeEvent.offsetX,e.nativeEvent.offsetY,w.current);if(null!==l&&M&&e.target instanceof HTMLCanvasElement){let n={page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target};Z(e=>null===e?n:(D(null),null)),D(e=>{if(null!==e)return null;{var t;let e=l[0],n=null===(t=a[0])||void 0===t?void 0:t.values,i=(0,E.getClosestTimestamp)(n,e);return z()({},E.DEFAULT_PINNED_CROSSHAIR,{markLine:{data:[{xAxis:i}]}})}}),t||j(n)}},onMouseDown:e=>{let{clientX:t}=e;N(!0),P(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;L&&t-k>0&&T(!1)},onMouseUp:()=>{N(!1),P(0),T(!0)},onMouseLeave:()=>{null===I&&T(!1),void 0!==w.current&&(0,E.clearHighlightedSeries)(w.current)},onMouseEnter:()=>{T(!0),void 0!==w.current&&(0,E.enableDataZoom)(w.current)},onDoubleClick:e=>{Z(null),void 0===g?void 0!==w.current&&(0,E.restoreChart)(w.current):g(e)},children:[!0===O&&(null===(l=F.tooltip)||void 0===l?void 0:l.showContent)===!1&&!0!==h.hidden&&(0,S.jsx)(E.TimeChartTooltip,{containerId:x.tooltipPortalContainerId,chartRef:w,data:a,seriesMapping:o,wrapLabels:h.wrapLabels,enablePinning:M,pinnedPos:I,format:d,onUnpinClick:()=>{Z(null),D(null)}}),(0,S.jsx)(E.EChart,{sx:{width:"100%",height:"100%"},option:F,theme:x.echartsTheme,onEvents:q,_instance:w,syncGroup:b?v:void 0})]})}),eb={PanelComponent:function(e){var t;let{spec:{thresholds:l,yAxis:a,tooltip:o,querySettings:r},contentDimensions:d,queryResults:u}=e,c=(0,E.useChartsTheme)(),h=(0,V.Z)(),p=(0,E.useId)("time-series-panel"),v=(0,R.useRef)(null),m=c.echartsTheme.color,g=c.container.padding.default,y=d?{width:d.width-2*g,height:d.height-2*g}:void 0,x=(0,R.useMemo)(()=>e.spec.legend&&(0,O.validateLegendSpec)(e.spec.legend)?z()({},Q.zx,e.spec.legend):void 0,[e.spec.legend]),f=(null===(t=e.spec.yAxis)||void 0===t?void 0:t.format)??n,b=(0,R.useMemo)(()=>z()({},s,e.spec.visual),[e.spec.visual]),C=(0,R.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={show:!0,axisLabel:{show:(null==e?void 0:e.show)??i.show},min:null==e?void 0:e.min,max:null==e?void 0:e.max};return(null==e?void 0:e.min)===void 0&&(t.min=e=>e.min>=0&&e.min<=1?0:e.min>0?K(.8*e.min):K(1.2*e.min)),t})(a),[a]),[j,M]=(0,R.useState)("ALL"),[w,T]=(0,R.useState)(),{setTimeRange:I}=(0,O.useTimeRange)(),{timeScale:Z,timeChartData:A,timeSeriesMapping:D,legendItems:L}=(0,R.useMemo)(()=>{let e=function(e){let t=e.map(e=>e.data);return(0,B.C5)(t)}(u);if(void 0===e)return{timeChartData:[],timeSeriesMapping:[]};let t=[],n=[],i=[],o=0;for(let l=0;l<u.length;l++){let a;let c=u[l];for(let e of r??[])e.queryIndex===l&&(a=e);if(c)for(let r=0;r<c.data.series.length;r++){var s,d,v;let g=c.data.series[r];if(void 0===g)return{timeChartData:[],timeSeriesMapping:[],legendItems:[]};let y=g.formattedName??g.name,f=function(e){var t;let{categoricalPalette:l,visual:n,muiPrimaryColor:i,seriesName:a,seriesIndex:o,querySettings:r,queryHasMultipleResults:s}=e;if(r&&("fixed"===r.colorMode||"fixed-single"===r.colorMode&&!s))return r.colorValue;let d=Array.isArray(l)&&l[0]?l[0]:i;return(null===(t=n.palette)||void 0===t?void 0:t.mode)==="categorical"?function(e,t,l){if(void 0===e)return l;let n=e.length??1;return e[t%n]??l}(l,o,d):function(e,t){var l;return function(e,t){let l=`${e}_____${t}`,n=el[l];return n||(n=function(e,t){let[l,n,i]=t?et.hsl(e):ee.hsl(e),a=`${(100*n).toFixed(0)}%`,o=`${(100*i).toFixed(0)}%`;return`hsla(${l.toFixed(2)},${a},${o},0.9)`}(e,t),el[l]=n),n}(l=e,l.toLowerCase().includes("error"))??t}(a,d)}({categoricalPalette:m,visual:b,muiPrimaryColor:h.palette.primary.main,seriesName:y,seriesIndex:o,querySettings:a,queryHasMultipleResults:((null===(v=u[l])||void 0===v?void 0:null===(d=v.data)||void 0===d?void 0:null===(s=d.series)||void 0===s?void 0:s.length)??0)>1}),C=p+g.name+o,S=(null==x?void 0:x.values)?(0,Y.Dc)(g.values,x.values):void 0,M="ALL"===j;if(!M&&j[C]||M){let t=n.length;i.push(function(e,t,l,n,i,a){let o=n.lineWidth??1.25,r=n.pointRadius??2.75,s=i.rangeMs<=9e5;return("always"===n.showPoints&&(s=!0),"bar"===n.display)?{type:"bar",id:e,datasetIndex:t,name:l,color:a,stack:"all"===n.stack?n.stack:void 0,label:{show:!1}}:{type:"line",id:e,datasetIndex:t,name:l,connectNulls:n.connectNulls??!1,color:a,stack:"all"===n.stack?n.stack:void 0,sampling:"lttb",progressiveThreshold:E.OPTIMIZED_MODE_SERIES_LIMIT,showSymbol:s,showAllSymbol:!0,symbolSize:r,lineStyle:{width:o,opacity:.95},areaStyle:{opacity:n.areaOpacity??0},emphasis:{focus:"series",disabled:void 0!==n.areaOpacity&&n.areaOpacity>0,lineStyle:{width:o+1,opacity:1}},selectedMode:"single",select:{itemStyle:{borderColor:a,borderWidth:r+.5}},blur:{lineStyle:{width:o,opacity:.5}}}}(C,t,y,b,e,f)),n.push({name:y,values:(0,B.m6)(g,e)})}x&&t&&t.push({id:C,label:y,color:f,data:S}),o++}}if(l&&l.steps){let t=c.thresholds,r=l.defaultColor??t.defaultColor;l.steps.forEach((s,d)=>{let u=t.palette[d]??r,c={color:s.color??u,value:"percent"===l.mode?function(e,t,l,n){var i,a;let o;let r=l??(o=0,(i=t).length&&void 0!==i[0]&&(null===(a=i[0])||void 0===a?void 0:a.values)?i.forEach(e=>{e.values.forEach(e=>{let[t,l]=e;"number"==typeof l&&l>o&&(o=l)})}):i.forEach(e=>{void 0!==e.data&&e.data.forEach(e=>{"number"==typeof e&&e>o&&(o=e)})}),o),s=n??0;return e/100*(r-s)+s}(s.value,n,null==a?void 0:a.max,null==a?void 0:a.min):s.value},h=s.name??`Threshold ${d+1}`,p=[],v=e.startMs;for(;v<=e.endMs;)p.push([v,c.value]),v+=15e3;n.push({name:h,values:p}),i.push({type:"line",name:h,id:h,datasetId:h,datasetIndex:o,color:c.color,label:{show:!1},lineStyle:{type:"dashed",width:2},emphasis:{focus:"series",lineStyle:{width:2.5}},blur:{lineStyle:{opacity:.5}}}),o++})}return{timeScale:e,timeChartData:n,timeSeriesMapping:i,legendItems:t}},[u,l,j,x,b,r,null==a?void 0:a.max,null==a?void 0:a.min,m,p,c.thresholds,h.palette.primary.main]),N=(0,R.useMemo)(()=>(null==x?void 0:x.values)?O.legendValues.reduce((e,t)=>{var l;let n=O.LEGEND_VALUE_CONFIG[t];return n&&(null==x?void 0:null===(l=x.values)||void 0===l?void 0:l.includes(t))&&e.push({accessorKey:`data.${t}`,header:n.label,headerDescription:n.description,width:72,align:"right",cell:e=>{let{getValue:t}=e,l=t();return"number"==typeof l&&f?(0,X.Bw)(l,f):l},cellDescription:!0,enableSorting:!0}),e},[]):[],[null==x?void 0:x.values,f]);if(void 0===y)return null;let k=a&&a.label?30:20,P={left:C.show?k:0,right:20,bottom:0},U=e=>{I({start:new Date(e.start),end:new Date(e.end)})},q="bar"===b.display&&"all"===b.stack,_=!0;q?_=!1:(null==o?void 0:o.enablePinning)!==void 0&&(_=o.enablePinning);let F={...E.DEFAULT_TOOLTIP_CONFIG,enablePinning:_};return(0,S.jsx)(H.Z,{sx:{padding:`${g}px`},children:(0,S.jsx)(E.ContentWithLegend,{width:y.width,height:y.height,minChildrenHeight:50,legendSize:null==x?void 0:x.size,legendProps:x&&{options:x,data:L||[],selectedItems:j,onSelectedItemsChange:M,tableProps:{columns:N,sorting:w,onSortingChange:T},onItemMouseOver:(e,t)=>{var l;let{id:n}=t;null===(l=v.current)||void 0===l||l.highlightSeries({name:n})},onItemMouseOut:()=>{var e;null===(e=v.current)||void 0===e||e.clearHighlightedSeries()}},children:e=>{let{height:t,width:l}=e;return(0,S.jsxs)(H.Z,{style:{height:t,width:l},children:[a&&a.show&&a.label&&(0,S.jsx)(E.YAxisLabel,{name:a.label,height:t}),(0,S.jsx)(ef,{ref:v,height:t,data:A,seriesMapping:D,timeScale:Z,yAxis:C,format:f,grid:P,isStackedBar:q,tooltipConfig:F,syncGroup:"default-panel-group",onDataZoom:U,noDataVariant:!A.length&&L&&L.length>0?"chart":"message"})]})}})})},supportedQueryTypes:["TimeSeriesQuery"],panelOptionsEditorComponents:[{label:"Settings",content:function(e){let{onChange:t,value:l}=e;return(0,S.jsxs)(E.OptionsEditorGrid,{children:[(0,S.jsxs)(E.OptionsEditorColumn,{children:[(0,S.jsx)(O.LegendOptionsEditor,{value:l.legend,onChange:e=>{t((0,w.Uy)(l,t=>{t.legend=e}))}}),(0,S.jsx)(D,{value:l.visual??s,onChange:e=>{t((0,w.Uy)(l,t=>{t.visual=e}))}})]}),(0,S.jsx)(E.OptionsEditorColumn,{children:(0,S.jsx)(N,{value:l.yAxis??i,onChange:e=>{t((0,w.Uy)(l,t=>{t.yAxis=e}))}})}),(0,S.jsxs)(E.OptionsEditorColumn,{children:[(0,S.jsx)(E.ThresholdsEditor,{hideDefault:!0,thresholds:l.thresholds,onChange:e=>{t((0,w.Uy)(l,t=>{t.thresholds=e}))}}),(0,S.jsx)(G,{querySettingsList:l.querySettings,onChange:e=>{t((0,w.Uy)(l,t=>{t.querySettings=e}))}}),(0,S.jsx)(E.OptionsEditorGroup,{title:"Reset Settings",children:(0,S.jsx)(M.Z,{variant:"outlined",color:"secondary",onClick:()=>{t((0,w.Uy)(l,e=>{e.yAxis=void 0,e.legend=void 0,e.visual=void 0,e.thresholds=void 0,e.querySettings=void 0}))},children:"Reset To Defaults"})})]})]})}}],createInitialOptions:function(){return{}}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={5311:function(e,r,t){Promise.all([t.e("677"),t.e("179"),t.e("620")]).then(t.bind(t,29161))}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var a=r[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}t.m=e,t.c=r,t.federation||(t.federation={chunkMatcher:function(e){return!/^((15|67|98)7|179|242|263|494|759|846)$/.test(e)}}),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce((r,n)=>(t.f[n](e,r),r),[])),t.u=e=>"__mf/js/async/"+("118"===e?"lib-router":e)+"."+({118:"098fc614",171:"598de6a9",173:"f6f7e45b",214:"2d4431c6",223:"def4d0a9",224:"ce414ffb",238:"625b8a48",281:"a2a87c37",292:"311e6eb0",409:"b4cabab7",476:"45fca8d3",620:"d6f96402",651:"80087530",656:"d43503a5",694:"27c70ab1",738:"0a12bb44",740:"67107c3c",75:"5952779d",755:"f76e3538",770:"78a741ab",780:"3fa36115",845:"6d99c354",879:"24def15a",960:"3047096d",964:"6dfbf211",981:"77f901c0"})[e]+".js",t.miniCssF=e=>"__mf/css/async/"+e+"."+({263:"9a1fa3dd",759:"9a1fa3dd"})[e]+".css",t.h=()=>"6695d9cfb101da28",(()=>{t.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})()})(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={},r="TimeSeriesChart:";t.l=function(n,o,a,i){if(e[n]){e[n].push(o);return}if(void 0!==a)for(var s,l,c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var f=c[d];if(f.getAttribute("src")==n||f.getAttribute("data-webpack")==r+a){s=f;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,t.nc&&s.setAttribute("nonce",t.nc),s.setAttribute("data-webpack",r+a),s.src=n),e[n]=[o];var u=function(r,t){s.onerror=s.onload=null,clearTimeout(h);var o=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(function(e){return e(t)}),r)return r(t)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=u.bind(null,s.onerror),s.onload=u.bind(null,s.onload),l&&document.head.appendChild(s)}})(),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),t.nc=void 0,(()=>{var e=[];t.O=(r,n,o,a)=>{if(n){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[n,o,a];return}for(var s=1/0,i=0;i<e.length;i++){for(var[n,o,a]=e[i],l=!0,c=0;c<n.length;c++)(!1&a||s>=a)&&Object.keys(t.O).every(e=>t.O[e](n[c]))?n.splice(c--,1):(l=!1,a<s&&(s=a));if(l){e.splice(i--,1);var d=o();void 0!==d&&(r=d)}}return r}})(),t.p="/plugins/TimeSeriesChart/",t.rv=()=>"1.2.8",t.S={},t.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"@emotion/react",version:"11.14.0",factory:()=>Promise.all([t.e("960"),t.e("677"),t.e("651")]).then(()=>()=>t(96434)),eager:0,singleton:1,requiredVersion:"^11.11.3"},{name:"@emotion/styled",version:"11.14.0",factory:()=>Promise.all([t.e("677"),t.e("157"),t.e("694")]).then(()=>()=>t(51958)),eager:0,singleton:1},{name:"@hookform/resolvers",version:"3.10.0",factory:()=>Promise.all([t.e("292"),t.e("677"),t.e("214")]).then(()=>()=>t(81228)),eager:0,singleton:1},{name:"@perses-dev/components",version:"0.51.0-rc.1",factory:()=>Promise.all([t.e("238"),t.e("224"),t.e("292"),t.e("281"),t.e("755"),t.e("476"),t.e("171"),t.e("780"),t.e("879"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("759")]).then(()=>()=>t(46289)),eager:0,singleton:1},{name:"@perses-dev/plugin-system",version:"0.51.0-rc.1",factory:()=>Promise.all([t.e("118"),t.e("292"),t.e("755"),t.e("780"),t.e("845"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("242"),t.e("656")]).then(()=>()=>t(3090)),eager:0,singleton:1},{name:"date-fns",version:"4.1.0",factory:()=>Promise.all([t.e("238"),t.e("224"),t.e("75")]).then(()=>()=>t(99657)),eager:0,singleton:1},{name:"echarts",version:"5.5.0",factory:()=>Promise.all([t.e("281"),t.e("476"),t.e("223"),t.e("409")]).then(()=>()=>t(71932)),eager:0,singleton:1},{name:"lodash",version:"4.17.21",factory:()=>t.e("981").then(()=>()=>t(98784)),eager:0,singleton:1},{name:"react-dom",version:"18.3.1",factory:()=>Promise.all([t.e("173"),t.e("677")]).then(()=>()=>t(31542)),eager:0,singleton:1,requiredVersion:"18.2.0"},{name:"react",version:"18.3.1",factory:()=>t.e("964").then(()=>()=>t(27378)),eager:0,singleton:1,requiredVersion:"18.2.0"}]},uniqueName:"TimeSeriesChart"},t.I=t.I||function(){throw Error("should have __webpack_require__.I")},t.consumesLoadingData={chunkMapping:{846:["45913","4665"],494:["57871"],987:["20461"],179:["6085"],242:["20370","74614","30156","57751","55922","71141","84275"],157:["72116"],677:["54538"]},moduleIdToConsumeDataMapping:{45913:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"^11.3.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("770").then(()=>()=>t(51958))},57751:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(3090)},71141:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"0.51.0-rc.1",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(3090)},30156:{shareScope:"default",shareKey:"echarts",import:"echarts",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("281"),t.e("476"),t.e("223"),t.e("409")]).then(()=>()=>t(71932))},6085:{shareScope:"default",shareKey:"react-dom",import:"react-dom",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("173").then(()=>()=>t(31542))},72116:{shareScope:"default",shareKey:"@emotion/react",import:"@emotion/react",requiredVersion:"^11.11.3",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("960").then(()=>()=>t(96434))},57871:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^3.0.0 || ^4.0.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("75")]).then(()=>()=>t(99657))},20370:{shareScope:"default",shareKey:"@perses-dev/components",import:"@perses-dev/components",requiredVersion:"0.51.0-rc.1",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("224"),t.e("281"),t.e("476"),t.e("171"),t.e("879"),t.e("263")]).then(()=>()=>t(46289))},74614:{shareScope:"default",shareKey:"lodash",import:"lodash",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("981").then(()=>()=>t(98784))},4665:{shareScope:"default",shareKey:"date-fns-tz",import:"date-fns-tz",requiredVersion:"^3.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("224"),t.e("740"),t.e("494")]).then(()=>()=>t(48872))},54538:{shareScope:"default",shareKey:"react",import:"react",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("964").then(()=>()=>t(27378))},55922:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("770").then(()=>()=>t(51958))},84275:{shareScope:"default",shareKey:"@hookform/resolvers",import:"@hookform/resolvers",requiredVersion:"^2.0.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("738").then(()=>()=>t(81228))},20461:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^4.1.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("224"),t.e("75")]).then(()=>()=>t(99657))}},initialConsumes:[]},t.f.consumes=t.f.consumes||function(){throw Error("should have __webpack_require__.f.consumes")},(()=>{if("undefined"!=typeof document){var e=function(e,r,n,o,a){var i=document.createElement("link");return i.rel="stylesheet",i.type="text/css",t.nc&&(i.nonce=t.nc),i.onerror=i.onload=function(t){if(i.onerror=i.onload=null,"load"===t.type)o();else{var n=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.href||r,l=Error("Loading CSS chunk "+e+" failed.\\n("+s+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=n,l.request=s,i.parentNode&&i.parentNode.removeChild(i),a(l)}},i.href=r,n?n.parentNode.insertBefore(i,n.nextSibling):document.head.appendChild(i),i},r=function(e,r){for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var o=t[n],a=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(a===e||a===r))return o}for(var i=document.getElementsByTagName("style"),n=0;n<i.length;n++){var o=i[n],a=o.getAttribute("data-href");if(a===e||a===r)return o}},n={909:0};t.f.miniCss=function(o,a){if(n[o])a.push(n[o]);else if(0!==n[o]&&({263:1,759:1})[o])a.push(n[o]=new Promise(function(n,a){var i=t.miniCssF(o),s=t.p+i;if(r(i,s))return n();e(o,s,null,n,a)}).then(function(){n[o]=0},function(e){throw delete n[o],e}))}}})(),(()=>{var e={909:0};t.f.j=function(r,n){var o=t.o(e,r)?e[r]:void 0;if(0!==o){if(o)n.push(o[2]);else if(/^((15|67|98)7|179|242|263|494|759|846)$/.test(r))e[r]=0;else{var a=new Promise((t,n)=>o=e[r]=[t,n]);n.push(o[2]=a);var i=t.p+t.u(r),s=Error();t.l(i,function(n){if(t.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+r,r)}}},t.O.j=r=>0===e[r];var r=(r,n)=>{var o,a,[i,s,l]=n,c=0;if(i.some(r=>0!==e[r])){for(o in s)t.o(s,o)&&(t.m[o]=s[o]);if(l)var d=l(t)}for(r&&r(n);c<i.length;c++)a=i[c],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(d)},n=self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),t.ruid="bundler=rspack@1.2.8",t.O(void 0,["983"],function(){return t(89067)});var n=t.O(void 0,["983"],function(){return t(5311)});n=t.O(n)})();
|
|
1
|
+
(()=>{var e={5311:function(e,r,t){Promise.all([t.e("677"),t.e("179"),t.e("620")]).then(t.bind(t,29161))}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var a=r[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}t.m=e,t.c=r,t.federation||(t.federation={chunkMatcher:function(e){return!/^((15|67|98)7|179|242|263|494|759|846)$/.test(e)}}),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce((r,n)=>(t.f[n](e,r),r),[])),t.u=e=>"__mf/js/async/"+("118"===e?"lib-router":e)+"."+({118:"098fc614",171:"598de6a9",173:"f6f7e45b",214:"2d4431c6",223:"def4d0a9",224:"ce414ffb",238:"625b8a48",281:"a2a87c37",292:"311e6eb0",409:"2808c63e",476:"45fca8d3",620:"d6f96402",651:"80087530",656:"d43503a5",694:"27c70ab1",738:"0a12bb44",740:"67107c3c",75:"5952779d",755:"f76e3538",770:"78a741ab",780:"3fa36115",845:"6d99c354",879:"24def15a",960:"3047096d",964:"6dfbf211",981:"77f901c0"})[e]+".js",t.miniCssF=e=>"__mf/css/async/"+e+"."+({263:"9a1fa3dd",759:"9a1fa3dd"})[e]+".css",t.h=()=>"a0fdf5177dd035a4",(()=>{t.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})()})(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={},r="TimeSeriesChart:";t.l=function(n,o,a,i){if(e[n]){e[n].push(o);return}if(void 0!==a)for(var s,l,c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var f=c[d];if(f.getAttribute("src")==n||f.getAttribute("data-webpack")==r+a){s=f;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,t.nc&&s.setAttribute("nonce",t.nc),s.setAttribute("data-webpack",r+a),s.src=n),e[n]=[o];var u=function(r,t){s.onerror=s.onload=null,clearTimeout(h);var o=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(function(e){return e(t)}),r)return r(t)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=u.bind(null,s.onerror),s.onload=u.bind(null,s.onload),l&&document.head.appendChild(s)}})(),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),t.nc=void 0,(()=>{var e=[];t.O=(r,n,o,a)=>{if(n){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[n,o,a];return}for(var s=1/0,i=0;i<e.length;i++){for(var[n,o,a]=e[i],l=!0,c=0;c<n.length;c++)(!1&a||s>=a)&&Object.keys(t.O).every(e=>t.O[e](n[c]))?n.splice(c--,1):(l=!1,a<s&&(s=a));if(l){e.splice(i--,1);var d=o();void 0!==d&&(r=d)}}return r}})(),t.p="/plugins/TimeSeriesChart/",t.rv=()=>"1.2.8",t.S={},t.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"@emotion/react",version:"11.14.0",factory:()=>Promise.all([t.e("960"),t.e("677"),t.e("651")]).then(()=>()=>t(96434)),eager:0,singleton:1,requiredVersion:"^11.11.3"},{name:"@emotion/styled",version:"11.14.0",factory:()=>Promise.all([t.e("677"),t.e("157"),t.e("694")]).then(()=>()=>t(51958)),eager:0,singleton:1},{name:"@hookform/resolvers",version:"3.10.0",factory:()=>Promise.all([t.e("292"),t.e("677"),t.e("214")]).then(()=>()=>t(81228)),eager:0,singleton:1},{name:"@perses-dev/components",version:"0.51.0-rc.1",factory:()=>Promise.all([t.e("238"),t.e("224"),t.e("292"),t.e("281"),t.e("755"),t.e("476"),t.e("171"),t.e("780"),t.e("879"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("759")]).then(()=>()=>t(46289)),eager:0,singleton:1},{name:"@perses-dev/plugin-system",version:"0.51.0-rc.1",factory:()=>Promise.all([t.e("118"),t.e("292"),t.e("755"),t.e("780"),t.e("845"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("242"),t.e("656")]).then(()=>()=>t(3090)),eager:0,singleton:1},{name:"date-fns",version:"4.1.0",factory:()=>Promise.all([t.e("238"),t.e("224"),t.e("75")]).then(()=>()=>t(99657)),eager:0,singleton:1},{name:"echarts",version:"5.5.0",factory:()=>Promise.all([t.e("281"),t.e("476"),t.e("223"),t.e("409")]).then(()=>()=>t(71932)),eager:0,singleton:1},{name:"lodash",version:"4.17.21",factory:()=>t.e("981").then(()=>()=>t(98784)),eager:0,singleton:1},{name:"react-dom",version:"18.3.1",factory:()=>Promise.all([t.e("173"),t.e("677")]).then(()=>()=>t(31542)),eager:0,singleton:1,requiredVersion:"18.2.0"},{name:"react",version:"18.3.1",factory:()=>t.e("964").then(()=>()=>t(27378)),eager:0,singleton:1,requiredVersion:"18.2.0"}]},uniqueName:"TimeSeriesChart"},t.I=t.I||function(){throw Error("should have __webpack_require__.I")},t.consumesLoadingData={chunkMapping:{846:["45913","4665"],494:["57871"],987:["20461"],179:["6085"],242:["20370","74614","30156","57751","55922","71141","84275"],157:["72116"],677:["54538"]},moduleIdToConsumeDataMapping:{45913:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"^11.3.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("770").then(()=>()=>t(51958))},57751:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(3090)},71141:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"0.51.0-rc.1",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(3090)},30156:{shareScope:"default",shareKey:"echarts",import:"echarts",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("281"),t.e("476"),t.e("223"),t.e("409")]).then(()=>()=>t(71932))},6085:{shareScope:"default",shareKey:"react-dom",import:"react-dom",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("173").then(()=>()=>t(31542))},72116:{shareScope:"default",shareKey:"@emotion/react",import:"@emotion/react",requiredVersion:"^11.11.3",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("960").then(()=>()=>t(96434))},57871:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^3.0.0 || ^4.0.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("75")]).then(()=>()=>t(99657))},20370:{shareScope:"default",shareKey:"@perses-dev/components",import:"@perses-dev/components",requiredVersion:"0.51.0-rc.1",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("224"),t.e("281"),t.e("476"),t.e("171"),t.e("879"),t.e("263")]).then(()=>()=>t(46289))},74614:{shareScope:"default",shareKey:"lodash",import:"lodash",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("981").then(()=>()=>t(98784))},4665:{shareScope:"default",shareKey:"date-fns-tz",import:"date-fns-tz",requiredVersion:"^3.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("224"),t.e("740"),t.e("494")]).then(()=>()=>t(48872))},54538:{shareScope:"default",shareKey:"react",import:"react",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("964").then(()=>()=>t(27378))},55922:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("770").then(()=>()=>t(51958))},84275:{shareScope:"default",shareKey:"@hookform/resolvers",import:"@hookform/resolvers",requiredVersion:"^2.0.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("738").then(()=>()=>t(81228))},20461:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^4.1.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("224"),t.e("75")]).then(()=>()=>t(99657))}},initialConsumes:[]},t.f.consumes=t.f.consumes||function(){throw Error("should have __webpack_require__.f.consumes")},(()=>{if("undefined"!=typeof document){var e=function(e,r,n,o,a){var i=document.createElement("link");return i.rel="stylesheet",i.type="text/css",t.nc&&(i.nonce=t.nc),i.onerror=i.onload=function(t){if(i.onerror=i.onload=null,"load"===t.type)o();else{var n=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.href||r,l=Error("Loading CSS chunk "+e+" failed.\\n("+s+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=n,l.request=s,i.parentNode&&i.parentNode.removeChild(i),a(l)}},i.href=r,n?n.parentNode.insertBefore(i,n.nextSibling):document.head.appendChild(i),i},r=function(e,r){for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var o=t[n],a=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(a===e||a===r))return o}for(var i=document.getElementsByTagName("style"),n=0;n<i.length;n++){var o=i[n],a=o.getAttribute("data-href");if(a===e||a===r)return o}},n={909:0};t.f.miniCss=function(o,a){if(n[o])a.push(n[o]);else if(0!==n[o]&&({263:1,759:1})[o])a.push(n[o]=new Promise(function(n,a){var i=t.miniCssF(o),s=t.p+i;if(r(i,s))return n();e(o,s,null,n,a)}).then(function(){n[o]=0},function(e){throw delete n[o],e}))}}})(),(()=>{var e={909:0};t.f.j=function(r,n){var o=t.o(e,r)?e[r]:void 0;if(0!==o){if(o)n.push(o[2]);else if(/^((15|67|98)7|179|242|263|494|759|846)$/.test(r))e[r]=0;else{var a=new Promise((t,n)=>o=e[r]=[t,n]);n.push(o[2]=a);var i=t.p+t.u(r),s=Error();t.l(i,function(n){if(t.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+r,r)}}},t.O.j=r=>0===e[r];var r=(r,n)=>{var o,a,[i,s,l]=n,c=0;if(i.some(r=>0!==e[r])){for(o in s)t.o(s,o)&&(t.m[o]=s[o]);if(l)var d=l(t)}for(r&&r(n);c<i.length;c++)a=i[c],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(d)},n=self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),t.ruid="bundler=rspack@1.2.8",t.O(void 0,["983"],function(){return t(89067)});var n=t.O(void 0,["983"],function(){return t(5311)});n=t.O(n)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeriesChartBase.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesChartBase.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,UAAU,EAA6D,MAAM,OAAO,CAAC;AAK1G,OAAO,EAAsB,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EAEnB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAejB,OAAO,EACL,aAAa,EAcb,sBAAsB,EAEtB,aAAa,EAGb,aAAa,EACd,MAAM,wBA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,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,oCAAoC,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,iBAAiB,CAAC;CAC1F;AAED,eAAO,MAAM,mBAAmB,0GA0W9B,CAAC"}
|
|
@@ -37,7 +37,7 @@ use([
|
|
|
37
37
|
CanvasRenderer
|
|
38
38
|
]);
|
|
39
39
|
export const TimeSeriesChartBase = /*#__PURE__*/ forwardRef(function TimeChart({ height, data, seriesMapping, timeScale: timeScaleProp, yAxis, format, grid, isStackedBar = false, tooltipConfig = DEFAULT_TOOLTIP_CONFIG, noDataVariant = 'message', syncGroup, onDataZoom, onDoubleClick, __experimentalEChartsOptionsOverride }, ref) {
|
|
40
|
-
const { chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } = useChartsContext();
|
|
40
|
+
const { chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } = useChartsContext();
|
|
41
41
|
const isPinningEnabled = tooltipConfig.enablePinning && enablePinning;
|
|
42
42
|
const chartRef = useRef();
|
|
43
43
|
const [showTooltip, setShowTooltip] = useState(true);
|
|
@@ -380,7 +380,7 @@ export const TimeSeriesChartBase = /*#__PURE__*/ forwardRef(function TimeChart({
|
|
|
380
380
|
theme: chartsTheme.echartsTheme,
|
|
381
381
|
onEvents: handleEvents,
|
|
382
382
|
_instance: chartRef,
|
|
383
|
-
syncGroup: syncGroup
|
|
383
|
+
syncGroup: enableSyncGrouping ? syncGroup : undefined
|
|
384
384
|
})
|
|
385
385
|
]
|
|
386
386
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesChartBase.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { forwardRef, MouseEvent, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { Box } from '@mui/material';\nimport merge from 'lodash/merge';\nimport isEqual from 'lodash/isEqual';\nimport { toZonedTime } from 'date-fns-tz';\nimport { getCommonTimeScale, TimeScale, FormatOptions, TimeSeries } from '@perses-dev/core';\nimport type {\n EChartsCoreOption,\n GridComponentOption,\n LineSeriesOption,\n YAXisComponentOption,\n TooltipComponentOption,\n} from 'echarts';\nimport { ECharts as EChartsInstance, use } from 'echarts/core';\nimport { LineChart as EChartsLineChart, BarChart as EChartsBarChart } from 'echarts/charts';\nimport {\n GridComponent,\n DatasetComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n ChartInstance,\n ChartInstanceFocusOpts,\n clearHighlightedSeries,\n CursorCoordinates,\n DEFAULT_PINNED_CROSSHAIR,\n DEFAULT_TOOLTIP_CONFIG,\n EChart,\n enableDataZoom,\n getClosestTimestamp,\n getFormattedAxis,\n getFormattedAxisLabel,\n getPointInGrid,\n OnEventsType,\n restoreChart,\n TimeChartSeriesMapping,\n TimeChartTooltip,\n TooltipConfig,\n useChartsContext,\n useTimeZone,\n ZoomEventData,\n} from '@perses-dev/components';\nimport { DatasetOption } from 'echarts/types/dist/shared';\n\nuse([\n EChartsLineChart,\n EChartsBarChart,\n GridComponent,\n DatasetComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n CanvasRenderer,\n]);\n\nexport interface TimeChartProps {\n height: number;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n timeScale?: TimeScale;\n yAxis?: YAXisComponentOption;\n format?: FormatOptions;\n grid?: GridComponentOption;\n tooltipConfig?: TooltipConfig;\n noDataVariant?: 'chart' | 'message';\n syncGroup?: string;\n isStackedBar?: boolean;\n onDataZoom?: (e: ZoomEventData) => void;\n onDoubleClick?: (e: MouseEvent) => void;\n __experimentalEChartsOptionsOverride?: (options: EChartsCoreOption) => EChartsCoreOption;\n}\n\nexport const TimeSeriesChartBase = forwardRef<ChartInstance, TimeChartProps>(function TimeChart(\n {\n height,\n data,\n seriesMapping,\n timeScale: timeScaleProp,\n yAxis,\n format,\n grid,\n isStackedBar = false,\n tooltipConfig = DEFAULT_TOOLTIP_CONFIG,\n noDataVariant = 'message',\n syncGroup,\n onDataZoom,\n onDoubleClick,\n __experimentalEChartsOptionsOverride,\n },\n ref\n) {\n const { chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } = useChartsContext();\n const isPinningEnabled = tooltipConfig.enablePinning && enablePinning;\n const chartRef = useRef<EChartsInstance>();\n const [showTooltip, setShowTooltip] = useState<boolean>(true);\n const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n const [pinnedCrosshair, setPinnedCrosshair] = useState<LineSeriesOption | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n const { timeZone } = useTimeZone();\n let timeScale: TimeScale;\n if (timeScaleProp === undefined) {\n const commonTimeScale = getCommonTimeScale(data);\n if (commonTimeScale === undefined) {\n // set default to past 5 years\n const today = new Date();\n const pastDate = new Date(today);\n pastDate.setFullYear(today.getFullYear() - 5);\n const todayMs = today.getTime();\n const pastDateMs = pastDate.getTime();\n timeScale = { startMs: pastDateMs, endMs: todayMs, stepMs: 1, rangeMs: todayMs - pastDateMs };\n } else {\n timeScale = commonTimeScale;\n }\n } else {\n timeScale = timeScaleProp;\n }\n\n useImperativeHandle(ref, () => {\n return {\n highlightSeries({ name }: ChartInstanceFocusOpts): void {\n if (!chartRef.current) {\n // when chart undef, do not highlight series when hovering over legend\n return;\n }\n\n chartRef.current.dispatchAction({ type: 'highlight', seriesId: name });\n },\n clearHighlightedSeries: (): void => {\n if (!chartRef.current) {\n // when chart undef, do not clear highlight series\n return;\n }\n clearHighlightedSeries(chartRef.current);\n },\n };\n }, []);\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params): void => {\n if (onDataZoom === undefined) {\n setTimeout(() => {\n // workaround so unpin happens after click event\n setTooltipPinnedCoords(null);\n }, 10);\n }\n if (onDataZoom === undefined || params.batch[0] === undefined) return;\n const xAxisStartValue = params.batch[0].startValue;\n const xAxisEndValue = params.batch[0].endValue;\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n };\n onDataZoom(zoomEvent);\n }\n },\n finished: (): void => {\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n },\n };\n }, [onDataZoom, setTooltipPinnedCoords]);\n\n const { noDataOption } = chartsTheme;\n\n const option: EChartsCoreOption = useMemo(() => {\n // The \"chart\" `noDataVariant` is only used when the `timeSeries` is an\n // empty array because a `null` value will throw an error.\n if (data === null || (data.length === 0 && noDataVariant === 'message')) return noDataOption;\n\n // Utilizes ECharts dataset so raw data is separate from series option style properties\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/\n const dataset: DatasetOption[] = [];\n const isLocalTimeZone = timeZone === 'local';\n data.map((d, index) => {\n const values = d.values.map(([timestamp, value]) => {\n const val: string | number = value === null ? '-' : value; // echarts use '-' to represent null data\n return [isLocalTimeZone ? timestamp : toZonedTime(timestamp, timeZone), val];\n });\n dataset.push({ id: index, source: [...values], dimensions: ['time', 'value'] });\n });\n\n const updatedSeriesMapping =\n enablePinning && pinnedCrosshair !== null ? [...seriesMapping, pinnedCrosshair] : seriesMapping;\n\n const option: EChartsCoreOption = {\n dataset: dataset,\n series: updatedSeriesMapping,\n xAxis: {\n type: 'time',\n min: isLocalTimeZone ? timeScale.startMs : toZonedTime(timeScale.startMs, timeZone),\n max: isLocalTimeZone ? timeScale.endMs : toZonedTime(timeScale.endMs, timeZone),\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedAxisLabel(timeScale.rangeMs ?? 0),\n },\n axisPointer: {\n snap: false, // important so shared crosshair does not lag\n },\n },\n yAxis: getFormattedAxis(yAxis, format),\n animation: false,\n tooltip: {\n show: true,\n // ECharts tooltip content hidden by default since we use custom tooltip instead.\n // Stacked bar uses ECharts tooltip so subgroup data shows correctly.\n showContent: isStackedBar,\n trigger: isStackedBar ? 'item' : 'axis',\n appendToBody: isStackedBar,\n },\n // https://echarts.apache.org/en/option.html#axisPointer\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: false, // https://github.com/apache/echarts/issues/18495\n triggerTooltip: false,\n snap: false, // xAxis.axisPointer.snap takes priority\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null, // https://stackoverflow.com/a/67684076/17575201\n yAxisIndex: 'none',\n },\n },\n },\n grid,\n };\n\n if (__experimentalEChartsOptionsOverride) {\n return __experimentalEChartsOptionsOverride(option);\n }\n\n return option;\n }, [\n data,\n seriesMapping,\n timeScale,\n yAxis,\n format,\n grid,\n noDataOption,\n __experimentalEChartsOptionsOverride,\n noDataVariant,\n timeZone,\n isStackedBar,\n enablePinning,\n pinnedCrosshair,\n ]);\n\n // Update adjacent charts so tooltip is unpinned when current chart is clicked.\n useEffect(() => {\n // Only allow pinning one tooltip at a time, subsequent tooltip click unpins previous.\n // Multiple tooltips can only be pinned if Ctrl or Cmd key is pressed while clicking.\n const multipleTooltipsPinned = tooltipPinnedCoords !== null && lastTooltipPinnedCoords !== null;\n if (multipleTooltipsPinned) {\n if (!isEqual(lastTooltipPinnedCoords, tooltipPinnedCoords)) {\n setTooltipPinnedCoords(null);\n if (tooltipPinnedCoords !== null && pinnedCrosshair !== null) {\n setPinnedCrosshair(null);\n }\n }\n }\n // tooltipPinnedCoords CANNOT be in dep array or tooltip pinning breaks in the current chart's onClick\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [lastTooltipPinnedCoords, seriesMapping]);\n\n return (\n <Box\n style={{ height }}\n // onContextMenu={(e) => {\n // // TODO: confirm tooltip pinning works correctly on Windows, should e.preventDefault() be added here\n // e.preventDefault(); // Prevent the default behaviour when right clicked\n // }}\n onClick={(e) => {\n // Allows user to opt-in to multi tooltip pinning when Ctrl or Cmd key held down\n const isControlKeyPressed = e.ctrlKey || e.metaKey;\n if (isControlKeyPressed) {\n e.preventDefault();\n }\n\n // Determine where on chart canvas to plot pinned crosshair as markLine.\n const pointInGrid = getPointInGrid(e.nativeEvent.offsetX, e.nativeEvent.offsetY, chartRef.current);\n if (pointInGrid === null) {\n return;\n }\n\n // Pin and unpin when clicking on chart canvas but not tooltip text.\n if (isPinningEnabled && e.target instanceof HTMLCanvasElement) {\n // Pin tooltip and update shared charts context to remember these coordinates.\n const pinnedPos: CursorCoordinates = {\n page: {\n x: e.pageX,\n y: e.pageY,\n },\n client: {\n x: e.clientX,\n y: e.clientY,\n },\n plotCanvas: {\n x: e.nativeEvent.offsetX,\n y: e.nativeEvent.offsetY,\n },\n target: e.target,\n };\n\n setTooltipPinnedCoords((current) => {\n if (current === null) {\n return pinnedPos;\n } else {\n setPinnedCrosshair(null);\n return null;\n }\n });\n\n setPinnedCrosshair((current) => {\n // Only add pinned crosshair line series when there is not one already in seriesMapping.\n if (current === null) {\n const cursorX = pointInGrid[0];\n\n // Only need to loop through first dataset source since getCommonTimeScale ensures xAxis timestamps are consistent\n const firstTimeSeriesValues = data[0]?.values;\n const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);\n\n // Crosshair snaps to nearest timestamp since cursor may be slightly to left or right\n const pinnedCrosshair = merge({}, DEFAULT_PINNED_CROSSHAIR, {\n markLine: {\n data: [\n {\n xAxis: closestTimestamp,\n },\n ],\n },\n } as LineSeriesOption);\n return pinnedCrosshair;\n } else {\n // Clear previously set pinned crosshair\n return null;\n }\n });\n\n if (!isControlKeyPressed) {\n setLastTooltipPinnedCoords(pinnedPos);\n }\n }\n }}\n onMouseDown={(e) => {\n const { clientX } = e;\n setIsDragging(true);\n setStartX(clientX);\n }}\n onMouseMove={(e) => {\n // Allow clicking inside tooltip to copy labels.\n if (!(e.target instanceof HTMLCanvasElement)) {\n return;\n }\n const { clientX } = e;\n if (isDragging) {\n const deltaX = clientX - startX;\n if (deltaX > 0) {\n // Hide tooltip when user drags to zoom.\n setShowTooltip(false);\n }\n }\n }}\n onMouseUp={() => {\n setIsDragging(false);\n setStartX(0);\n setShowTooltip(true);\n }}\n onMouseLeave={() => {\n if (tooltipPinnedCoords === null) {\n setShowTooltip(false);\n }\n if (chartRef.current !== undefined) {\n clearHighlightedSeries(chartRef.current);\n }\n }}\n onMouseEnter={() => {\n setShowTooltip(true);\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n onDoubleClick={(e) => {\n setTooltipPinnedCoords(null);\n // either dispatch ECharts restore action to return to orig state or allow consumer to define behavior\n if (onDoubleClick === undefined) {\n if (chartRef.current !== undefined) {\n restoreChart(chartRef.current);\n }\n } else {\n onDoubleClick(e);\n }\n }}\n >\n {/* Allows overrides prop to hide custom tooltip and use the ECharts option.tooltip instead */}\n {showTooltip === true &&\n (option.tooltip as TooltipComponentOption)?.showContent === false &&\n tooltipConfig.hidden !== true && (\n <TimeChartTooltip\n containerId={chartsTheme.tooltipPortalContainerId}\n chartRef={chartRef}\n data={data}\n seriesMapping={seriesMapping}\n wrapLabels={tooltipConfig.wrapLabels}\n enablePinning={isPinningEnabled}\n pinnedPos={tooltipPinnedCoords}\n format={format}\n onUnpinClick={() => {\n // Unpins tooltip when clicking Pin icon in TooltipHeader.\n setTooltipPinnedCoords(null);\n // Clear previously set pinned crosshair.\n setPinnedCrosshair(null);\n }}\n />\n )}\n <EChart\n sx={{\n width: '100%',\n height: '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n syncGroup={syncGroup}\n />\n </Box>\n );\n});\n"],"names":["forwardRef","useEffect","useImperativeHandle","useMemo","useRef","useState","Box","merge","isEqual","toZonedTime","getCommonTimeScale","use","LineChart","EChartsLineChart","BarChart","EChartsBarChart","GridComponent","DatasetComponent","DataZoomComponent","MarkAreaComponent","MarkLineComponent","MarkPointComponent","TitleComponent","ToolboxComponent","TooltipComponent","CanvasRenderer","clearHighlightedSeries","DEFAULT_PINNED_CROSSHAIR","DEFAULT_TOOLTIP_CONFIG","EChart","enableDataZoom","getClosestTimestamp","getFormattedAxis","getFormattedAxisLabel","getPointInGrid","restoreChart","TimeChartTooltip","useChartsContext","useTimeZone","TimeSeriesChartBase","TimeChart","height","data","seriesMapping","timeScale","timeScaleProp","yAxis","format","grid","isStackedBar","tooltipConfig","noDataVariant","syncGroup","onDataZoom","onDoubleClick","__experimentalEChartsOptionsOverride","ref","chartsTheme","enablePinning","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","isPinningEnabled","chartRef","showTooltip","setShowTooltip","tooltipPinnedCoords","setTooltipPinnedCoords","pinnedCrosshair","setPinnedCrosshair","isDragging","setIsDragging","startX","setStartX","timeZone","undefined","commonTimeScale","today","Date","pastDate","setFullYear","getFullYear","todayMs","getTime","pastDateMs","startMs","endMs","stepMs","rangeMs","highlightSeries","name","current","dispatchAction","type","seriesId","handleEvents","datazoom","params","setTimeout","batch","xAxisStartValue","startValue","xAxisEndValue","endValue","zoomEvent","start","end","finished","noDataOption","option","length","dataset","isLocalTimeZone","map","d","index","values","timestamp","value","val","push","id","source","dimensions","updatedSeriesMapping","series","xAxis","min","max","axisLabel","hideOverlap","formatter","axisPointer","snap","animation","tooltip","show","showContent","trigger","appendToBody","z","triggerEmphasis","triggerTooltip","toolbox","feature","dataZoom","icon","yAxisIndex","multipleTooltipsPinned","style","onClick","e","isControlKeyPressed","ctrlKey","metaKey","preventDefault","pointInGrid","nativeEvent","offsetX","offsetY","target","HTMLCanvasElement","pinnedPos","page","x","pageX","y","pageY","client","clientX","clientY","plotCanvas","cursorX","firstTimeSeriesValues","closestTimestamp","markLine","onMouseDown","onMouseMove","deltaX","onMouseUp","onMouseLeave","onMouseEnter","hidden","containerId","tooltipPortalContainerId","wrapLabels","onUnpinClick","sx","width","theme","echartsTheme","onEvents","_instance"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,EAAcC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC1G,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,WAAW,eAAe;AACjC,OAAOC,aAAa,iBAAiB;AACrC,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,kBAAkB,QAA8C,mBAAmB;AAQ5F,SAAqCC,GAAG,QAAQ,eAAe;AAC/D,SAASC,aAAaC,gBAAgB,EAAEC,YAAYC,eAAe,QAAQ,iBAAiB;AAC5F,SACEC,aAAa,EACbC,gBAAgB,EAChB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YAAYoI,YAAY;gBAC/BC,UAAUhG;gBACViG,WAAWjI;gBACXV,WAAWA;;;;AAInB,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesChartBase.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { forwardRef, MouseEvent, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { Box } from '@mui/material';\nimport merge from 'lodash/merge';\nimport isEqual from 'lodash/isEqual';\nimport { toZonedTime } from 'date-fns-tz';\nimport { getCommonTimeScale, TimeScale, FormatOptions, TimeSeries } from '@perses-dev/core';\nimport type {\n EChartsCoreOption,\n GridComponentOption,\n LineSeriesOption,\n YAXisComponentOption,\n TooltipComponentOption,\n} from 'echarts';\nimport { ECharts as EChartsInstance, use } from 'echarts/core';\nimport { LineChart as EChartsLineChart, BarChart as EChartsBarChart } from 'echarts/charts';\nimport {\n GridComponent,\n DatasetComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n ChartInstance,\n ChartInstanceFocusOpts,\n clearHighlightedSeries,\n CursorCoordinates,\n DEFAULT_PINNED_CROSSHAIR,\n DEFAULT_TOOLTIP_CONFIG,\n EChart,\n enableDataZoom,\n getClosestTimestamp,\n getFormattedAxis,\n getFormattedAxisLabel,\n getPointInGrid,\n OnEventsType,\n restoreChart,\n TimeChartSeriesMapping,\n TimeChartTooltip,\n TooltipConfig,\n useChartsContext,\n useTimeZone,\n ZoomEventData,\n} from '@perses-dev/components';\nimport { DatasetOption } from 'echarts/types/dist/shared';\n\nuse([\n EChartsLineChart,\n EChartsBarChart,\n GridComponent,\n DatasetComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n CanvasRenderer,\n]);\n\nexport interface TimeChartProps {\n height: number;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n timeScale?: TimeScale;\n yAxis?: YAXisComponentOption;\n format?: FormatOptions;\n grid?: GridComponentOption;\n tooltipConfig?: TooltipConfig;\n noDataVariant?: 'chart' | 'message';\n syncGroup?: string;\n isStackedBar?: boolean;\n onDataZoom?: (e: ZoomEventData) => void;\n onDoubleClick?: (e: MouseEvent) => void;\n __experimentalEChartsOptionsOverride?: (options: EChartsCoreOption) => EChartsCoreOption;\n}\n\nexport const TimeSeriesChartBase = forwardRef<ChartInstance, TimeChartProps>(function TimeChart(\n {\n height,\n data,\n seriesMapping,\n timeScale: timeScaleProp,\n yAxis,\n format,\n grid,\n isStackedBar = false,\n tooltipConfig = DEFAULT_TOOLTIP_CONFIG,\n noDataVariant = 'message',\n syncGroup,\n onDataZoom,\n onDoubleClick,\n __experimentalEChartsOptionsOverride,\n },\n ref\n) {\n const { chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } =\n useChartsContext();\n const isPinningEnabled = tooltipConfig.enablePinning && enablePinning;\n const chartRef = useRef<EChartsInstance>();\n const [showTooltip, setShowTooltip] = useState<boolean>(true);\n const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n const [pinnedCrosshair, setPinnedCrosshair] = useState<LineSeriesOption | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n const { timeZone } = useTimeZone();\n let timeScale: TimeScale;\n if (timeScaleProp === undefined) {\n const commonTimeScale = getCommonTimeScale(data);\n if (commonTimeScale === undefined) {\n // set default to past 5 years\n const today = new Date();\n const pastDate = new Date(today);\n pastDate.setFullYear(today.getFullYear() - 5);\n const todayMs = today.getTime();\n const pastDateMs = pastDate.getTime();\n timeScale = { startMs: pastDateMs, endMs: todayMs, stepMs: 1, rangeMs: todayMs - pastDateMs };\n } else {\n timeScale = commonTimeScale;\n }\n } else {\n timeScale = timeScaleProp;\n }\n\n useImperativeHandle(ref, () => {\n return {\n highlightSeries({ name }: ChartInstanceFocusOpts): void {\n if (!chartRef.current) {\n // when chart undef, do not highlight series when hovering over legend\n return;\n }\n\n chartRef.current.dispatchAction({ type: 'highlight', seriesId: name });\n },\n clearHighlightedSeries: (): void => {\n if (!chartRef.current) {\n // when chart undef, do not clear highlight series\n return;\n }\n clearHighlightedSeries(chartRef.current);\n },\n };\n }, []);\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params): void => {\n if (onDataZoom === undefined) {\n setTimeout(() => {\n // workaround so unpin happens after click event\n setTooltipPinnedCoords(null);\n }, 10);\n }\n if (onDataZoom === undefined || params.batch[0] === undefined) return;\n const xAxisStartValue = params.batch[0].startValue;\n const xAxisEndValue = params.batch[0].endValue;\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n };\n onDataZoom(zoomEvent);\n }\n },\n finished: (): void => {\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n },\n };\n }, [onDataZoom, setTooltipPinnedCoords]);\n\n const { noDataOption } = chartsTheme;\n\n const option: EChartsCoreOption = useMemo(() => {\n // The \"chart\" `noDataVariant` is only used when the `timeSeries` is an\n // empty array because a `null` value will throw an error.\n if (data === null || (data.length === 0 && noDataVariant === 'message')) return noDataOption;\n\n // Utilizes ECharts dataset so raw data is separate from series option style properties\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/\n const dataset: DatasetOption[] = [];\n const isLocalTimeZone = timeZone === 'local';\n data.map((d, index) => {\n const values = d.values.map(([timestamp, value]) => {\n const val: string | number = value === null ? '-' : value; // echarts use '-' to represent null data\n return [isLocalTimeZone ? timestamp : toZonedTime(timestamp, timeZone), val];\n });\n dataset.push({ id: index, source: [...values], dimensions: ['time', 'value'] });\n });\n\n const updatedSeriesMapping =\n enablePinning && pinnedCrosshair !== null ? [...seriesMapping, pinnedCrosshair] : seriesMapping;\n\n const option: EChartsCoreOption = {\n dataset: dataset,\n series: updatedSeriesMapping,\n xAxis: {\n type: 'time',\n min: isLocalTimeZone ? timeScale.startMs : toZonedTime(timeScale.startMs, timeZone),\n max: isLocalTimeZone ? timeScale.endMs : toZonedTime(timeScale.endMs, timeZone),\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedAxisLabel(timeScale.rangeMs ?? 0),\n },\n axisPointer: {\n snap: false, // important so shared crosshair does not lag\n },\n },\n yAxis: getFormattedAxis(yAxis, format),\n animation: false,\n tooltip: {\n show: true,\n // ECharts tooltip content hidden by default since we use custom tooltip instead.\n // Stacked bar uses ECharts tooltip so subgroup data shows correctly.\n showContent: isStackedBar,\n trigger: isStackedBar ? 'item' : 'axis',\n appendToBody: isStackedBar,\n },\n // https://echarts.apache.org/en/option.html#axisPointer\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: false, // https://github.com/apache/echarts/issues/18495\n triggerTooltip: false,\n snap: false, // xAxis.axisPointer.snap takes priority\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null, // https://stackoverflow.com/a/67684076/17575201\n yAxisIndex: 'none',\n },\n },\n },\n grid,\n };\n\n if (__experimentalEChartsOptionsOverride) {\n return __experimentalEChartsOptionsOverride(option);\n }\n\n return option;\n }, [\n data,\n seriesMapping,\n timeScale,\n yAxis,\n format,\n grid,\n noDataOption,\n __experimentalEChartsOptionsOverride,\n noDataVariant,\n timeZone,\n isStackedBar,\n enablePinning,\n pinnedCrosshair,\n ]);\n\n // Update adjacent charts so tooltip is unpinned when current chart is clicked.\n useEffect(() => {\n // Only allow pinning one tooltip at a time, subsequent tooltip click unpins previous.\n // Multiple tooltips can only be pinned if Ctrl or Cmd key is pressed while clicking.\n const multipleTooltipsPinned = tooltipPinnedCoords !== null && lastTooltipPinnedCoords !== null;\n if (multipleTooltipsPinned) {\n if (!isEqual(lastTooltipPinnedCoords, tooltipPinnedCoords)) {\n setTooltipPinnedCoords(null);\n if (tooltipPinnedCoords !== null && pinnedCrosshair !== null) {\n setPinnedCrosshair(null);\n }\n }\n }\n // tooltipPinnedCoords CANNOT be in dep array or tooltip pinning breaks in the current chart's onClick\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [lastTooltipPinnedCoords, seriesMapping]);\n\n return (\n <Box\n style={{ height }}\n // onContextMenu={(e) => {\n // // TODO: confirm tooltip pinning works correctly on Windows, should e.preventDefault() be added here\n // e.preventDefault(); // Prevent the default behaviour when right clicked\n // }}\n onClick={(e) => {\n // Allows user to opt-in to multi tooltip pinning when Ctrl or Cmd key held down\n const isControlKeyPressed = e.ctrlKey || e.metaKey;\n if (isControlKeyPressed) {\n e.preventDefault();\n }\n\n // Determine where on chart canvas to plot pinned crosshair as markLine.\n const pointInGrid = getPointInGrid(e.nativeEvent.offsetX, e.nativeEvent.offsetY, chartRef.current);\n if (pointInGrid === null) {\n return;\n }\n\n // Pin and unpin when clicking on chart canvas but not tooltip text.\n if (isPinningEnabled && e.target instanceof HTMLCanvasElement) {\n // Pin tooltip and update shared charts context to remember these coordinates.\n const pinnedPos: CursorCoordinates = {\n page: {\n x: e.pageX,\n y: e.pageY,\n },\n client: {\n x: e.clientX,\n y: e.clientY,\n },\n plotCanvas: {\n x: e.nativeEvent.offsetX,\n y: e.nativeEvent.offsetY,\n },\n target: e.target,\n };\n\n setTooltipPinnedCoords((current) => {\n if (current === null) {\n return pinnedPos;\n } else {\n setPinnedCrosshair(null);\n return null;\n }\n });\n\n setPinnedCrosshair((current) => {\n // Only add pinned crosshair line series when there is not one already in seriesMapping.\n if (current === null) {\n const cursorX = pointInGrid[0];\n\n // Only need to loop through first dataset source since getCommonTimeScale ensures xAxis timestamps are consistent\n const firstTimeSeriesValues = data[0]?.values;\n const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);\n\n // Crosshair snaps to nearest timestamp since cursor may be slightly to left or right\n const pinnedCrosshair = merge({}, DEFAULT_PINNED_CROSSHAIR, {\n markLine: {\n data: [\n {\n xAxis: closestTimestamp,\n },\n ],\n },\n } as LineSeriesOption);\n return pinnedCrosshair;\n } else {\n // Clear previously set pinned crosshair\n return null;\n }\n });\n\n if (!isControlKeyPressed) {\n setLastTooltipPinnedCoords(pinnedPos);\n }\n }\n }}\n onMouseDown={(e) => {\n const { clientX } = e;\n setIsDragging(true);\n setStartX(clientX);\n }}\n onMouseMove={(e) => {\n // Allow clicking inside tooltip to copy labels.\n if (!(e.target instanceof HTMLCanvasElement)) {\n return;\n }\n const { clientX } = e;\n if (isDragging) {\n const deltaX = clientX - startX;\n if (deltaX > 0) {\n // Hide tooltip when user drags to zoom.\n setShowTooltip(false);\n }\n }\n }}\n onMouseUp={() => {\n setIsDragging(false);\n setStartX(0);\n setShowTooltip(true);\n }}\n onMouseLeave={() => {\n if (tooltipPinnedCoords === null) {\n setShowTooltip(false);\n }\n if (chartRef.current !== undefined) {\n clearHighlightedSeries(chartRef.current);\n }\n }}\n onMouseEnter={() => {\n setShowTooltip(true);\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n onDoubleClick={(e) => {\n setTooltipPinnedCoords(null);\n // either dispatch ECharts restore action to return to orig state or allow consumer to define behavior\n if (onDoubleClick === undefined) {\n if (chartRef.current !== undefined) {\n restoreChart(chartRef.current);\n }\n } else {\n onDoubleClick(e);\n }\n }}\n >\n {/* Allows overrides prop to hide custom tooltip and use the ECharts option.tooltip instead */}\n {showTooltip === true &&\n (option.tooltip as TooltipComponentOption)?.showContent === false &&\n tooltipConfig.hidden !== true && (\n <TimeChartTooltip\n containerId={chartsTheme.tooltipPortalContainerId}\n chartRef={chartRef}\n data={data}\n seriesMapping={seriesMapping}\n wrapLabels={tooltipConfig.wrapLabels}\n enablePinning={isPinningEnabled}\n pinnedPos={tooltipPinnedCoords}\n format={format}\n onUnpinClick={() => {\n // Unpins tooltip when clicking Pin icon in TooltipHeader.\n setTooltipPinnedCoords(null);\n // Clear previously set pinned crosshair.\n setPinnedCrosshair(null);\n }}\n />\n )}\n <EChart\n sx={{\n width: '100%',\n height: '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n syncGroup={enableSyncGrouping ? syncGroup : undefined}\n />\n </Box>\n );\n});\n"],"names":["forwardRef","useEffect","useImperativeHandle","useMemo","useRef","useState","Box","merge","isEqual","toZonedTime","getCommonTimeScale","use","LineChart","EChartsLineChart","BarChart","EChartsBarChart","GridComponent","DatasetComponent","DataZoomComponent","MarkAreaComponent","MarkLineComponent","MarkPointComponent","TitleComponent","ToolboxComponent","TooltipComponent","CanvasRenderer","clearHighlightedSeries","DEFAULT_PINNED_CROSSHAIR","DEFAULT_TOOLTIP_CONFIG","EChart","enableDataZoom","getClosestTimestamp","getFormattedAxis","getFormattedAxisLabel","getPointInGrid","restoreChart","TimeChartTooltip","useChartsContext","useTimeZone","TimeSeriesChartBase","TimeChart","height","data","seriesMapping","timeScale","timeScaleProp","yAxis","format","grid","isStackedBar","tooltipConfig","noDataVariant","syncGroup","onDataZoom","onDoubleClick","__experimentalEChartsOptionsOverride","ref","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","isPinningEnabled","chartRef","showTooltip","setShowTooltip","tooltipPinnedCoords","setTooltipPinnedCoords","pinnedCrosshair","setPinnedCrosshair","isDragging","setIsDragging","startX","setStartX","timeZone","undefined","commonTimeScale","today","Date","pastDate","setFullYear","getFullYear","todayMs","getTime","pastDateMs","startMs","endMs","stepMs","rangeMs","highlightSeries","name","current","dispatchAction","type","seriesId","handleEvents","datazoom","params","setTimeout","batch","xAxisStartValue","startValue","xAxisEndValue","endValue","zoomEvent","start","end","finished","noDataOption","option","length","dataset","isLocalTimeZone","map","d","index","values","timestamp","value","val","push","id","source","dimensions","updatedSeriesMapping","series","xAxis","min","max","axisLabel","hideOverlap","formatter","axisPointer","snap","animation","tooltip","show","showContent","trigger","appendToBody","z","triggerEmphasis","triggerTooltip","toolbox","feature","dataZoom","icon","yAxisIndex","multipleTooltipsPinned","style","onClick","e","isControlKeyPressed","ctrlKey","metaKey","preventDefault","pointInGrid","nativeEvent","offsetX","offsetY","target","HTMLCanvasElement","pinnedPos","page","x","pageX","y","pageY","client","clientX","clientY","plotCanvas","cursorX","firstTimeSeriesValues","closestTimestamp","markLine","onMouseDown","onMouseMove","deltaX","onMouseUp","onMouseLeave","onMouseEnter","hidden","containerId","tooltipPortalContainerId","wrapLabels","onUnpinClick","sx","width","theme","echartsTheme","onEvents","_instance"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,EAAcC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC1G,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,WAAW,eAAe;AACjC,OAAOC,aAAa,iBAAiB;AACrC,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,kBAAkB,QAA8C,mBAAmB;AAQ5F,SAAqCC,GAAG,QAAQ,eAAe;AAC/D,SAASC,aAAaC,gBAAgB,EAAEC,YAAYC,eAAe,QAAQ,iBAAiB;AAC5F,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBA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BC,UAAUhG;gBACViG,WAAWjI;gBACXX,WAAWO,qBAAqBP,YAAYuB;;;;AAIpD,GAAG"}
|
|
@@ -52,7 +52,7 @@ function _interop_require_default(obj) {
|
|
|
52
52
|
_renderers.CanvasRenderer
|
|
53
53
|
]);
|
|
54
54
|
const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ height, data, seriesMapping, timeScale: timeScaleProp, yAxis, format, grid, isStackedBar = false, tooltipConfig = _components1.DEFAULT_TOOLTIP_CONFIG, noDataVariant = 'message', syncGroup, onDataZoom, onDoubleClick, __experimentalEChartsOptionsOverride }, ref) {
|
|
55
|
-
const { chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } = (0, _components1.useChartsContext)();
|
|
55
|
+
const { chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords } = (0, _components1.useChartsContext)();
|
|
56
56
|
const isPinningEnabled = tooltipConfig.enablePinning && enablePinning;
|
|
57
57
|
const chartRef = (0, _react.useRef)();
|
|
58
58
|
const [showTooltip, setShowTooltip] = (0, _react.useState)(true);
|
|
@@ -395,7 +395,7 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
|
|
|
395
395
|
theme: chartsTheme.echartsTheme,
|
|
396
396
|
onEvents: handleEvents,
|
|
397
397
|
_instance: chartRef,
|
|
398
|
-
syncGroup: syncGroup
|
|
398
|
+
syncGroup: enableSyncGrouping ? syncGroup : undefined
|
|
399
399
|
})
|
|
400
400
|
]
|
|
401
401
|
});
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.9.
|
|
8
|
+
"buildVersion": "0.9.1",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.63488d0a.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"__mf/js/async/879.24def15a.js",
|
|
141
141
|
"__mf/js/async/738.0a12bb44.js",
|
|
142
142
|
"__mf/js/async/223.def4d0a9.js",
|
|
143
|
-
"__mf/js/async/409.
|
|
143
|
+
"__mf/js/async/409.2808c63e.js",
|
|
144
144
|
"__mf/js/async/981.77f901c0.js"
|
|
145
145
|
],
|
|
146
146
|
"sync": [
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"js": {
|
|
185
185
|
"async": [],
|
|
186
186
|
"sync": [
|
|
187
|
-
"__mf/js/async/409.
|
|
187
|
+
"__mf/js/async/409.2808c63e.js"
|
|
188
188
|
]
|
|
189
189
|
},
|
|
190
190
|
"css": {
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"__mf/js/async/879.24def15a.js",
|
|
289
289
|
"__mf/js/async/223.def4d0a9.js",
|
|
290
290
|
"__mf/js/async/359.18a264e7.js",
|
|
291
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.
|
|
291
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.cb3d3f05.js"
|
|
292
292
|
],
|
|
293
293
|
"async": [
|
|
294
294
|
"__mf/js/async/964.6dfbf211.js",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"__mf/js/async/845.6d99c354.js",
|
|
308
308
|
"__mf/js/async/488.0d0b1a91.js",
|
|
309
309
|
"__mf/js/async/738.0a12bb44.js",
|
|
310
|
-
"__mf/js/async/409.
|
|
310
|
+
"__mf/js/async/409.2808c63e.js",
|
|
311
311
|
"__mf/js/async/981.77f901c0.js"
|
|
312
312
|
]
|
|
313
313
|
},
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.9.
|
|
8
|
+
"buildVersion": "0.9.1",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.63488d0a.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"__mf/js/async/879.24def15a.js",
|
|
157
157
|
"__mf/js/async/738.0a12bb44.js",
|
|
158
158
|
"__mf/js/async/223.def4d0a9.js",
|
|
159
|
-
"__mf/js/async/409.
|
|
159
|
+
"__mf/js/async/409.2808c63e.js",
|
|
160
160
|
"__mf/js/async/981.77f901c0.js"
|
|
161
161
|
],
|
|
162
162
|
"sync": [
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"js": {
|
|
209
209
|
"async": [],
|
|
210
210
|
"sync": [
|
|
211
|
-
"__mf/js/async/409.
|
|
211
|
+
"__mf/js/async/409.2808c63e.js"
|
|
212
212
|
]
|
|
213
213
|
},
|
|
214
214
|
"css": {
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
"__mf/js/async/879.24def15a.js",
|
|
338
338
|
"__mf/js/async/223.def4d0a9.js",
|
|
339
339
|
"__mf/js/async/359.18a264e7.js",
|
|
340
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.
|
|
340
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.cb3d3f05.js"
|
|
341
341
|
],
|
|
342
342
|
"async": [
|
|
343
343
|
"__mf/js/async/964.6dfbf211.js",
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
"__mf/js/async/845.6d99c354.js",
|
|
357
357
|
"__mf/js/async/488.0d0b1a91.js",
|
|
358
358
|
"__mf/js/async/738.0a12bb44.js",
|
|
359
|
-
"__mf/js/async/409.
|
|
359
|
+
"__mf/js/async/409.2808c63e.js",
|
|
360
360
|
"__mf/js/async/981.77f901c0.js"
|
|
361
361
|
]
|
|
362
362
|
},
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[]).push([["966"],{81481:function(e,t,l){l.r(t),l.d(t,{TimeSeriesChart:()=>eb});let n={unit:"decimal",shortValues:!0},i={show:!0,label:"",format:n,min:void 0,max:void 0},a="Label",o="Min",r="Max",s={lineWidth:1.25,areaOpacity:0,pointRadius:2.75,connectNulls:!1},d="Line Width",u="slider-line-width",c=.25,h=3,p=.25,v="Area Opacity",m="slider-area-opacity",g=0,y=1,x=.05,f="Stack Series",b="Connect Nulls",C={none:{label:"None"},all:{label:"All"}},j=Object.entries(C).map(e=>{let[t,l]=e;return{id:t,...l}});var S=l(24246),M=l(48565),w=l(75586),E=l(72629),O=l(58891),T=l(5404),I=l(98346),Z=l(71377),A=l(87895);function D(e){let{value:t,onChange:l}=e,n=t.stack??"none",i=C[n];return(0,S.jsxs)(E.OptionsEditorGroup,{title:"Visual",children:[(0,S.jsx)(E.OptionsEditorControl,{label:"Display",control:(0,S.jsxs)(T.Z,{color:"primary",exclusive:!0,value:t.display,onChange:(e,n)=>{l({...t,display:n})},children:[(0,S.jsx)(I.Z,{value:"line",selected:void 0===t.display||"line"===t.display,"aria-label":"display line series",children:"Line"}),(0,S.jsx)(I.Z,{value:"bar","aria-label":"display bar series",children:"Bar"})]})}),(0,S.jsx)(E.OptionsEditorControl,{label:d,control:(0,S.jsx)(Z.ZP,{"data-testid":u,value:t.lineWidth??1.25,valueLabelDisplay:"auto",step:p,marks:!0,min:c,max:h,disabled:"bar"===t.display,onChange:(e,n)=>{let i=Array.isArray(n)?n[0]:n,a=void 0!==i?i+1.5:2.75;l((0,w.Uy)(t,e=>{e.lineWidth=i,e.pointRadius=a}))}})}),(0,S.jsx)(E.OptionsEditorControl,{label:v,control:(0,S.jsx)(Z.ZP,{"data-testid":m,value:t.areaOpacity??0,valueLabelDisplay:"auto",step:x,marks:!0,min:g,max:y,disabled:"bar"===t.display,onChange:(e,n)=>{let i=Array.isArray(n)?n[0]:n;l((0,w.Uy)(t,e=>{e.areaOpacity=i}))}})}),(0,S.jsx)(E.OptionsEditorControl,{label:f,control:(0,S.jsx)(E.SettingsAutocomplete,{value:{...i,id:n},options:j,onChange:(e,n)=>{let i={...t,stack:"none"===n.id?void 0:n.id};"all"!==n.id||t.areaOpacity||(i.areaOpacity=.3),l(i)},disabled:void 0===t,disableClearable:!0})}),(0,S.jsx)(E.OptionsEditorControl,{label:b,control:(0,S.jsx)(A.Z,{checked:t.connectNulls??!1,disabled:"bar"===t.display,onChange:e=>{l({...t,connectNulls:e.target.checked})}})})]})}var L=l(8695);function N(e){let{value:t,onChange:l}=e;return(0,S.jsxs)(E.OptionsEditorGroup,{title:"Y Axis",children:[(0,S.jsx)(E.OptionsEditorControl,{label:"Show",control:(0,S.jsx)(A.Z,{checked:t.show??i.show,onChange:e=>{l({...t,show:e.target.checked})}})}),(0,S.jsx)(E.FormatControls,{value:t.format??n,onChange:e=>l({...t,format:e})}),(0,S.jsx)(E.OptionsEditorControl,{label:a,control:(0,S.jsx)(L.Z,{value:t.label??"",inputProps:{"aria-label":"enter y axis label"},onChange:e=>l({...t,label:e.target.value}),placeholder:"Default"})}),(0,S.jsx)(E.OptionsEditorControl,{label:o,control:(0,S.jsx)(L.Z,{type:"number",value:t.min??"",onChange:e=>{let n=e.target.value?Number(e.target.value):void 0;l({...t,min:n})},placeholder:"Default"})}),(0,S.jsx)(E.OptionsEditorControl,{label:r,control:(0,S.jsx)(L.Z,{type:"number",value:t.max??"",onChange:e=>{let n=e.target.value?Number(e.target.value):void 0;l({...t,max:n})},placeholder:"Default"})})]})}var k=l(75094),P=l(52054),U=l(25283),q=l(10517),R=l(54538),_=l(22446),F=l(33755);function G(e){let{querySettingsList:t,onChange:l}=e,n=(0,R.useRef)(null),i=(0,R.useRef)(!1);(0,R.useEffect)(()=>{var e;n.current&&i.current&&(null===(e=n.current)||void 0===e||e.focus(),i.current=!1)},[null==t?void 0:t.length]);let a=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{let l=null==t?void 0:t[n];l&&(l.queryIndex=parseInt(e.target.value))}))},o=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{if(void 0!==t){let l=t[n];l&&(l.colorMode=e.target.value)}}))},r=(e,n)=>{void 0!==t&&l((0,w.Uy)(t,t=>{if(void 0!==t){let l=t[n];l&&(l.colorValue=e)}}))},s=e=>{void 0!==t&&l((0,w.Uy)(t,t=>{t.splice(e,1)}))},d=(0,O.useQueryCountContext)(),u=(0,R.useMemo)(()=>{let e=(null==t?void 0:t.map(e=>e.queryIndex))??[];return Array.from({length:d},(e,t)=>t).filter((t,l)=>!e.includes(l))},[t,d]),c=(0,R.useMemo)(()=>u[0]??-1,[u]),h={queryIndex:c,colorMode:"fixed",colorValue:"#555"};return(0,S.jsx)(E.OptionsEditorGroup,{title:"Query settings",icon:-1!==c?(0,S.jsx)(E.InfoTooltip,{description:"Add query settings",children:(0,S.jsx)(k.Z,{size:"small","aria-label":"add query settings",onClick:()=>{i.current=!0,void 0===t?l([h]):l((0,w.Uy)(t,e=>{e.push(h)}))},children:(0,S.jsx)(F.default,{})})}):null,children:t&&t.length>0?t.map((e,l)=>(0,S.jsx)($,{inputRef:l===t.length-1?n:void 0,querySettings:e,availableQueryIndexes:u,onQueryIndexChange:e=>{a(e,l)},onColorModeChange:e=>o(e,l),onColorValueChange:e=>r(e,l),onDelete:()=>{s(l)}},l)):(0,S.jsx)(P.Z,{mb:2,fontStyle:"italic",children:"No query settings defined"})})}function $(e){let{querySettings:{queryIndex:t,colorMode:l,colorValue:n},availableQueryIndexes:i,onQueryIndexChange:a,onColorModeChange:o,onColorValueChange:r,onDelete:s,inputRef:d}=e,u=i.concat(t).sort((e,t)=>e-t);return(0,S.jsxs)(U.Z,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,S.jsx)(L.Z,{select:!0,inputRef:d,value:t,label:"Query",onChange:a,sx:{minWidth:"75px"},children:u.map(e=>(0,S.jsxs)(q.Z,{value:e,children:["#",e+1]},`query-${e}`))}),(0,S.jsxs)(L.Z,{select:!0,value:l,fullWidth:!0,label:"Color mode",onChange:o,children:[(0,S.jsx)(q.Z,{value:"fixed-single",children:"Fixed (single)"}),(0,S.jsx)(q.Z,{value:"fixed",children:"Fixed"})]}),(0,S.jsx)(E.OptionsColorPicker,{label:"Query n\xb0"+t,color:n,onColorChange:r}),(0,S.jsx)(k.Z,{"aria-label":`delete settings for query n\xb0${t+1}`,size:"small",onClick:s,children:(0,S.jsx)(_.default,{})})]})}var V=l(94776),H=l(36372),W=l(15409),z=l.n(W),Q=l(8193),Y=l(14046),B=l(69481),X=l(74664);function K(e){let t=Math.floor(Math.log10(Math.abs(e)));return Math.floor(e/Math.pow(10,t))*Math.pow(10,t)}var J=l(83915);let ee=new J.Z({hue:{min:20,max:360}}),et=new J.Z({hue:{min:0,max:20}}),el={};var en=l(56141),ei=l.n(en),ea=l(4665),eo=l(36232),er=l(44811),es=l(508),ed=l(65201),eu=l(99635),ec=l(48906),eh=l(98857),ep=l(219),ev=l(17846),em=l(23709),eg=l(55328),ey=l(67745),ex=l(50378);(0,eo.D)([er.N,es.N,ed.N,eu.N,ec.N,eh.N,ep.N,ev.N,em.N,eg.N,ey.N,ex.N]);let ef=(0,R.forwardRef)(function(e,t){var l;let n,{height:i,data:a,seriesMapping:o,timeScale:r,yAxis:s,format:d,grid:u,isStackedBar:c=!1,tooltipConfig:h=E.DEFAULT_TOOLTIP_CONFIG,noDataVariant:p="message",syncGroup:v,onDataZoom:m,onDoubleClick:g,__experimentalEChartsOptionsOverride:y}=e,{chartsTheme:x,enablePinning:f,lastTooltipPinnedCoords:b,setLastTooltipPinnedCoords:C}=(0,E.useChartsContext)(),j=h.enablePinning&&f,M=(0,R.useRef)(),[w,O]=(0,R.useState)(!0),[T,I]=(0,R.useState)(null),[Z,A]=(0,R.useState)(null),[D,L]=(0,R.useState)(!1),[N,k]=(0,R.useState)(0),{timeZone:P}=(0,E.useTimeZone)();if(void 0===r){let e=(0,B.C5)(a);if(void 0===e){let e=new Date,t=new Date(e);t.setFullYear(e.getFullYear()-5);let l=e.getTime(),i=t.getTime();n={startMs:i,endMs:l,stepMs:1,rangeMs:l-i}}else n=e}else n=r;(0,R.useImperativeHandle)(t,()=>({highlightSeries(e){let{name:t}=e;M.current&&M.current.dispatchAction({type:"highlight",seriesId:t})},clearHighlightedSeries:()=>{M.current&&(0,E.clearHighlightedSeries)(M.current)}}),[]);let U=(0,R.useMemo)(()=>({datazoom:e=>{if(void 0===m&&setTimeout(()=>{I(null)},10),void 0===m||void 0===e.batch[0])return;let t=e.batch[0].startValue,l=e.batch[0].endValue;void 0!==t&&void 0!==l&&m({start:t,end:l})},finished:()=>{void 0!==M.current&&(0,E.enableDataZoom)(M.current)}}),[m,I]),{noDataOption:q}=x,_=(0,R.useMemo)(()=>{if(null===a||0===a.length&&"message"===p)return q;let e=[],t="local"===P;a.map((l,n)=>{let i=l.values.map(e=>{let[l,n]=e;return[t?l:(0,ea.toZonedTime)(l,P),null===n?"-":n]});e.push({id:n,source:[...i],dimensions:["time","value"]})});let l={dataset:e,series:f&&null!==Z?[...o,Z]:o,xAxis:{type:"time",min:t?n.startMs:(0,ea.toZonedTime)(n.startMs,P),max:t?n.endMs:(0,ea.toZonedTime)(n.endMs,P),axisLabel:{hideOverlap:!0,formatter:(0,E.getFormattedAxisLabel)(n.rangeMs??0)},axisPointer:{snap:!1}},yAxis:(0,E.getFormattedAxis)(s,d),animation:!1,tooltip:{show:!0,showContent:c,trigger:c?"item":"axis",appendToBody:c},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!1},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:u};return y?y(l):l},[a,o,n,s,d,u,q,y,p,P,c,f,Z]);return(0,R.useEffect)(()=>{null===T||null===b||ei()(b,T)||(I(null),null!==T&&null!==Z&&A(null))},[b,o]),(0,S.jsxs)(H.Z,{style:{height:i},onClick:e=>{let t=e.ctrlKey||e.metaKey;t&&e.preventDefault();let l=(0,E.getPointInGrid)(e.nativeEvent.offsetX,e.nativeEvent.offsetY,M.current);if(null!==l&&j&&e.target instanceof HTMLCanvasElement){let n={page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target};I(e=>null===e?n:(A(null),null)),A(e=>{if(null!==e)return null;{var t;let e=l[0],n=null===(t=a[0])||void 0===t?void 0:t.values,i=(0,E.getClosestTimestamp)(n,e);return z()({},E.DEFAULT_PINNED_CROSSHAIR,{markLine:{data:[{xAxis:i}]}})}}),t||C(n)}},onMouseDown:e=>{let{clientX:t}=e;L(!0),k(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;D&&t-N>0&&O(!1)},onMouseUp:()=>{L(!1),k(0),O(!0)},onMouseLeave:()=>{null===T&&O(!1),void 0!==M.current&&(0,E.clearHighlightedSeries)(M.current)},onMouseEnter:()=>{O(!0),void 0!==M.current&&(0,E.enableDataZoom)(M.current)},onDoubleClick:e=>{I(null),void 0===g?void 0!==M.current&&(0,E.restoreChart)(M.current):g(e)},children:[!0===w&&(null===(l=_.tooltip)||void 0===l?void 0:l.showContent)===!1&&!0!==h.hidden&&(0,S.jsx)(E.TimeChartTooltip,{containerId:x.tooltipPortalContainerId,chartRef:M,data:a,seriesMapping:o,wrapLabels:h.wrapLabels,enablePinning:j,pinnedPos:T,format:d,onUnpinClick:()=>{I(null),A(null)}}),(0,S.jsx)(E.EChart,{sx:{width:"100%",height:"100%"},option:_,theme:x.echartsTheme,onEvents:U,_instance:M,syncGroup:v})]})}),eb={PanelComponent:function(e){var t;let{spec:{thresholds:l,yAxis:a,tooltip:o,querySettings:r},contentDimensions:d,queryResults:u}=e,c=(0,E.useChartsTheme)(),h=(0,V.Z)(),p=(0,E.useId)("time-series-panel"),v=(0,R.useRef)(null),m=c.echartsTheme.color,g=c.container.padding.default,y=d?{width:d.width-2*g,height:d.height-2*g}:void 0,x=(0,R.useMemo)(()=>e.spec.legend&&(0,O.validateLegendSpec)(e.spec.legend)?z()({},Q.zx,e.spec.legend):void 0,[e.spec.legend]),f=(null===(t=e.spec.yAxis)||void 0===t?void 0:t.format)??n,b=(0,R.useMemo)(()=>z()({},s,e.spec.visual),[e.spec.visual]),C=(0,R.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={show:!0,axisLabel:{show:(null==e?void 0:e.show)??i.show},min:null==e?void 0:e.min,max:null==e?void 0:e.max};return(null==e?void 0:e.min)===void 0&&(t.min=e=>e.min>=0&&e.min<=1?0:e.min>0?K(.8*e.min):K(1.2*e.min)),t})(a),[a]),[j,M]=(0,R.useState)("ALL"),[w,T]=(0,R.useState)(),{setTimeRange:I}=(0,O.useTimeRange)(),{timeScale:Z,timeChartData:A,timeSeriesMapping:D,legendItems:L}=(0,R.useMemo)(()=>{let e=function(e){let t=e.map(e=>e.data);return(0,B.C5)(t)}(u);if(void 0===e)return{timeChartData:[],timeSeriesMapping:[]};let t=[],n=[],i=[],o=0;for(let l=0;l<u.length;l++){let a;let c=u[l];for(let e of r??[])e.queryIndex===l&&(a=e);if(c)for(let r=0;r<c.data.series.length;r++){var s,d,v;let g=c.data.series[r];if(void 0===g)return{timeChartData:[],timeSeriesMapping:[],legendItems:[]};let y=g.formattedName??g.name,f=function(e){var t;let{categoricalPalette:l,visual:n,muiPrimaryColor:i,seriesName:a,seriesIndex:o,querySettings:r,queryHasMultipleResults:s}=e;if(r&&("fixed"===r.colorMode||"fixed-single"===r.colorMode&&!s))return r.colorValue;let d=Array.isArray(l)&&l[0]?l[0]:i;return(null===(t=n.palette)||void 0===t?void 0:t.mode)==="categorical"?function(e,t,l){if(void 0===e)return l;let n=e.length??1;return e[t%n]??l}(l,o,d):function(e,t){var l;return function(e,t){let l=`${e}_____${t}`,n=el[l];return n||(n=function(e,t){let[l,n,i]=t?et.hsl(e):ee.hsl(e),a=`${(100*n).toFixed(0)}%`,o=`${(100*i).toFixed(0)}%`;return`hsla(${l.toFixed(2)},${a},${o},0.9)`}(e,t),el[l]=n),n}(l=e,l.toLowerCase().includes("error"))??t}(a,d)}({categoricalPalette:m,visual:b,muiPrimaryColor:h.palette.primary.main,seriesName:y,seriesIndex:o,querySettings:a,queryHasMultipleResults:((null===(v=u[l])||void 0===v?void 0:null===(d=v.data)||void 0===d?void 0:null===(s=d.series)||void 0===s?void 0:s.length)??0)>1}),C=p+g.name+o,S=(null==x?void 0:x.values)?(0,Y.Dc)(g.values,x.values):void 0,M="ALL"===j;if(!M&&j[C]||M){let t=n.length;i.push(function(e,t,l,n,i,a){let o=n.lineWidth??1.25,r=n.pointRadius??2.75,s=i.rangeMs<=9e5;return("always"===n.showPoints&&(s=!0),"bar"===n.display)?{type:"bar",id:e,datasetIndex:t,name:l,color:a,stack:"all"===n.stack?n.stack:void 0,label:{show:!1}}:{type:"line",id:e,datasetIndex:t,name:l,connectNulls:n.connectNulls??!1,color:a,stack:"all"===n.stack?n.stack:void 0,sampling:"lttb",progressiveThreshold:E.OPTIMIZED_MODE_SERIES_LIMIT,showSymbol:s,showAllSymbol:!0,symbolSize:r,lineStyle:{width:o,opacity:.95},areaStyle:{opacity:n.areaOpacity??0},emphasis:{focus:"series",disabled:void 0!==n.areaOpacity&&n.areaOpacity>0,lineStyle:{width:o+1,opacity:1}},selectedMode:"single",select:{itemStyle:{borderColor:a,borderWidth:r+.5}},blur:{lineStyle:{width:o,opacity:.5}}}}(C,t,y,b,e,f)),n.push({name:y,values:(0,B.m6)(g,e)})}x&&t&&t.push({id:C,label:y,color:f,data:S}),o++}}if(l&&l.steps){let t=c.thresholds,r=l.defaultColor??t.defaultColor;l.steps.forEach((s,d)=>{let u=t.palette[d]??r,c={color:s.color??u,value:"percent"===l.mode?function(e,t,l,n){var i,a;let o;let r=l??(o=0,(i=t).length&&void 0!==i[0]&&(null===(a=i[0])||void 0===a?void 0:a.values)?i.forEach(e=>{e.values.forEach(e=>{let[t,l]=e;"number"==typeof l&&l>o&&(o=l)})}):i.forEach(e=>{void 0!==e.data&&e.data.forEach(e=>{"number"==typeof e&&e>o&&(o=e)})}),o),s=n??0;return e/100*(r-s)+s}(s.value,n,null==a?void 0:a.max,null==a?void 0:a.min):s.value},h=s.name??`Threshold ${d+1}`,p=[],v=e.startMs;for(;v<=e.endMs;)p.push([v,c.value]),v+=15e3;n.push({name:h,values:p}),i.push({type:"line",name:h,id:h,datasetId:h,datasetIndex:o,color:c.color,label:{show:!1},lineStyle:{type:"dashed",width:2},emphasis:{focus:"series",lineStyle:{width:2.5}},blur:{lineStyle:{opacity:.5}}}),o++})}return{timeScale:e,timeChartData:n,timeSeriesMapping:i,legendItems:t}},[u,l,j,x,b,r,null==a?void 0:a.max,null==a?void 0:a.min,m,p,c.thresholds,h.palette.primary.main]),N=(0,R.useMemo)(()=>(null==x?void 0:x.values)?O.legendValues.reduce((e,t)=>{var l;let n=O.LEGEND_VALUE_CONFIG[t];return n&&(null==x?void 0:null===(l=x.values)||void 0===l?void 0:l.includes(t))&&e.push({accessorKey:`data.${t}`,header:n.label,headerDescription:n.description,width:72,align:"right",cell:e=>{let{getValue:t}=e,l=t();return"number"==typeof l&&f?(0,X.Bw)(l,f):l},cellDescription:!0,enableSorting:!0}),e},[]):[],[null==x?void 0:x.values,f]);if(void 0===y)return null;let k=a&&a.label?30:20,P={left:C.show?k:0,right:20,bottom:0},U=e=>{I({start:new Date(e.start),end:new Date(e.end)})},q="bar"===b.display&&"all"===b.stack,_=!0;q?_=!1:(null==o?void 0:o.enablePinning)!==void 0&&(_=o.enablePinning);let F={...E.DEFAULT_TOOLTIP_CONFIG,enablePinning:_};return(0,S.jsx)(H.Z,{sx:{padding:`${g}px`},children:(0,S.jsx)(E.ContentWithLegend,{width:y.width,height:y.height,minChildrenHeight:50,legendSize:null==x?void 0:x.size,legendProps:x&&{options:x,data:L||[],selectedItems:j,onSelectedItemsChange:M,tableProps:{columns:N,sorting:w,onSortingChange:T},onItemMouseOver:(e,t)=>{var l;let{id:n}=t;null===(l=v.current)||void 0===l||l.highlightSeries({name:n})},onItemMouseOut:()=>{var e;null===(e=v.current)||void 0===e||e.clearHighlightedSeries()}},children:e=>{let{height:t,width:l}=e;return(0,S.jsxs)(H.Z,{style:{height:t,width:l},children:[a&&a.show&&a.label&&(0,S.jsx)(E.YAxisLabel,{name:a.label,height:t}),(0,S.jsx)(ef,{ref:v,height:t,data:A,seriesMapping:D,timeScale:Z,yAxis:C,format:f,grid:P,isStackedBar:q,tooltipConfig:F,syncGroup:"default-panel-group",onDataZoom:U,noDataVariant:!A.length&&L&&L.length>0?"chart":"message"})]})}})})},supportedQueryTypes:["TimeSeriesQuery"],panelOptionsEditorComponents:[{label:"Settings",content:function(e){let{onChange:t,value:l}=e;return(0,S.jsxs)(E.OptionsEditorGrid,{children:[(0,S.jsxs)(E.OptionsEditorColumn,{children:[(0,S.jsx)(O.LegendOptionsEditor,{value:l.legend,onChange:e=>{t((0,w.Uy)(l,t=>{t.legend=e}))}}),(0,S.jsx)(D,{value:l.visual??s,onChange:e=>{t((0,w.Uy)(l,t=>{t.visual=e}))}})]}),(0,S.jsx)(E.OptionsEditorColumn,{children:(0,S.jsx)(N,{value:l.yAxis??i,onChange:e=>{t((0,w.Uy)(l,t=>{t.yAxis=e}))}})}),(0,S.jsxs)(E.OptionsEditorColumn,{children:[(0,S.jsx)(E.ThresholdsEditor,{hideDefault:!0,thresholds:l.thresholds,onChange:e=>{t((0,w.Uy)(l,t=>{t.thresholds=e}))}}),(0,S.jsx)(G,{querySettingsList:l.querySettings,onChange:e=>{t((0,w.Uy)(l,t=>{t.querySettings=e}))}}),(0,S.jsx)(E.OptionsEditorGroup,{title:"Reset Settings",children:(0,S.jsx)(M.Z,{variant:"outlined",color:"secondary",onClick:()=>{t((0,w.Uy)(l,e=>{e.yAxis=void 0,e.legend=void 0,e.visual=void 0,e.thresholds=void 0,e.querySettings=void 0}))},children:"Reset To Defaults"})})]})]})}}],createInitialOptions:function(){return{}}}}}]);
|