@perses-dev/timeseries-chart-plugin 0.6.0 → 0.8.0

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.
Files changed (38) hide show
  1. package/__mf/js/{983.f8c95769.js → 983.94371668.js} +1 -1
  2. package/__mf/js/{TimeSeriesChart.645380d5.js → TimeSeriesChart.74367dd5.js} +3 -3
  3. package/__mf/js/async/{511.754bc334.js → 225.8c13dfe9.js} +2 -2
  4. package/__mf/js/async/409.0647f389.js +1 -0
  5. package/__mf/js/async/476.45fca8d3.js +1 -0
  6. package/__mf/js/async/570.87723a1e.js +29 -0
  7. package/__mf/js/async/65.86f223c0.js +73 -0
  8. package/__mf/js/async/{754.a8adddbc.js → 755.f76e3538.js} +2 -2
  9. package/__mf/js/async/797.f4545195.js +2 -0
  10. package/__mf/js/async/__federation_expose_TimeSeriesChart.3cb3d239.js +1 -0
  11. package/__mf/js/main.b97521b5.js +1 -0
  12. package/lib/TimeSeriesChartBase.d.ts +22 -0
  13. package/lib/TimeSeriesChartBase.d.ts.map +1 -0
  14. package/lib/TimeSeriesChartBase.js +389 -0
  15. package/lib/TimeSeriesChartBase.js.map +1 -0
  16. package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
  17. package/lib/TimeSeriesChartPanel.js +3 -2
  18. package/lib/TimeSeriesChartPanel.js.map +1 -1
  19. package/lib/cjs/TimeSeriesChartBase.js +402 -0
  20. package/lib/cjs/TimeSeriesChartPanel.js +2 -1
  21. package/lib/cjs/index.js +36 -12
  22. package/lib/index.d.ts +9 -3
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +21 -3
  25. package/lib/index.js.map +1 -1
  26. package/mf-manifest.json +24 -22
  27. package/mf-stats.json +29 -24
  28. package/package.json +4 -5
  29. package/__mf/js/async/162.5d97bc19.js +0 -73
  30. package/__mf/js/async/357.397150dd.js +0 -29
  31. package/__mf/js/async/610.b0547671.js +0 -1
  32. package/__mf/js/async/996.7bede0b2.js +0 -2
  33. package/__mf/js/async/__federation_expose_TimeSeriesChart.a02bcd07.js +0 -1
  34. package/__mf/js/main.7c237ea8.js +0 -1
  35. /package/__mf/js/async/{511.754bc334.js.LICENSE.txt → 225.8c13dfe9.js.LICENSE.txt} +0 -0
  36. /package/__mf/js/async/{357.397150dd.js.LICENSE.txt → 570.87723a1e.js.LICENSE.txt} +0 -0
  37. /package/__mf/js/async/{162.5d97bc19.js.LICENSE.txt → 65.86f223c0.js.LICENSE.txt} +0 -0
  38. /package/__mf/js/async/{996.7bede0b2.js.LICENSE.txt → 797.f4545195.js.LICENSE.txt} +0 -0
