Skip to content

Commit 3022ac6

Browse files
committed
Review fixes
1 parent 23f4a69 commit 3022ac6

3 files changed

Lines changed: 19 additions & 20 deletions

File tree

docs/src/pages/charts/ChordDiagramPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export default function ChordDiagramPage() {
289289
]`,
290290
colorBy: '"id"',
291291
edgeColorBy: '"source"',
292-
colorScheme: '["#6366f1", "#22c55e", "##f59e0b", "#ef4444", "#06b6d4"]',
292+
colorScheme: '["#6366f1", "#22c55e", "#f59e0b", "#ef4444", "#06b6d4"]',
293293
edgeOpacity: "0.4",
294294
padAngle: "0.03",
295295
}}

src/components/charts/shared/statisticalOverlays.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,27 +192,12 @@ function buildPrecomputed(
192192
return { ...d, [SEGMENT_FIELD]: segment }
193193
})
194194

195-
// Collect training-base copies BEFORE boundary duplication so they don't
196-
// interfere with the sequential boundary-point logic.
197-
const trainBaseCopies: Record<string, any>[] = []
198-
if (config.trainUnderline) {
199-
for (const d of tagged) {
200-
if (d[SEGMENT_FIELD] === "training") {
201-
trainBaseCopies.push({ ...d, [SEGMENT_FIELD]: "training-base" as SegmentType })
202-
}
203-
}
204-
}
205-
206195
// Duplicate boundary points so adjacent segments share an endpoint (no gap).
207196
// When _groupBy is set (multi-metric data), we must group by metric first
208197
// because the flat data is interleaved by timestamp (A_t1, B_t1, A_t2, B_t2...),
209198
// so adjacent-pair scanning would never find within-group segment transitions.
210199
const groupByField = config._groupBy
211200
const processedData: Record<string, any>[] = []
212-
// Prepend training-base copies so they appear first in the data stream —
213-
// PipelineStore iterates groups in insertion order, so the solid underline
214-
// renders before (beneath) the dashed training line.
215-
processedData.push(...trainBaseCopies)
216201

217202
if (groupByField) {
218203
// Group-aware boundary duplication: collect points per group, find
@@ -254,6 +239,20 @@ function buildPrecomputed(
254239
}
255240
}
256241

242+
// Collect training-base copies AFTER boundary duplication so the solid
243+
// underline includes bridge points and covers the same x-extent as the
244+
// dashed training segment.
245+
if (config.trainUnderline) {
246+
const trainBaseCopies: Record<string, any>[] = []
247+
for (const d of processedData) {
248+
if (d[SEGMENT_FIELD] === "training") {
249+
trainBaseCopies.push({ ...d, [SEGMENT_FIELD]: "training-base" as SegmentType })
250+
}
251+
}
252+
// Prepend so training-base renders first (beneath the dashed training line)
253+
processedData.unshift(...trainBaseCopies)
254+
}
255+
257256
const annotations: Record<string, any>[] = []
258257

259258
// Envelope from upper/lower bounds

src/components/charts/xy/LineChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ export const LineChart = forwardRef(
375375
// When the user provides a function accessor, we bake resolved values into
376376
// each datum under a synthetic field so the overlay pipeline + annotation
377377
// renderer can access them by string key.
378-
const xAccStr = typeof xAccessor === "string" ? xAccessor : "__resolvedX"
379-
const yAccStr = typeof yAccessor === "string" ? yAccessor : "__resolvedY"
378+
const xAccStr = typeof xAccessor === "string" ? xAccessor : "__semiotic_resolvedX"
379+
const yAccStr = typeof yAccessor === "string" ? yAccessor : "__semiotic_resolvedY"
380380

381381
// Lazy-load statistical overlays — only fetches the module when forecast/anomaly props are used
382382
const [statisticalResult, setStatisticalResult] = useState<{
@@ -393,8 +393,8 @@ export const LineChart = forwardRef(
393393
if (!needsX && !needsY) return safeData as Record<string, any>[]
394394
return (safeData as Record<string, any>[]).map(d => {
395395
const copy = { ...d }
396-
if (needsX) copy.__resolvedX = (xAccessor as (d: any) => any)(d)
397-
if (needsY) copy.__resolvedY = (yAccessor as (d: any) => any)(d)
396+
if (needsX) copy.__semiotic_resolvedX = (xAccessor as (d: any) => any)(d)
397+
if (needsY) copy.__semiotic_resolvedY = (yAccessor as (d: any) => any)(d)
398398
return copy
399399
})
400400
}, [safeData, forecast, anomaly, xAccessor, yAccessor])

0 commit comments

Comments
 (0)