ml-time-graph 1.7.2 → 1.8.3
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/CHANGELOG.md +214 -8
- package/README.de.md +104 -11
- package/README.md +101 -11
- package/SKILLS.md +157 -4
- package/USAGE.md +326 -3
- package/dist/analyze/index.d.ts +54 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +107 -7
- package/dist/index.js +27 -26
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +1 -1
- package/dist/internals.d.ts +104 -26
- package/dist/internals.js +15 -15
- package/dist/{scale-D6NtEaUB.d.ts → scale-CoTgJ27U.d.ts} +71 -12
- package/dist/{series_renderer-COVNvq2x.d.ts → slug-0lFk9pY7.d.ts} +18 -2
- package/package.json +17 -13
package/dist/analyze/index.d.ts
CHANGED
|
@@ -289,6 +289,59 @@ declare function sampleStdDev(samples: (number | null)[]): number | null;
|
|
|
289
289
|
*/
|
|
290
290
|
declare function rollingStdDev(data: DataPoint[], windowMs: number, sample?: boolean): DataPoint[];
|
|
291
291
|
|
|
292
|
+
/*!
|
|
293
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
294
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
295
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Rolling arithmetic mean over a sliding time window. For each input point at
|
|
300
|
+
* time `t`, emits an output point whose value is the mean of all valid samples
|
|
301
|
+
* in `[t - windowMs, t]`. The output has the same length / timestamps as the
|
|
302
|
+
* input, and the same shape as {@link rollingStdDev} and `rollingMkt`.
|
|
303
|
+
*
|
|
304
|
+
* `data` must be sorted by `time` ascending. `value: null` is skipped; a window
|
|
305
|
+
* without a single valid sample yields `value: null`.
|
|
306
|
+
*
|
|
307
|
+
* Diese Funktion lag bis 1.8.0 als privater Helfer im Overlay-Renderer der
|
|
308
|
+
* Chart-Bibliothek — und damit war die Frage "koennte man das Overlay auch
|
|
309
|
+
* ausserhalb rechnen und als normale Serie uebergeben?" nicht mit Ja zu
|
|
310
|
+
* beantworten: `rollingMkt` und `rollingStdDev` waren oeffentlich, der
|
|
311
|
+
* gleitende Mittelwert nicht. Wer es von aussen versuchte, musste ihn
|
|
312
|
+
* nachbauen und konnte nur hoffen, dieselben Zahlen zu treffen.
|
|
313
|
+
*
|
|
314
|
+
* @param data Sorted input DataPoints.
|
|
315
|
+
* @param windowMs Window length in ms.
|
|
316
|
+
*/
|
|
317
|
+
declare function rollingMean(data: DataPoint[], windowMs: number): DataPoint[];
|
|
318
|
+
/**
|
|
319
|
+
* Exponentiell gewichteter gleitender Mittelwert ueber ein ZEITfenster.
|
|
320
|
+
*
|
|
321
|
+
* Das klassische EMA rechnet mit `alpha = 2/(N+1)` und einer Anzahl N von
|
|
322
|
+
* Punkten -- das setzt einen gleichmaessigen Takt voraus. Messreihen aus
|
|
323
|
+
* Sensoren haben den oft nicht: Abstaende schwanken, und nach einer Luecke
|
|
324
|
+
* liegen Stunden zwischen zwei Werten. Mit einer festen Punktzahl zaehlt der
|
|
325
|
+
* Wert vor der Luecke dann genauso schwer wie der davor.
|
|
326
|
+
*
|
|
327
|
+
* Deshalb hier die zeitbasierte Form: `alpha = 1 - exp(-dt / tau)` mit
|
|
328
|
+
* `tau = windowMs`. Das Gewicht eines alten Wertes faellt mit der
|
|
329
|
+
* VERSTRICHENEN ZEIT, nicht mit der Anzahl der Messungen dazwischen, und nach
|
|
330
|
+
* einer langen Luecke faengt die Kurve praktisch beim neuen Wert an. Bei
|
|
331
|
+
* gleichmaessigem Takt `dt` geht sie in das klassische EMA ueber.
|
|
332
|
+
*
|
|
333
|
+
* Gleiche Form wie {@link rollingMean}: gleiche Laenge, gleiche Zeitstempel,
|
|
334
|
+
* `value: null` wird uebersprungen. `data` muss nach `time` aufsteigend
|
|
335
|
+
* sortiert sein.
|
|
336
|
+
*
|
|
337
|
+
* Nicht zu verwechseln mit `MovingAvg.exponential()` in `ml-time-graph`: die
|
|
338
|
+
* nimmt eine Punktzahl und bleibt, was sie ist.
|
|
339
|
+
*
|
|
340
|
+
* @param data Sorted input DataPoints.
|
|
341
|
+
* @param windowMs Zeitkonstante tau in ms.
|
|
342
|
+
*/
|
|
343
|
+
declare function rollingEma(data: DataPoint[], windowMs: number): DataPoint[];
|
|
344
|
+
|
|
292
345
|
/*!
|
|
293
346
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
294
347
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -534,4 +587,4 @@ interface F0Opts {
|
|
|
534
587
|
*/
|
|
535
588
|
declare function f0Sterilization(data: DataPoint[], opts?: F0Opts): number;
|
|
536
589
|
|
|
537
|
-
export { type AggregatedPoint, type AggregationConfig, type AggregationMode, type AggregationThresholds, type ComputeLimitsOpts, DEFAULT_ACTIVATION_ENERGY, type DataPoint, type F0Opts, type HotColdSpotsResult, type LimitExcursion, type LimitStats, type LimitStatsPoint, type LongTermInsight, type MktPoint, type NamedSeries, PRODUCT_PROFILES, type PredictOpts, type PredictResult, type ProductConfig, type ProductType, type SensorStat, SeriesProcessor, type SpatialPoint, type StatsAggregatedPoint, StatsAggregator, type StatsResult, type StdDevPoint, type TrendFit, type TrendPoint, aggregateBySlot, aggregateWithStats, analyzeLongTermTrends, computeLimitExcursions, createAggr, currentTrend, detectGaps, downsample, f0Sterilization, hotColdSpots, linearFit, mkt, predictTimeToThreshold, rollingMkt, rollingStdDev, rollingTrend, sampleStdDev, spatialDelta, stdDev, varianceCoefficient };
|
|
590
|
+
export { type AggregatedPoint, type AggregationConfig, type AggregationMode, type AggregationThresholds, type ComputeLimitsOpts, DEFAULT_ACTIVATION_ENERGY, type DataPoint, type F0Opts, type HotColdSpotsResult, type LimitExcursion, type LimitStats, type LimitStatsPoint, type LongTermInsight, type MktPoint, type NamedSeries, PRODUCT_PROFILES, type PredictOpts, type PredictResult, type ProductConfig, type ProductType, type SensorStat, SeriesProcessor, type SpatialPoint, type StatsAggregatedPoint, StatsAggregator, type StatsResult, type StdDevPoint, type TrendFit, type TrendPoint, aggregateBySlot, aggregateWithStats, analyzeLongTermTrends, computeLimitExcursions, createAggr, currentTrend, detectGaps, downsample, f0Sterilization, hotColdSpots, linearFit, mkt, predictTimeToThreshold, rollingEma, rollingMean, rollingMkt, rollingStdDev, rollingTrend, sampleStdDev, spatialDelta, stdDev, varianceCoefficient };
|
package/dist/analyze/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=class{static interpolateDataPoint(n,u,l){return {time:n.time+Math.round(l*(u.time-n.time)),value:(n.value??0)+l*((u.value??0)-(n.value??0))}}static interpolateAggregatedPoint(n,u,l){let i=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(u.time-n.time),min:i(n.min,u.min),max:i(n.max,u.max),avg:i(n.avg,u.avg),count:Math.round(n.count+l*(u.count-n.count))}}static getRuns(n,u,l=0){let i=[...n].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of i){let o=u(r),m=l>0&&a&&r.time-a.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(n,u,l,i){if(n.length===0)return [];if(u.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...u].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let f=0;f<e.length&&m>=e[f];f++)s=f+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],f=n[m],g=l(s),d=l(f),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let b=g;for(let v of p){let x=(v-g)/(d-g),h=i(s,f,x);o.push(h);let c=r((b+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[h],b=v;}(p.length===0||p[p.length-1]!==d)&&o.push(f);}if(o.length>1){let m=l(o[0]),s=l(o[o.length-1]),f=r((m+s)/2);t.push({data:o,zoneIndex:f,zoneLow:a(f)});}return t}static splitByThreshold(n,u,l,i){let e=this.splitByBoundaries(n,[u],l,i),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,N=273.15;function y(n,u,l,i=1){let e=u.filter(h=>h.value!==null&&h.value!==void 0&&!Number.isNaN(h.value)).map(h=>h.value);if(!e.length)return {time:n,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:l?0:null,minutesBelowLow:l?0:null,count:0};let t=1/0,a=-1/0,r=0;for(let h of e)h<t&&(t=h),h>a&&(a=h),r+=h;let o=r/e.length,m=l?0:null,s=l?0:null;if(l)for(let h=0;h<u.length;h++){let c=u[h];if(c.value!==null&&c.value!==void 0){let M=u[h+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>l.limitHigh&&(m+=w),c.value<l.limitLow&&(s+=w);}}let f=0,g=0,d=(l?.activationEnergy??83144)/D;for(let h of e){f+=Math.pow(h-o,2);let c=h+N;g+=Math.exp(-d/c);}let p=f/e.length,b=Math.sqrt(p),v=null,x=null;if(e.length>=i){let h=g/e.length,c=d/-Math.log(h);v=Number((c-N).toFixed(2)),x=Number((v-o).toFixed(2));}return {time:n,min:Number(t.toFixed(2)),max:Number(a.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:x,stdDev:Number(b.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function A(n,u="hourly",l,i,e=1){if(!n.length)return [];let t=u==="hourly"?36e5:u==="daily"?864e5:l??3600*1e3,a=[...n].sort((s,f)=>s.time-f.time),r=[],o=a[0].time,m=[];for(let s of a){for(;s.time-o>=t;)r.push(y(o,m,i,e)),o+=t,m=[];m.push(s);}return r.push(y(o,m,i,e)),r}function S(n,u){let l=1/0,i=-1/0,e=0;for(let a of u)a<l&&(l=a),a>i&&(i=a),e+=a;let t=e/u.length;return {time:n,min:l,max:i,avg:t,count:u.length}}function z(n,u=6e4){if(n.length<2)return [];let l=[...n].sort((e,t)=>e.time-t.time),i=[];for(let e=1;e<l.length;e++)l[e].time-l[e-1].time>u&&i.push({startTime:l[e-1].time,endTime:l[e].time});return i}function B(n){let u=[],l=0,i=0,e=0,t=0;for(let a of n)a.count>0&&(e++,a.minutesAboveHigh&&(l+=a.minutesAboveHigh),a.stdDev&&a.stdDev>i&&(i=a.stdDev),a.deltaMkt&&a.deltaMkt>2&&t++);return e===0?[]:(l>120&&u.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(l)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&u.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),i>4&&u.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${i}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),u)}function P(n,u){if(n.length<=u)return n;let l=[],i=Math.ceil(n.length/u);l.push(n[0]);for(let e=1;e<n.length;e+=i)l.push(n[Math.min(e,n.length-1)]);return l}function _(n,u="hourly",l){let i={limitLow:l.low,limitHigh:l.high,activationEnergy:l.activationEnergy};return A(n,u,l.interval,i,l.minCountForMkt??1)}var C=class{static compute(n){let u=n.map(r=>r.value).filter(r=>r!==null).sort((r,o)=>r-o);if(u.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let l=u.length,i=u.reduce((r,o)=>r+o,0)/l,e=l%2===1?u[Math.floor(l/2)]:(u[l/2-1]+u[l/2])/2,t=u.reduce((r,o)=>r+Math.pow(o-i,2),0)/l,a=Math.sqrt(t);return {min:u[0],max:u[l-1],avg:i,mean:i,median:e,stdDev:a,count:l}}static computeInRange(n,u,l){let i=n.filter(e=>e.time>=u&&e.time<=l);return this.compute(i)}};function q(n,u){let l=typeof n=="number"?n:n.mean,i=typeof n=="number"?u??NaN:n.stdDev;return !Number.isFinite(l)||!Number.isFinite(i)||l===0?null:Math.abs(i/l)*100}var G=83144;function L(n,u=83144){let l=u/8.314,i=0,e=0;for(let a of n)a!==null&&(i+=Math.exp(-l/(a+273.15)),e++);if(e===0)return null;let t=i/e;return l/-Math.log(t)-273.15}function R(n,u,l=83144){let i=new Array(n.length),e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=a-u;for(;e<t&&n[e].time<r;)e++;let o=n.slice(e,t+1).map(s=>s.value),m=L(o,l);i[t]={time:a,value:m,synthetic:true};}return i}function E(n){let u=0,l=0;for(let t of n)t!==null&&(u+=t,l++);if(l===0)return null;let i=u/l,e=0;for(let t of n){if(t===null)continue;let a=t-i;e+=a*a;}return Math.sqrt(e/l)}function F(n){let u=0,l=0;for(let t of n)t!==null&&(u+=t,l++);if(l<2)return null;let i=u/l,e=0;for(let t of n){if(t===null)continue;let a=t-i;e+=a*a;}return Math.sqrt(e/(l-1))}function V(n,u,l=false){let i=new Array(n.length),e=0,t=l?F:E;for(let a=0;a<n.length;a++){let r=n[a].time,o=r-u;for(;e<a&&n[e].time<o;)e++;let m=n.slice(e,a+1).map(f=>f.value),s=t(m);i[a]={time:r,value:s,synthetic:true};}return i}function K(n,u){let l=new Array(n.length),i=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-u;for(;i<e&&n[i].time<a;)i++;let r=0,o=0;for(let m=i;m<=e;m++){let s=n[m].value;s!==null&&(r+=s,o++);}l[e]={time:t,value:o===0?null:r/o,synthetic:true};}return l}function O(n,u){let l=new Array(n.length),i=null,e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=n[t].value;if(r===null){l[t]={time:a,value:i,synthetic:true};continue}if(i===null||u<=0)i=r;else {let o=1-Math.exp(-(a-e)/u);i=r*o+i*(1-o);}e=a,l[t]={time:a,value:i,synthetic:true};}return l}function U(n,u){let{high:l,low:i}=u,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let a=0;a<n.length;a++){let r=n[a];if(r.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||r.value>e.globalMax)&&(e.globalMax=r.value),(e.globalMin===null||r.value<e.globalMin)&&(e.globalMin=r.value);let o=l!==void 0&&r.value>l,m=i!==void 0&&r.value<i,s=o?"above":m?"below":null,f=n[a-1];if(f&&f.value!==null&&s!==null){let g=r.time-f.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&r.value>t.extremum||s==="below"&&r.value<t.extremum)&&(t.extremum=r.value)):(t&&e.excursions.push(t),t={startTime:r.time,endTime:r.time,side:s,extremum:r.value,durationMs:0});}return t&&e.excursions.push(t),e}function Y(n){if(n.length===0)return [];let u=new Map;for(let i of n)for(let e of i.data){if(e.value===null)continue;let t=u.get(e.time);t||(t=[],u.set(e.time,t)),t.push({name:i.name,value:e.value});}let l=[];for(let i of [...u.keys()].sort((e,t)=>e-t)){let e=u.get(i);if(e.length===0){l.push({time:i,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],a=e[0];for(let r=1;r<e.length;r++)e[r].value<t.value&&(t=e[r]),e[r].value>a.value&&(a=e[r]);l.push({time:i,min:t.value,max:a.value,delta:e.length<2?null:a.value-t.value,minSensor:t.name,maxSensor:a.name});}return l}function $(n){let u=[];for(let e of n){let t=0,a=0,r=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,a++,m.value<r&&(r=m.value),m.value>o&&(o=m.value));a!==0&&u.push({name:e.name,mean:t/a,min:r,max:o,count:a});}if(u.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let l=u[0],i=u[0];for(let e=1;e<u.length;e++)u[e].mean>l.mean&&(l=u[e]),u[e].mean<i.mean&&(i=u[e]);return {sensors:u,hottest:l,coldest:i,meanDelta:l.mean-i.mean}}function T(n){let u=0,l=0,i=0,e=0,t=0;for(let m of n)m.value!==null&&(u++,l+=m.time,i+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(u<2)return null;let a=u*t-l*l;if(a===0)return null;let r=(u*e-l*i)/a,o=(i-r*l)/u;return {slope:r,intercept:o,n:u}}function I(n,u){if(n.length===0)return null;let l=n[n.length-1].time,i=l-u,e=n.filter(t=>t.time>=i&&t.time<=l);return T(e)}function W(n,u){let l=[],i=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-u;for(;i<n.length&&n[i].time<a;)i++;let r=T(n.slice(i,e+1));l.push({time:t,fit:r});}return l}function Z(n,u,l={}){let i=l.lookbackMs??9e5,e=l.side??"either";if(n.length===0)return null;let t=n[n.length-1];if(t.value===null)return null;let a=I(n,i);if(!a||a.slope===0)return null;let r=a.slope>0&&t.value<u,o=a.slope<0&&t.value>u;if(e==="above"&&!r||e==="below"&&!o||e==="either"&&!r&&!o)return null;let m=(u-a.intercept)/a.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:a,currentValue:t.value}}function j(n,u={}){let l=u.refTempCelsius??121.11,i=u.zValueKelvin??10,e=0;for(let t=0;t<n.length-1;t++){let a=n[t],r=n[t+1];if(a.value===null||r.value===null)continue;let o=(r.time-a.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(a.value-l)/i),s=Math.pow(10,(r.value-l)/i);e+=(m+s)/2*o;}return e}/*!
|
|
2
2
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
3
3
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
4
4
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
@@ -12,4 +12,4 @@ var E=class{static interpolateDataPoint(n,i,t){return {time:n.time+Math.round(t*
|
|
|
12
12
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
13
13
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
14
14
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
15
|
-
*/export{G as DEFAULT_ACTIVATION_ENERGY,H as PRODUCT_PROFILES,
|
|
15
|
+
*/export{G as DEFAULT_ACTIVATION_ENERGY,H as PRODUCT_PROFILES,k as SeriesProcessor,C as StatsAggregator,A as aggregateBySlot,_ as aggregateWithStats,B as analyzeLongTermTrends,U as computeLimitExcursions,S as createAggr,I as currentTrend,z as detectGaps,P as downsample,j as f0Sterilization,$ as hotColdSpots,T as linearFit,L as mkt,Z as predictTimeToThreshold,O as rollingEma,K as rollingMean,R as rollingMkt,V as rollingStdDev,W as rollingTrend,F as sampleStdDev,Y as spatialDelta,E as stdDev,q as varianceCoefficient};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LegendOrientation, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './
|
|
2
|
-
export { T as Theme, d as drawMarker, g as getDefaultTheme, r as resetDefaultTheme, s as setDefaultTheme } from './
|
|
3
|
-
import { L as LineVariant, A as AnySeries, T as Threshold, H as Highlight, G as Gap, a as GapsConfig, b as Annotation, c as AnnotationBandConfig, D as DrawCommand, d as TimeScale, e as LinearScale, S as SeriesStyle, F as FillSpec, f as TimeSeries, g as HatchVariant, h as ThresholdLabelPosition, P as PointStyleType, i as AnnotationBandItem, j as AggregatedPoint, k as AggregatedSeries, l as DataPoint } from './scale-
|
|
4
|
-
export { m as AggregationConfig, n as AggregationMode, o as DataPointRef, E as EnumMap, p as FillBound, q as FillDirectionType, r as FillRegion, s as FillSide, t as FillStyle, u as GapConfig, v as GapLabel, w as GapRegion, x as GapStyle, y as LineDashStyle, z as LineStyle, M as MarkerStyle, B as SVGLineStyle, C as SensorType, I as SeriesOverlay, J as SeriesOverlayKind, K as SeriesType, N as ShadowStyle, O as ThresholdLabelConfig, Q as getLineStyle, R as resolveDash } from './scale-
|
|
1
|
+
import { L as LegendOrientation, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './slug-0lFk9pY7.js';
|
|
2
|
+
export { T as Theme, d as drawMarker, g as getDefaultTheme, r as resetDefaultTheme, s as setDefaultTheme, e as slugify } from './slug-0lFk9pY7.js';
|
|
3
|
+
import { L as LineVariant, A as AnySeries, T as Threshold, H as Highlight, G as Gap, a as GapsConfig, b as Annotation, c as AnnotationBandConfig, D as DrawCommand, d as TimeScale, e as LinearScale, S as SeriesStyle, F as FillSpec, f as TimeSeries, g as HatchVariant, h as ThresholdLabelPosition, P as PointStyleType, i as AnnotationBandItem, j as AggregatedPoint, k as AggregatedSeries, l as DataPoint } from './scale-CoTgJ27U.js';
|
|
4
|
+
export { m as AggregationConfig, n as AggregationMode, o as DataPointRef, E as EnumMap, p as FillBound, q as FillDirectionType, r as FillRegion, s as FillSide, t as FillStyle, u as GapConfig, v as GapLabel, w as GapRegion, x as GapStyle, y as LineDashStyle, z as LineStyle, M as MarkerStyle, B as SVGLineStyle, C as SensorType, I as SeriesOverlay, J as SeriesOverlayKind, K as SeriesType, N as ShadowStyle, O as ThresholdLabelConfig, Q as getLineStyle, R as resolveDash } from './scale-CoTgJ27U.js';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
7
7
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -54,6 +54,29 @@ interface YAxisConfig {
|
|
|
54
54
|
label?: string;
|
|
55
55
|
/** Override the value domain. `'auto'` lets the chart compute it from data. */
|
|
56
56
|
domain?: [number, number] | "auto";
|
|
57
|
+
/**
|
|
58
|
+
* Extra room above and below the data, **in pixels**. Ignored when `domain`
|
|
59
|
+
* is set explicitly — then you decide the range.
|
|
60
|
+
*
|
|
61
|
+
* The computed domain ends exactly at the smallest and largest reading, and
|
|
62
|
+
* the plot is clipped to its rectangle. A line of width 10 at the maximum
|
|
63
|
+
* therefore loses half its stroke, and a marker half its disc. That is right
|
|
64
|
+
* for the *value* and wrong for the *picture*.
|
|
65
|
+
*
|
|
66
|
+
* Pixels rather than a share of the range: the cause is in pixels
|
|
67
|
+
* (`style.line.width`, `markers.size`), and the same number then works for a
|
|
68
|
+
* series in °C and one in kW. A rule of thumb is half the widest stroke plus
|
|
69
|
+
* a little — `padding: 8` covers a 10 px line and a size-6 marker.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* axes: { left: { padding: 8 } }
|
|
73
|
+
* axes: { left: { padding: { top: 24, bottom: 4 } } } // room for a label
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
padding?: number | {
|
|
77
|
+
top?: number;
|
|
78
|
+
bottom?: number;
|
|
79
|
+
};
|
|
57
80
|
/** Format a tick value into its label text. */
|
|
58
81
|
format?: (value: number) => string;
|
|
59
82
|
/** Tick density / sizing. */
|
|
@@ -144,6 +167,20 @@ interface MLTimeGraphOptions {
|
|
|
144
167
|
clipSeries?: boolean;
|
|
145
168
|
/** Locale for i18n (e.g. 'de-DE') */
|
|
146
169
|
locale?: string;
|
|
170
|
+
/**
|
|
171
|
+
* IANA time zone for the time axis, e.g. `'Europe/Berlin'` or `'UTC'`.
|
|
172
|
+
*
|
|
173
|
+
* Unset means the machine's zone — the behaviour up to 1.8.1, kept so that
|
|
174
|
+
* nothing changes for callers who never thought about it. But a browser sits
|
|
175
|
+
* in the reader's zone and a server almost always in UTC, so the *same* JSON
|
|
176
|
+
* labelled the same reading with different times depending on where it was
|
|
177
|
+
* drawn. That is the opposite of what a DOM-free renderer is for; set this
|
|
178
|
+
* whenever a chart is produced in one place and read in another.
|
|
179
|
+
*
|
|
180
|
+
* The tick *positions* never depended on it — they are epoch arithmetic. Only
|
|
181
|
+
* the labels do.
|
|
182
|
+
*/
|
|
183
|
+
timeZone?: string;
|
|
147
184
|
/** Integrated legend configuration */
|
|
148
185
|
legend?: LegendOptions;
|
|
149
186
|
/** Markers */
|
|
@@ -190,6 +227,7 @@ declare class MLTimeGraph {
|
|
|
190
227
|
private readonly _layout;
|
|
191
228
|
private readonly _renderer?;
|
|
192
229
|
private readonly _locale?;
|
|
230
|
+
private readonly _timeZone?;
|
|
193
231
|
private readonly _legend?;
|
|
194
232
|
/** Serien auf die Zeichenflaeche beschneiden (Vorgabe: ja) — siehe options.ts. */
|
|
195
233
|
private readonly _clipSeries;
|
|
@@ -741,8 +779,6 @@ declare class SVGRenderer extends Renderer {
|
|
|
741
779
|
_toSVG(cmd: DrawCommand): string;
|
|
742
780
|
/** Register or retrieve a hatch pattern by variant. Returns the pattern id for use as fill="url(#id)". */
|
|
743
781
|
_hatchPattern(variant: string, fillColor: string | undefined): string;
|
|
744
|
-
/** Monotonic counter for unique hatch pattern ids. */
|
|
745
|
-
_hatchIndex: number;
|
|
746
782
|
_path(c: Extract<DrawCommand, {
|
|
747
783
|
type: "path";
|
|
748
784
|
}>): string;
|
|
@@ -934,4 +970,68 @@ declare function toSeries<T>(name: string, rows: readonly T[], spec?: ToDataPoin
|
|
|
934
970
|
data: DataPoint[];
|
|
935
971
|
};
|
|
936
972
|
|
|
937
|
-
|
|
973
|
+
/*!
|
|
974
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
975
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
976
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
977
|
+
*/
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Ein Fragment: dieselbe Form wie die Optionen, nur unvollstaendig.
|
|
981
|
+
*
|
|
982
|
+
* Die zweite Haelfte der Union ist der Ausweg fuer rohes JSON -- ein aus einer
|
|
983
|
+
* Datei gelesenes Fragment ist nicht typisiert, und `mergeOptions` soll es
|
|
984
|
+
* trotzdem annehmen. Ohne die erste Haelfte waere dagegen der haeufigste
|
|
985
|
+
* Aufruf unmoeglich: `mergeOptions(theme, optionen)` mit zwei typisierten
|
|
986
|
+
* Objekten -- `MLTimeGraphOptions` ist nicht auf `Record<string, unknown>`
|
|
987
|
+
* zuweisbar, weil ihm die Index-Signatur fehlt.
|
|
988
|
+
*/
|
|
989
|
+
type OptionsLayer = Partial<MLTimeGraphOptions> | Record<string, unknown>;
|
|
990
|
+
/**
|
|
991
|
+
* Layer chart options on top of each other — the later layer wins.
|
|
992
|
+
*
|
|
993
|
+
* Use it when part of the options repeats across many charts: colours, axes,
|
|
994
|
+
* legend, dimensions. Keep that part in one place and put it over the data
|
|
995
|
+
* instead of copying it into every call.
|
|
996
|
+
*
|
|
997
|
+
* ```ts
|
|
998
|
+
* const chart = new MLTimeGraph(mergeOptions(hausTheme, messwerte));
|
|
999
|
+
* ```
|
|
1000
|
+
*
|
|
1001
|
+
* **The rule, in one sentence:** objects are merged key by key, to any depth;
|
|
1002
|
+
* everything else — numbers, strings, booleans, `null` and **arrays** — is
|
|
1003
|
+
* replaced.
|
|
1004
|
+
*
|
|
1005
|
+
* Replacing arrays rather than appending is deliberate. If a layer appended, a
|
|
1006
|
+
* theme carrying a single line style would *add* it to your series instead of
|
|
1007
|
+
* styling them, and nobody would guess why there is one curve too many. To add
|
|
1008
|
+
* entries, write the array out in full — longer, but it says so.
|
|
1009
|
+
*
|
|
1010
|
+
* This is the same rule the Go port applies (`models.MergeJSON`), and the
|
|
1011
|
+
* CLI's `-with` flag uses it. A different rule on either side would mean the
|
|
1012
|
+
* same job draws two different pictures.
|
|
1013
|
+
*
|
|
1014
|
+
* Note that `{ ...a, ...b }` is *not* the same thing: the spread is shallow, so
|
|
1015
|
+
* an `axes` in the later object replaces the whole `axes` of the earlier one —
|
|
1016
|
+
* grid, ticks and all.
|
|
1017
|
+
*/
|
|
1018
|
+
declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGraphOptions;
|
|
1019
|
+
|
|
1020
|
+
/*!
|
|
1021
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
1022
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
1023
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
1024
|
+
*/
|
|
1025
|
+
/**
|
|
1026
|
+
* Die Version dieser Bibliothek — das Gegenstueck zu `version.Version` im
|
|
1027
|
+
* Go-Port, und dieselbe Zahl: beide werden von `scripts/release.mjs` im
|
|
1028
|
+
* selben Lauf gesetzt.
|
|
1029
|
+
*
|
|
1030
|
+
* Es gab sie auf der TS-Seite bisher nicht. Gebraucht wird sie, seit jedes
|
|
1031
|
+
* erzeugte SVG sagt, woraus es stammt (`<!-- MLTimeGraph x.y.z -->`): Wer
|
|
1032
|
+
* Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
|
|
1033
|
+
* kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
|
|
1034
|
+
*/
|
|
1035
|
+
declare const VERSION = "1.8.3";
|
|
1036
|
+
|
|
1037
|
+
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnySeries, type AxesConfig, type AxisLabelsStyle, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, type MktPoint, type OptionsLayer, PointStyleType, SVGRenderer, SeriesStyle, type StatsAggregatedPoint, type StdDevPoint, Threshold, ThresholdBuilder, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
|