@@ -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(28264),O=l(17839),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{}}}}}]);
@@ -0,0 +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|263|494|705|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)+"."+({110:"e82fda83",118:"098fc614",173:"f6f7e45b",214:"2d4431c6",224:"ce414ffb",225:"8c13dfe9",238:"625b8a48",292:"311e6eb0",409:"0647f389",476:"45fca8d3",570:"87723a1e",620:"d6f96402",65:"86f223c0",651:"80087530",656:"d43503a5",694:"27c70ab1",738:"0a12bb44",740:"67107c3c",75:"5952779d",755:"f76e3538",770:"78a741ab",780:"3fa36115",797:"f4545195",960:"3047096d",981:"77f901c0"})[e]+".js",t.miniCssF=e=>"__mf/css/async/"+e+"."+({263:"9a1fa3dd",759:"9a1fa3dd"})[e]+".css",t.h=()=>"55f9a625e6509efa",(()=>{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.0",factory:()=>Promise.all([t.e("238"),t.e("224"),t.e("292"),t.e("797"),t.e("755"),t.e("476"),t.e("570"),t.e("225"),t.e("780"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("759")]).then(()=>()=>t(14386)),eager:0,singleton:1},{name:"@perses-dev/plugin-system",version:"0.51.0-rc.0",factory:()=>Promise.all([t.e("118"),t.e("292"),t.e("755"),t.e("780"),t.e("65"),t.e("677"),t.e("179"),t.e("987"),t.e("157"),t.e("846"),t.e("705"),t.e("656")]).then(()=>()=>t(17402)),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("797"),t.e("476"),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("110").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"],157:["72116"],705:["90775","74614","30156","57751","55922","84275","74128"],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))},90775:{shareScope:"default",shareKey:"@perses-dev/components",import:"@perses-dev/components",requiredVersion:"0.51.0-rc.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("238"),t.e("224"),t.e("797"),t.e("476"),t.e("570"),t.e("225"),t.e("263")]).then(()=>()=>t(14386))},57751:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(17402)},30156:{shareScope:"default",shareKey:"echarts",import:"echarts",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("797"),t.e("476"),t.e("409")]).then(()=>()=>t(71932))},74128:{shareScope:"default",shareKey:"@perses-dev/plugin-system",import:"@perses-dev/plugin-system",requiredVersion:"0.51.0-rc.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>()=>t(17402)},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))},74614:{shareScope:"default",shareKey:"lodash",import:"lodash",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("981").then(()=>()=>t(98784))},55922:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"*",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("770").then(()=>()=>t(51958))},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("110").then(()=>()=>t(27378))},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|263|494|705|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)})();
@@ -0,0 +1,22 @@
1
+ import { MouseEvent } from 'react';
2
+ import { TimeScale, FormatOptions, TimeSeries } from '@perses-dev/core';
3
+ import type { EChartsCoreOption, GridComponentOption, YAXisComponentOption } from 'echarts';
4
+ import { ChartInstance, TimeChartSeriesMapping, TooltipConfig, ZoomEventData } from '@perses-dev/components';
5
+ export interface TimeChartProps {
6
+ height: number;
7
+ data: TimeSeries[];
8
+ seriesMapping: TimeChartSeriesMapping;
9
+ timeScale?: TimeScale;
10
+ yAxis?: YAXisComponentOption;
11
+ format?: FormatOptions;
12
+ grid?: GridComponentOption;
13
+ tooltipConfig?: TooltipConfig;
14
+ noDataVariant?: 'chart' | 'message';
15
+ syncGroup?: string;
16
+ isStackedBar?: boolean;
17
+ onDataZoom?: (e: ZoomEventData) => void;
18
+ onDoubleClick?: (e: MouseEvent) => void;
19
+ __experimentalEChartsOptionsOverride?: (options: EChartsCoreOption) => EChartsCoreOption;
20
+ }
21
+ export declare const TimeSeriesChartBase: import("react").ForwardRefExoticComponent<TimeChartProps & import("react").RefAttributes<ChartInstance>>;
22
+ //# sourceMappingURL=TimeSeriesChartBase.d.ts.map
@@ -0,0 +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,wBAAwB,CAAC;AAkBhC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,SAAS,CAAC,EAAE,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,0GAyW9B,CAAC"}
@@ -0,0 +1,389 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
15
+ import { Box } from '@mui/material';
16
+ import merge from 'lodash/merge';
17
+ import isEqual from 'lodash/isEqual';
18
+ import { toZonedTime } from 'date-fns-tz';
19
+ import { getCommonTimeScale } from '@perses-dev/core';
20
+ import { use } from 'echarts/core';
21
+ import { LineChart as EChartsLineChart, BarChart as EChartsBarChart } from 'echarts/charts';
22
+ import { GridComponent, DatasetComponent, DataZoomComponent, MarkAreaComponent, MarkLineComponent, MarkPointComponent, TitleComponent, ToolboxComponent, TooltipComponent } from 'echarts/components';
23
+ import { CanvasRenderer } from 'echarts/renderers';
24
+ import { clearHighlightedSeries, DEFAULT_PINNED_CROSSHAIR, DEFAULT_TOOLTIP_CONFIG, EChart, enableDataZoom, getClosestTimestamp, getFormattedAxis, getFormattedAxisLabel, getPointInGrid, restoreChart, TimeChartTooltip, useChartsContext, useTimeZone } from '@perses-dev/components';
25
+ use([
26
+ EChartsLineChart,
27
+ EChartsBarChart,
28
+ GridComponent,
29
+ DatasetComponent,
30
+ DataZoomComponent,
31
+ MarkAreaComponent,
32
+ MarkLineComponent,
33
+ MarkPointComponent,
34
+ TitleComponent,
35
+ ToolboxComponent,
36
+ TooltipComponent,
37
+ CanvasRenderer
38
+ ]);
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();
41
+ const isPinningEnabled = tooltipConfig.enablePinning && enablePinning;
42
+ const chartRef = useRef();
43
+ const [showTooltip, setShowTooltip] = useState(true);
44
+ const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState(null);
45
+ const [pinnedCrosshair, setPinnedCrosshair] = useState(null);
46
+ const [isDragging, setIsDragging] = useState(false);
47
+ const [startX, setStartX] = useState(0);
48
+ const { timeZone } = useTimeZone();
49
+ let timeScale;
50
+ if (timeScaleProp === undefined) {
51
+ const commonTimeScale = getCommonTimeScale(data);
52
+ if (commonTimeScale === undefined) {
53
+ // set default to past 5 years
54
+ const today = new Date();
55
+ const pastDate = new Date(today);
56
+ pastDate.setFullYear(today.getFullYear() - 5);
57
+ const todayMs = today.getTime();
58
+ const pastDateMs = pastDate.getTime();
59
+ timeScale = {
60
+ startMs: pastDateMs,
61
+ endMs: todayMs,
62
+ stepMs: 1,
63
+ rangeMs: todayMs - pastDateMs
64
+ };
65
+ } else {
66
+ timeScale = commonTimeScale;
67
+ }
68
+ } else {
69
+ timeScale = timeScaleProp;
70
+ }
71
+ useImperativeHandle(ref, ()=>{
72
+ return {
73
+ highlightSeries ({ name }) {
74
+ if (!chartRef.current) {
75
+ // when chart undef, do not highlight series when hovering over legend
76
+ return;
77
+ }
78
+ chartRef.current.dispatchAction({
79
+ type: 'highlight',
80
+ seriesId: name
81
+ });
82
+ },
83
+ clearHighlightedSeries: ()=>{
84
+ if (!chartRef.current) {
85
+ // when chart undef, do not clear highlight series
86
+ return;
87
+ }
88
+ clearHighlightedSeries(chartRef.current);
89
+ }
90
+ };
91
+ }, []);
92
+ const handleEvents = useMemo(()=>{
93
+ return {
94
+ datazoom: (params)=>{
95
+ if (onDataZoom === undefined) {
96
+ setTimeout(()=>{
97
+ // workaround so unpin happens after click event
98
+ setTooltipPinnedCoords(null);
99
+ }, 10);
100
+ }
101
+ if (onDataZoom === undefined || params.batch[0] === undefined) return;
102
+ const xAxisStartValue = params.batch[0].startValue;
103
+ const xAxisEndValue = params.batch[0].endValue;
104
+ if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {
105
+ const zoomEvent = {
106
+ start: xAxisStartValue,
107
+ end: xAxisEndValue
108
+ };
109
+ onDataZoom(zoomEvent);
110
+ }
111
+ },
112
+ finished: ()=>{
113
+ if (chartRef.current !== undefined) {
114
+ enableDataZoom(chartRef.current);
115
+ }
116
+ }
117
+ };
118
+ }, [
119
+ onDataZoom,
120
+ setTooltipPinnedCoords
121
+ ]);
122
+ const { noDataOption } = chartsTheme;
123
+ const option = useMemo(()=>{
124
+ // The "chart" `noDataVariant` is only used when the `timeSeries` is an
125
+ // empty array because a `null` value will throw an error.
126
+ if (data === null || data.length === 0 && noDataVariant === 'message') return noDataOption;
127
+ // Utilizes ECharts dataset so raw data is separate from series option style properties
128
+ // https://apache.github.io/echarts-handbook/en/concepts/dataset/
129
+ const dataset = [];
130
+ const isLocalTimeZone = timeZone === 'local';
131
+ data.map((d, index)=>{
132
+ const values = d.values.map(([timestamp, value])=>{
133
+ const val = value === null ? '-' : value; // echarts use '-' to represent null data
134
+ return [
135
+ isLocalTimeZone ? timestamp : toZonedTime(timestamp, timeZone),
136
+ val
137
+ ];
138
+ });
139
+ dataset.push({
140
+ id: index,
141
+ source: [
142
+ ...values
143
+ ],
144
+ dimensions: [
145
+ 'time',
146
+ 'value'
147
+ ]
148
+ });
149
+ });
150
+ const updatedSeriesMapping = enablePinning && pinnedCrosshair !== null ? [
151
+ ...seriesMapping,
152
+ pinnedCrosshair
153
+ ] : seriesMapping;
154
+ const option = {
155
+ dataset: dataset,
156
+ series: updatedSeriesMapping,
157
+ xAxis: {
158
+ type: 'time',
159
+ min: isLocalTimeZone ? timeScale.startMs : toZonedTime(timeScale.startMs, timeZone),
160
+ max: isLocalTimeZone ? timeScale.endMs : toZonedTime(timeScale.endMs, timeZone),
161
+ axisLabel: {
162
+ hideOverlap: true,
163
+ formatter: getFormattedAxisLabel(timeScale.rangeMs ?? 0)
164
+ },
165
+ axisPointer: {
166
+ snap: false
167
+ }
168
+ },
169
+ yAxis: getFormattedAxis(yAxis, format),
170
+ animation: false,
171
+ tooltip: {
172
+ show: true,
173
+ // ECharts tooltip content hidden by default since we use custom tooltip instead.
174
+ // Stacked bar uses ECharts tooltip so subgroup data shows correctly.
175
+ showContent: isStackedBar,
176
+ trigger: isStackedBar ? 'item' : 'axis',
177
+ appendToBody: isStackedBar
178
+ },
179
+ // https://echarts.apache.org/en/option.html#axisPointer
180
+ axisPointer: {
181
+ type: 'line',
182
+ z: 0,
183
+ triggerEmphasis: false,
184
+ triggerTooltip: false,
185
+ snap: false
186
+ },
187
+ toolbox: {
188
+ feature: {
189
+ dataZoom: {
190
+ icon: null,
191
+ yAxisIndex: 'none'
192
+ }
193
+ }
194
+ },
195
+ grid
196
+ };
197
+ if (__experimentalEChartsOptionsOverride) {
198
+ return __experimentalEChartsOptionsOverride(option);
199
+ }
200
+ return option;
201
+ }, [
202
+ data,
203
+ seriesMapping,
204
+ timeScale,
205
+ yAxis,
206
+ format,
207
+ grid,
208
+ noDataOption,
209
+ __experimentalEChartsOptionsOverride,
210
+ noDataVariant,
211
+ timeZone,
212
+ isStackedBar,
213
+ enablePinning,
214
+ pinnedCrosshair
215
+ ]);
216
+ // Update adjacent charts so tooltip is unpinned when current chart is clicked.
217
+ useEffect(()=>{
218
+ // Only allow pinning one tooltip at a time, subsequent tooltip click unpins previous.
219
+ // Multiple tooltips can only be pinned if Ctrl or Cmd key is pressed while clicking.
220
+ const multipleTooltipsPinned = tooltipPinnedCoords !== null && lastTooltipPinnedCoords !== null;
221
+ if (multipleTooltipsPinned) {
222
+ if (!isEqual(lastTooltipPinnedCoords, tooltipPinnedCoords)) {
223
+ setTooltipPinnedCoords(null);
224
+ if (tooltipPinnedCoords !== null && pinnedCrosshair !== null) {
225
+ setPinnedCrosshair(null);
226
+ }
227
+ }
228
+ }
229
+ // tooltipPinnedCoords CANNOT be in dep array or tooltip pinning breaks in the current chart's onClick
230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
231
+ }, [
232
+ lastTooltipPinnedCoords,
233
+ seriesMapping
234
+ ]);
235
+ return /*#__PURE__*/ _jsxs(Box, {
236
+ style: {
237
+ height
238
+ },
239
+ // onContextMenu={(e) => {
240
+ // // TODO: confirm tooltip pinning works correctly on Windows, should e.preventDefault() be added here
241
+ // e.preventDefault(); // Prevent the default behaviour when right clicked
242
+ // }}
243
+ onClick: (e)=>{
244
+ // Allows user to opt-in to multi tooltip pinning when Ctrl or Cmd key held down
245
+ const isControlKeyPressed = e.ctrlKey || e.metaKey;
246
+ if (isControlKeyPressed) {
247
+ e.preventDefault();
248
+ }
249
+ // Determine where on chart canvas to plot pinned crosshair as markLine.
250
+ const pointInGrid = getPointInGrid(e.nativeEvent.offsetX, e.nativeEvent.offsetY, chartRef.current);
251
+ if (pointInGrid === null) {
252
+ return;
253
+ }
254
+ // Pin and unpin when clicking on chart canvas but not tooltip text.
255
+ if (isPinningEnabled && e.target instanceof HTMLCanvasElement) {
256
+ // Pin tooltip and update shared charts context to remember these coordinates.
257
+ const pinnedPos = {
258
+ page: {
259
+ x: e.pageX,
260
+ y: e.pageY
261
+ },
262
+ client: {
263
+ x: e.clientX,
264
+ y: e.clientY
265
+ },
266
+ plotCanvas: {
267
+ x: e.nativeEvent.offsetX,
268
+ y: e.nativeEvent.offsetY
269
+ },
270
+ target: e.target
271
+ };
272
+ setTooltipPinnedCoords((current)=>{
273
+ if (current === null) {
274
+ return pinnedPos;
275
+ } else {
276
+ setPinnedCrosshair(null);
277
+ return null;
278
+ }
279
+ });
280
+ setPinnedCrosshair((current)=>{
281
+ // Only add pinned crosshair line series when there is not one already in seriesMapping.
282
+ if (current === null) {
283
+ const cursorX = pointInGrid[0];
284
+ // Only need to loop through first dataset source since getCommonTimeScale ensures xAxis timestamps are consistent
285
+ const firstTimeSeriesValues = data[0]?.values;
286
+ const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);
287
+ // Crosshair snaps to nearest timestamp since cursor may be slightly to left or right
288
+ const pinnedCrosshair = merge({}, DEFAULT_PINNED_CROSSHAIR, {
289
+ markLine: {
290
+ data: [
291
+ {
292
+ xAxis: closestTimestamp
293
+ }
294
+ ]
295
+ }
296
+ });
297
+ return pinnedCrosshair;
298
+ } else {
299
+ // Clear previously set pinned crosshair
300
+ return null;
301
+ }
302
+ });
303
+ if (!isControlKeyPressed) {
304
+ setLastTooltipPinnedCoords(pinnedPos);
305
+ }
306
+ }
307
+ },
308
+ onMouseDown: (e)=>{
309
+ const { clientX } = e;
310
+ setIsDragging(true);
311
+ setStartX(clientX);
312
+ },
313
+ onMouseMove: (e)=>{
314
+ // Allow clicking inside tooltip to copy labels.
315
+ if (!(e.target instanceof HTMLCanvasElement)) {
316
+ return;
317
+ }
318
+ const { clientX } = e;
319
+ if (isDragging) {
320
+ const deltaX = clientX - startX;
321
+ if (deltaX > 0) {
322
+ // Hide tooltip when user drags to zoom.
323
+ setShowTooltip(false);
324
+ }
325
+ }
326
+ },
327
+ onMouseUp: ()=>{
328
+ setIsDragging(false);
329
+ setStartX(0);
330
+ setShowTooltip(true);
331
+ },
332
+ onMouseLeave: ()=>{
333
+ if (tooltipPinnedCoords === null) {
334
+ setShowTooltip(false);
335
+ }
336
+ if (chartRef.current !== undefined) {
337
+ clearHighlightedSeries(chartRef.current);
338
+ }
339
+ },
340
+ onMouseEnter: ()=>{
341
+ setShowTooltip(true);
342
+ if (chartRef.current !== undefined) {
343
+ enableDataZoom(chartRef.current);
344
+ }
345
+ },
346
+ onDoubleClick: (e)=>{
347
+ setTooltipPinnedCoords(null);
348
+ // either dispatch ECharts restore action to return to orig state or allow consumer to define behavior
349
+ if (onDoubleClick === undefined) {
350
+ if (chartRef.current !== undefined) {
351
+ restoreChart(chartRef.current);
352
+ }
353
+ } else {
354
+ onDoubleClick(e);
355
+ }
356
+ },
357
+ children: [
358
+ showTooltip === true && option.tooltip?.showContent === false && tooltipConfig.hidden !== true && /*#__PURE__*/ _jsx(TimeChartTooltip, {
359
+ containerId: chartsTheme.tooltipPortalContainerId,
360
+ chartRef: chartRef,
361
+ data: data,
362
+ seriesMapping: seriesMapping,
363
+ wrapLabels: tooltipConfig.wrapLabels,
364
+ enablePinning: isPinningEnabled,
365
+ pinnedPos: tooltipPinnedCoords,
366
+ format: format,
367
+ onUnpinClick: ()=>{
368
+ // Unpins tooltip when clicking Pin icon in TooltipHeader.
369
+ setTooltipPinnedCoords(null);
370
+ // Clear previously set pinned crosshair.
371
+ setPinnedCrosshair(null);
372
+ }
373
+ }),
374
+ /*#__PURE__*/ _jsx(EChart, {
375
+ sx: {
376
+ width: '100%',
377
+ height: '100%'
378
+ },
379
+ option: option,
380
+ theme: chartsTheme.echartsTheme,
381
+ onEvents: handleEvents,
382
+ _instance: chartRef,
383
+ syncGroup: syncGroup
384
+ })
385
+ ]
386
+ });
387
+ });
388
+
389
+ //# sourceMappingURL=TimeSeriesChartBase.js.map
@@ -0,0 +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,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,QACX,qBAAqB;AAC5B,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAGEC,sBAAsB,EAEtB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G;gBACzB,IAAI0G,SAAS,GAAG;oBACd,wCAAwC;oBACxCjH,eAAe;gBACjB;YACF;QACF;QACAkH,WAAW;YACT5G,cAAc;YACdE,UAAU;YACVR,eAAe;QACjB;QACAmH,cAAc;YACZ,IAAIlH,wBAAwB,MAAM;gBAChCD,eAAe;YACjB;YACA,IAAIF,SAAS4B,OAAO,KAAKhB,WAAW;gBAClChD,uBAAuBoC,SAAS4B,OAAO;YACzC;QACF;QACA0F,cAAc;YACZpH,eAAe;YACf,IAAIF,SAAS4B,OAAO,KAAKhB,WAAW;gBAClC5C,eAAegC,SAAS4B,OAAO;YACjC;QACF;QACApC,eAAe,CAACgG;YACdpF,uBAAuB;YACvB,sGAAsG;YACtG,IAAIZ,kBAAkBoB,WAAW;gBAC/B,IAAIZ,SAAS4B,OAAO,KAAKhB,WAAW;oBAClCvC,aAAa2B,SAAS4B,OAAO;gBAC/B;YACF,OAAO;gBACLpC,cAAcgG;YAChB;QACF;;YAGCvF,gBAAgB,QACf,AAAC6C,OAAO0B,OAAO,EAA6BE,gBAAgB,SAC5DtF,cAAcmI,MAAM,KAAK,sBACvB,KAACjJ;gBACCkJ,aAAa7H,YAAY8H,wBAAwB;gBACjDzH,UAAUA;gBACVpB,MAAMA;gBACNC,eAAeA;gBACf6I,YAAYtI,cAAcsI,UAAU;gBACpC9H,eAAeG;gBACfoG,WAAWhG;gBACXlB,QAAQA;gBACR0I,cAAc;oBACZ,0DAA0D;oBAC1DvH,uBAAuB;oBACvB,yCAAyC;oBACzCE,mBAAmB;gBACrB;;0BAGN,KAACvC;gBACC6J,IAAI;oBACFC,OAAO;oBACPlJ,QAAQ;gBACV;gBACAmE,QAAQA;gBACRgF,OAAOnI,YAAYoI,YAAY;gBAC/BC,UAAUhG;gBACViG,WAAWjI;gBACXV,WAAWA;;;;AAInB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeriesChartPanel.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesChartPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAIhE,OAAO,EAQL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,UAAU,EAIX,MAAM,2BAA2B,CAAC;AAiBnC,OAAO,EACL,sBAAsB,EAKvB,MAAM,2BAA2B,CAAC;AAUnC,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAWtF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CAqVrF"}
1
+ {"version":3,"file":"TimeSeriesChartPanel.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesChartPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAIhE,OAAO,EAQL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,UAAU,EAIX,MAAM,2BAA2B,CAAC;AAgBnC,OAAO,EACL,sBAAsB,EAKvB,MAAM,2BAA2B,CAAC;AAWnC,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAWtF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CAqVrF"}
@@ -16,10 +16,11 @@ import { Box, useTheme } from '@mui/material';
16
16
  import merge from 'lodash/merge';
