charts-displaying.ts 2.9 KB

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