@smartnet360/svelte-components 0.0.29 → 0.0.30

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.
@@ -19,6 +19,7 @@
19
19
  interface Props {
20
20
  chart: ChartModel;
21
21
  data: any[];
22
+ timestamps: any[]; // Pre-extracted timestamps from ChartComponent
22
23
  markers?: ChartMarker[]; // Global markers for all charts
23
24
  plotlyLayout?: any; // Optional custom Plotly layout for styling/theming
24
25
  enableAdaptation?: boolean; // Enable size-based adaptations (default: true)
@@ -31,7 +32,7 @@
31
32
  runtimeShowLegend?: boolean; // Runtime control for showing legend (default: true)
32
33
  }
33
34
 
34
- let { chart, data, markers, plotlyLayout, enableAdaptation = true, sectionId, sectionMovingAverage, layoutMovingAverage, runtimeMAOverride, runtimeShowOriginal, runtimeShowMarkers = true, runtimeShowLegend = true }: Props = $props();
35
+ let { chart, data, timestamps, markers, plotlyLayout, enableAdaptation = true, sectionId, sectionMovingAverage, layoutMovingAverage, runtimeMAOverride, runtimeShowOriginal, runtimeShowMarkers = true, runtimeShowLegend = true }: Props = $props();
35
36
 
36
37
  // Chart container div and state
37
38
  let chartDiv: HTMLElement;
@@ -145,9 +146,6 @@
145
146
  };
146
147
  });
147
148
 
148
- // Extract timestamps once, not for every KPI
149
- let timestamps = $derived(data.map(row => row['TIMESTAMP']));
150
-
151
149
  function renderChart() {
152
150
  if (!chartDiv || !data?.length) return;
153
151
 
@@ -2,6 +2,7 @@ import type { Chart as ChartModel, ChartMarker, MovingAverageConfig } from './ch
2
2
  interface Props {
3
3
  chart: ChartModel;
4
4
  data: any[];
5
+ timestamps: any[];
5
6
  markers?: ChartMarker[];
6
7
  plotlyLayout?: any;
7
8
  enableAdaptation?: boolean;
@@ -54,6 +54,9 @@
54
54
 
55
55
  let { layout, data, mode, markers, plotlyLayout, enableAdaptation = true, showGlobalControls = true }: Props = $props();
56
56
 
57
+ // Extract timestamps once at component level - all charts share the same time series
58
+ let timestamps = $derived(data.map(row => row['TIMESTAMP']));
59
+
57
60
  // Global runtime controls state - initialize from layout config
58
61
  let globalControls = $state<GlobalChartControls>({
59
62
  movingAverage: {
@@ -292,6 +295,7 @@
292
295
  <ChartCard
293
296
  {chart}
294
297
  {data}
298
+ {timestamps}
295
299
  {markers}
296
300
  {plotlyLayout}
297
301
  {enableAdaptation}
@@ -434,6 +438,7 @@
434
438
  <ChartCard
435
439
  chart={activeZoom.chart}
436
440
  {data}
441
+ {timestamps}
437
442
  {markers}
438
443
  {plotlyLayout}
439
444
  {enableAdaptation}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",