17
17
  import { getTimeSeriesValues, DEFAULT_LEGEND, getCalculations, formatValue } from '@perses-dev/core';
18
18
  import { LEGEND_VALUE_CONFIG, useTimeRange, validateLegendSpec, legendValues } from '@perses-dev/plugin-system';
19
- import { YAxisLabel, useChartsTheme, ContentWithLegend, useId, TimeChart, DEFAULT_TOOLTIP_CONFIG } from '@perses-dev/components';
19
+ import { YAxisLabel, useChartsTheme, ContentWithLegend, useId, DEFAULT_TOOLTIP_CONFIG } from '@perses-dev/components';
20
20
  import { DEFAULT_FORMAT, DEFAULT_VISUAL, THRESHOLD_PLOT_INTERVAL } from './time-series-chart-model';
21
21
  import { getTimeSeries, getCommonTimeScaleForQueries, convertPanelYAxis, getThresholdSeries, convertPercentThreshold } from './utils/data-transform';
22
22
  import { getSeriesColor } from './utils/palette-gen';
23
+ import { TimeSeriesChartBase } from './TimeSeriesChartBase';
23
24
  // Using an "ALL" value to handle the case on first loading the chart where we
24
25
  // want to select all, but do not want all of the legend items to be visually highlighted.
25
26
  // This helps us differentiate those cases more clearly instead of inferring it
@@ -317,7 +318,7 @@ export function TimeSeriesChartPanel(props) {
317
318
  name: yAxis.label,
318
319
  height: height
319
320
  }),
320
- /*#__PURE__*/ _jsx(TimeChart, {
321
+ /*#__PURE__*/ _jsx(TimeSeriesChartBase, {
321
322
  ref: chartRef,
322
323
  height: height,
323
324
  data: timeChartData,