diff --git a/@codexteam/ui/dev/pages/components/Chart.vue b/@codexteam/ui/dev/pages/components/Chart.vue index ee008846..d07f1cfe 100644 --- a/@codexteam/ui/dev/pages/components/Chart.vue +++ b/@codexteam/ui/dev/pages/components/Chart.vue @@ -65,13 +65,6 @@ Static series legend under the chart: color dot + label for each line. Off by default so existing layouts stay the same.

-
- Try it: - -
@@ -87,6 +80,11 @@ :is-disabled="false" :items="paletteColorItems" /> + legend: +
- Multiple Lines + Shared scale + +

+ Both series hit 50 on the same tick. They must sit on one horizontal line. +

+
+
+ +
+
+ + + Single spike +

+ One non-zero point among zeros — should still show as a marker. +

+
+ +
+
+ + + Stacked + +

+ Many-series on top (tooltip can overlap the chart below). Some ticks have only one or two non-zero series. +

+
+
+ +
@@ -121,7 +161,7 @@
@@ -137,7 +177,7 @@ @@ -225,9 +265,9 @@ const detalizationSelected = ref({ }); /** - * Toggle static series legend in the preview + * Legend toggle for the Single Line preview */ -const legendEnabled = ref(true); +const legendEnabled = ref(false); /** * Available detalization options for the Select component @@ -337,6 +377,60 @@ const multipleLinesData = computed(() => { ]; }); +/** + * Two ranges, same count on one tick — must share Y + */ +const sharedScaleData = computed(() => { + const timestamps = demoTimestamps.value; + const mid = Math.floor(timestamps.length / 2); + + return [ + { + label: 'wide', + color: ChartLineColor.Red, + data: timestamps.map((timestamp, index) => ({ + timestamp, + count: index === mid ? 50 : 180, + })), + }, + { + label: 'narrow', + color: ChartLineColor.Blue, + data: timestamps.map((timestamp, index) => ({ + timestamp, + count: index === mid ? 50 : 20, + })), + }, + ]; +}); + +/** + * One event among zeros + */ +const spikeData = computed(() => { + const timestamps = demoTimestamps.value; + const mid = Math.floor(timestamps.length / 2); + + return [ + { + label: 'incident', + color: ChartLineColor.Orange, + data: timestamps.map((timestamp, index) => ({ + timestamp, + count: index === mid ? 90 : 0, + })), + }, + ]; +}); + +/** + * Long labels to check tooltip ellipsis + */ +const longPreviewLabels: Partial> = { + [ChartLineColor.Red]: 'accepted-events-from-the-ingestion-pipeline', + [ChartLineColor.LightGrey]: 'rate-limited-requests-waiting-in-queue', +}; + /** * All hardcoded palette tokens stacked for comparison */ @@ -344,10 +438,20 @@ const paletteSeriesData = computed(() => { const timestamps = demoTimestamps.value; const bases = [150, 130, 110, 95, 80, 70, 55, 40, 25]; - return paletteTokens.map((color, index) => ({ - label: color, - data: generateData(timestamps, bases[index] ?? 50), + return paletteTokens.map((color, seriesIndex) => ({ + label: longPreviewLabels[color] ?? color, color, + data: timestamps.map((timestamp, tick) => { + const activeSeries = (tick % 7) + 1; + const count = seriesIndex < activeSeries + ? Math.floor(Math.random() * (bases[seriesIndex] ?? 50)) + 10 + : 0; + + return { + timestamp, + count, + }; + }), })); }); @@ -438,5 +542,9 @@ const paletteSeriesData = computed(() => { &--tall { padding-bottom: 240px; } + + &--stack { + gap: var(--spacing-m); + } } diff --git a/@codexteam/ui/package.json b/@codexteam/ui/package.json index d54b572f..70c7ea3f 100644 --- a/@codexteam/ui/package.json +++ b/@codexteam/ui/package.json @@ -1,6 +1,6 @@ { "name": "@codexteam/ui", - "version": "0.2.6", + "version": "0.2.7", "type": "module", "sideEffects": [ "*.css", diff --git a/@codexteam/ui/src/vue/components/chart/Chart.vue b/@codexteam/ui/src/vue/components/chart/Chart.vue index 93bfe1ca..8d9b488b 100644 --- a/@codexteam/ui/src/vue/components/chart/Chart.vue +++ b/@codexteam/ui/src/vue/components/chart/Chart.vue @@ -1,5 +1,10 @@