Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Test data for TimeSeries interactive behavior and boundary validation
// Tests navigation, zoom operations and ensures charts stay within visible bounds
 
// Configuration for TimeSeries with MultiChannel
export const multiChannelConfig = `
<View>
  <Header value="TimeSeries Interactive Navigation Testing"/>
  <TimeSeriesLabels name="label" toName="ts">
    <Label value="High" background="red"/>
    <Label value="Low" background="blue"/>
    <Label value="Normal" background="green"/>
  </TimeSeriesLabels>
  <TimeSeries name="ts" value="$timeseries" valueType="json" timeColumn="time" overviewChannels="ascending">
    <MultiChannel height="300">
      <Channel column="ascending"
               units="units"
               displayFormat=",.1f"
               legend="Ascending Trend"
               strokeColor="#1f77b4"/>
      <Channel column="descending"
               units="units"
               displayFormat=",.1f"
               legend="Descending Trend"
               strokeColor="#ff7f0e"/>
      <Channel column="high_variance"
               units="units"
               displayFormat=",.1f"
               legend="High Variance"
               strokeColor="#2ca02c"/>
    </MultiChannel>
  </TimeSeries>
</View>
`;
 
// Configuration for single channel TimeSeries
export const singleChannelConfig = `
<View>
  <Header value="TimeSeries Single Channel Navigation Testing"/>
  <TimeSeriesLabels name="label" toName="ts">
    <Label value="Peak" background="red"/>
    <Label value="Valley" background="blue"/>
  </TimeSeriesLabels>
  <TimeSeries name="ts" value="$timeseries" valueType="json" timeColumn="time" overviewChannels="ascending">
    <Channel column="ascending"
             units="units"
             displayFormat=",.1f"
             legend="Ascending Data"
             strokeColor="#1f77b4"/>
  </TimeSeries>
</View>
`;
 
// Generate test data with varied patterns for navigation testing
function generateNavigationTestData(pointCount = 200000) {
  const data = {
    time: [] as number[],
    ascending: [] as number[],
    descending: [] as number[],
    high_variance: [] as number[],
  };
 
  const timeStep = 1;
 
  for (let i = 0; i < pointCount; i++) {
    const t = i * timeStep;
    data.time.push(t);
 
    // Ascending trend with moderate values (0 to 1000)
    data.ascending.push(i * (1000 / pointCount) + Math.sin(t * 0.01) * 50);
 
    // Descending trend with moderate negative values (0 to -800)
    data.descending.push(-i * (800 / pointCount) + Math.cos(t * 0.008) * 40);
 
    // High variance data oscillating between -500 and 500
    data.high_variance.push(
      500 * Math.sin(t * 0.02) + 200 * Math.cos(t * 0.05) + 100 * Math.sin(t * 0.1) * Math.random(),
    );
  }
 
  return data;
}
 
// Heavy dataset for displacement testing (200K points) - wrapped in proper format for LabelStudio
export const heavyDatasetForDisplacement = {
  timeseries: generateNavigationTestData(200000),
};