@tetrascience-npm/tetrascience-react-ui 0.6.0-beta.81.1 → 0.6.0-beta.83.1
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.
- package/dist/components/charts/AreaGraph/AreaGraph.cjs +1 -1
- package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +1 -1
- package/dist/components/charts/AreaGraph/AreaGraph.js +79 -75
- package/dist/components/charts/AreaGraph/AreaGraph.js.map +1 -1
- package/dist/components/charts/BarGraph/BarGraph.cjs +1 -1
- package/dist/components/charts/BarGraph/BarGraph.cjs.map +1 -1
- package/dist/components/charts/BarGraph/BarGraph.js +37 -36
- package/dist/components/charts/BarGraph/BarGraph.js.map +1 -1
- package/dist/components/charts/Boxplot/Boxplot.cjs +1 -1
- package/dist/components/charts/Boxplot/Boxplot.cjs.map +1 -1
- package/dist/components/charts/Boxplot/Boxplot.js +84 -80
- package/dist/components/charts/Boxplot/Boxplot.js.map +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.js +51 -46
- package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +47 -47
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.js +32 -32
- package/dist/components/charts/ChromatogramChart/annotations.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +6 -6
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/constants.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/constants.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/constants.js +11 -5
- package/dist/components/charts/ChromatogramChart/constants.js.map +1 -1
- package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
- package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
- package/dist/components/charts/DotPlot/DotPlot.js +49 -59
- package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
- package/dist/components/charts/Histogram/Histogram.cjs +1 -1
- package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
- package/dist/components/charts/Histogram/Histogram.js +53 -63
- package/dist/components/charts/Histogram/Histogram.js.map +1 -1
- package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
- package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
- package/dist/components/charts/LineGraph/LineGraph.js +87 -83
- package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
- package/dist/components/charts/PieChart/PieChart.cjs +1 -1
- package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
- package/dist/components/charts/PieChart/PieChart.js +41 -48
- package/dist/components/charts/PieChart/PieChart.js.map +1 -1
- package/dist/components/charts/PlateMap/constants.cjs +1 -1
- package/dist/components/charts/PlateMap/constants.cjs.map +1 -1
- package/dist/components/charts/PlateMap/constants.js +20 -29
- package/dist/components/charts/PlateMap/constants.js.map +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.js +40 -39
- package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
- package/dist/hooks/use-plotly-theme.cjs +1 -1
- package/dist/hooks/use-plotly-theme.cjs.map +1 -1
- package/dist/hooks/use-plotly-theme.js +4 -2
- package/dist/hooks/use-plotly-theme.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +26 -76
- package/dist/index.js +37 -36
- package/dist/index.tailwind.css +1 -1
- package/dist/utils/colors.cjs +1 -1
- package/dist/utils/colors.cjs.map +1 -1
- package/dist/utils/colors.js +38 -93
- package/dist/utils/colors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChromatogramChart.js","sources":["../../../../src/components/charts/ChromatogramChart/ChromatogramChart.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\n\nimport { CHART_COLORS } from \"../../../utils/colors\";\n\n\nimport {\n groupOverlappingPeaks,\n createGroupAnnotations,\n} from \"./annotations\";\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT } from \"./constants\";\nimport {\n validateSeriesData,\n applyBaselineCorrection,\n buildHoverExtraContent,\n collectPeaksWithBoundaryData,\n processUserAnnotations,\n} from \"./dataProcessing\";\nimport { detectPeaks } from \"./peakDetection\";\n\nimport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n PeakWithMeta,\n} from \"./types\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\n\n// Re-export types for external use\nexport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n};\n\n\nconst ChromatogramChart: React.FC<ChromatogramChartProps> = ({\n series,\n width = 900,\n height = 500,\n title,\n xAxisTitle = \"Retention Time (min)\",\n yAxisTitle = \"Signal (mAU)\",\n annotations = [],\n xRange,\n yRange,\n showLegend = true,\n showGridX = true,\n showGridY = true,\n showMarkers = false,\n markerSize = 4,\n showCrosshairs = false,\n baselineCorrection = \"none\",\n baselineWindowSize = 50,\n peakDetectionOptions,\n showPeakAreas = false,\n boundaryMarkers = \"none\",\n annotationOverlapThreshold = 0.4,\n showExportButton = true,\n}) => {\n // Derive peak detection state from options\n const enablePeakDetection = peakDetectionOptions !== undefined;\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n\n // Memoize processed series with baseline correction\n const processedSeries = useMemo(() => {\n return series.map((s) => {\n const validated = validateSeriesData(s.x, s.y);\n return {\n ...s,\n x: validated.x,\n y: applyBaselineCorrection(validated.y, baselineCorrection, baselineWindowSize),\n };\n });\n }, [series, baselineCorrection, baselineWindowSize]);\n\n // Process user annotations to convert startX/endX to indices and compute areas\n const processedAnnotations = useMemo(() => {\n if (annotations.length === 0 || processedSeries.length === 0) {\n return annotations;\n }\n // Use first series data for index lookup (user annotations apply to first series)\n const { x, y } = processedSeries[0];\n return processUserAnnotations(annotations, x, y);\n }, [annotations, processedSeries]);\n\n // Memoize peak detection results\n const allDetectedPeaks = useMemo(() => {\n const peaks: { peaks: PeakAnnotation[]; seriesIndex: number }[] = [];\n if (enablePeakDetection && peakDetectionOptions) {\n processedSeries.forEach((s, index) => {\n const detected = detectPeaks(s.x, s.y, peakDetectionOptions);\n if (detected.length > 0) {\n peaks.push({ peaks: detected, seriesIndex: index });\n }\n });\n }\n return peaks;\n }, [processedSeries, enablePeakDetection, peakDetectionOptions]);\n\n useEffect(() => {\n const currentRef = plotRef.current;\n if (!currentRef || series.length === 0) return;\n\n // Build trace data with auto-assigned colors\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = s.color || CHART_COLORS[index % CHART_COLORS.length];\n const extraContent = buildHoverExtraContent(s.name, s.metadata);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? \"lines+markers\" as const : \"lines\" as const,\n name: s.name,\n line: {\n color: traceColor,\n width: 1.5,\n },\n hovertemplate: `%{x:.2f} ${xAxisTitle}<br>%{y:.2f} ${yAxisTitle}<extra>${extraContent}</extra>`,\n };\n if (showMarkers) {\n trace.marker = {\n size: markerSize,\n color: traceColor,\n };\n }\n return trace;\n });\n\n // Add peak boundary markers if enabled\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(allDetectedPeaks, processedAnnotations, processedSeries);\n if (peaksWithData.length > 0) {\n const boundaryTraces = createBoundaryMarkerTraces(peaksWithData);\n plotData.push(...boundaryTraces);\n }\n }\n\n // Collect all peaks for unified staggering logic\n const allPeaksWithMeta: PeakWithMeta[] = [];\n\n // Add user-defined annotations (seriesIndex -1 indicates user-defined)\n processedAnnotations.forEach((ann) => {\n allPeaksWithMeta.push({ peak: ann, seriesIndex: -1 });\n });\n\n // Add auto-detected peaks if enabled\n if (showPeakAreas && enablePeakDetection) {\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n peaks.forEach((peak) => {\n allPeaksWithMeta.push({ peak, seriesIndex });\n });\n });\n }\n\n // Group all overlapping peaks and create annotations with staggering\n const groups = groupOverlappingPeaks(allPeaksWithMeta, annotationOverlapThreshold);\n const plotlyAnnotations: Partial<Plotly.Annotations>[] = [];\n\n for (const group of groups) {\n plotlyAnnotations.push(...createGroupAnnotations(group));\n }\n\n const layout: Partial<Plotly.Layout> = {\n title: title\n ? {\n text: title,\n font: {\n size: 20,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title ? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? \"x\" as const : \"x unified\" as const,\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && series.length > 1,\n annotations: plotlyAnnotations,\n };\n\n const config: Partial<Plotly.Config> = {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : [\"toImage\"] as Plotly.ModeBarDefaultButtons[]),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width: width,\n height: height,\n },\n }),\n };\n\n Plotly.newPlot(currentRef, plotData, layout, config);\n\n return () => {\n if (currentRef) {\n Plotly.purge(currentRef);\n }\n };\n }, [\n processedSeries, allDetectedPeaks, series.length, width, height, title, xAxisTitle, yAxisTitle,\n processedAnnotations, xRange, yRange, showLegend, showGridX, showGridY, showMarkers, markerSize,\n showCrosshairs, enablePeakDetection, peakDetectionOptions, showPeakAreas, boundaryMarkers,\n annotationOverlapThreshold, showExportButton, theme,\n ]);\n\n return (\n <div className=\"chromatogram-chart-container\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n </div>\n );\n};\n\nexport { ChromatogramChart };\n\n"],"names":["ChromatogramChart","series","width","height","title","xAxisTitle","yAxisTitle","annotations","xRange","yRange","showLegend","showGridX","showGridY","showMarkers","markerSize","showCrosshairs","baselineCorrection","baselineWindowSize","peakDetectionOptions","showPeakAreas","boundaryMarkers","annotationOverlapThreshold","showExportButton","enablePeakDetection","plotRef","useRef","theme","usePlotlyTheme","processedSeries","useMemo","s","validated","validateSeriesData","applyBaselineCorrection","processedAnnotations","x","y","processUserAnnotations","allDetectedPeaks","peaks","index","detected","detectPeaks","useEffect","currentRef","plotData","traceColor","CHART_COLORS","extraContent","buildHoverExtraContent","trace","peaksWithData","collectPeaksWithBoundaryData","boundaryTraces","createBoundaryMarkerTraces","allPeaksWithMeta","ann","seriesIndex","peak","groups","groupOverlappingPeaks","plotlyAnnotations","group","createGroupAnnotations","layout","CHROMATOGRAM_LAYOUT","config","Plotly","jsx"],"mappings":";;;;;;;;;;AA8CA,MAAMA,KAAsD,CAAC;AAAA,EAC3D,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,aAAAC,IAAc,CAAA;AAAA,EACd,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC,IA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hB;AAAA,IAAiBU;AAAA,IAAkBrC,EAAO;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAYC;AAAA,IACpF4B;AAAA,IAAsB1B;AAAA,IAAQC;AAAA,IAAQC;AAAA,IAAYC;AAAA,IAAWC;AAAA,IAAWC;AAAA,IAAaC;AAAA,IACrFC;AAAA,IAAgBQ;AAAA,IAAqBL;AAAA,IAAsBC;AAAA,IAAeC;AAAA,IAC1EC;AAAA,IAA4BC;AAAA,IAAkBI;AAAA,EAAA,CAC/C,GAGC,gBAAA0C,EAAC,OAAA,EAAI,WAAU,gCACb,4BAAC,OAAA,EAAI,KAAK5C,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,GAAU,GAC/D;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ChromatogramChart.js","sources":["../../../../src/components/charts/ChromatogramChart/ChromatogramChart.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\n\nimport { seriesColor } from \"../../../utils/colors\";\n\n\nimport {\n groupOverlappingPeaks,\n createGroupAnnotations,\n} from \"./annotations\";\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT } from \"./constants\";\nimport {\n validateSeriesData,\n applyBaselineCorrection,\n buildHoverExtraContent,\n collectPeaksWithBoundaryData,\n processUserAnnotations,\n} from \"./dataProcessing\";\nimport { detectPeaks } from \"./peakDetection\";\n\nimport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n PeakWithMeta,\n} from \"./types\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\n\n// Re-export types for external use\nexport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n};\n\n\nconst ChromatogramChart: React.FC<ChromatogramChartProps> = ({\n series,\n width = 900,\n height = 500,\n title,\n xAxisTitle = \"Retention Time (min)\",\n yAxisTitle = \"Signal (mAU)\",\n annotations = [],\n xRange,\n yRange,\n showLegend = true,\n showGridX = true,\n showGridY = true,\n showMarkers = false,\n markerSize = 4,\n showCrosshairs = false,\n baselineCorrection = \"none\",\n baselineWindowSize = 50,\n peakDetectionOptions,\n showPeakAreas = false,\n boundaryMarkers = \"none\",\n annotationOverlapThreshold = 0.4,\n showExportButton = true,\n}) => {\n // Derive peak detection state from options\n const enablePeakDetection = peakDetectionOptions !== undefined;\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n\n // Memoize processed series with baseline correction\n const processedSeries = useMemo(() => {\n return series.map((s) => {\n const validated = validateSeriesData(s.x, s.y);\n return {\n ...s,\n x: validated.x,\n y: applyBaselineCorrection(validated.y, baselineCorrection, baselineWindowSize),\n };\n });\n }, [series, baselineCorrection, baselineWindowSize]);\n\n // Process user annotations to convert startX/endX to indices and compute areas\n const processedAnnotations = useMemo(() => {\n if (annotations.length === 0 || processedSeries.length === 0) {\n return annotations;\n }\n // Use first series data for index lookup (user annotations apply to first series)\n const { x, y } = processedSeries[0];\n return processUserAnnotations(annotations, x, y);\n }, [annotations, processedSeries]);\n\n // Memoize peak detection results\n const allDetectedPeaks = useMemo(() => {\n const peaks: { peaks: PeakAnnotation[]; seriesIndex: number }[] = [];\n if (enablePeakDetection && peakDetectionOptions) {\n processedSeries.forEach((s, index) => {\n const detected = detectPeaks(s.x, s.y, peakDetectionOptions);\n if (detected.length > 0) {\n peaks.push({ peaks: detected, seriesIndex: index });\n }\n });\n }\n return peaks;\n }, [processedSeries, enablePeakDetection, peakDetectionOptions]);\n\n useEffect(() => {\n const currentRef = plotRef.current;\n if (!currentRef || series.length === 0) return;\n\n // Build trace data with auto-assigned colors\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = seriesColor(index, s.color);\n const extraContent = buildHoverExtraContent(s.name, s.metadata);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? \"lines+markers\" as const : \"lines\" as const,\n name: s.name,\n line: {\n color: traceColor,\n width: 1.5,\n },\n hovertemplate: `%{x:.2f} ${xAxisTitle}<br>%{y:.2f} ${yAxisTitle}<extra>${extraContent}</extra>`,\n };\n if (showMarkers) {\n trace.marker = {\n size: markerSize,\n color: traceColor,\n };\n }\n return trace;\n });\n\n // Add peak boundary markers if enabled\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(allDetectedPeaks, processedAnnotations, processedSeries);\n if (peaksWithData.length > 0) {\n const boundaryTraces = createBoundaryMarkerTraces(peaksWithData);\n plotData.push(...boundaryTraces);\n }\n }\n\n // Collect all peaks for unified staggering logic\n const allPeaksWithMeta: PeakWithMeta[] = [];\n\n // Add user-defined annotations (seriesIndex -1 indicates user-defined)\n processedAnnotations.forEach((ann) => {\n allPeaksWithMeta.push({ peak: ann, seriesIndex: -1 });\n });\n\n // Add auto-detected peaks if enabled\n if (showPeakAreas && enablePeakDetection) {\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n peaks.forEach((peak) => {\n allPeaksWithMeta.push({ peak, seriesIndex });\n });\n });\n }\n\n // Group all overlapping peaks and create annotations with staggering\n const groups = groupOverlappingPeaks(allPeaksWithMeta, annotationOverlapThreshold);\n const plotlyAnnotations: Partial<Plotly.Annotations>[] = [];\n\n for (const group of groups) {\n plotlyAnnotations.push(...createGroupAnnotations(group));\n }\n\n const layout: Partial<Plotly.Layout> = {\n title: title\n ? {\n text: title,\n font: {\n size: 20,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title ? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? \"x\" as const : \"x unified\" as const,\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && series.length > 1,\n annotations: plotlyAnnotations,\n };\n\n const config: Partial<Plotly.Config> = {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : [\"toImage\"] as Plotly.ModeBarDefaultButtons[]),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width: width,\n height: height,\n },\n }),\n };\n\n Plotly.newPlot(currentRef, plotData, layout, config);\n\n return () => {\n if (currentRef) {\n Plotly.purge(currentRef);\n }\n };\n }, [\n processedSeries, allDetectedPeaks, series.length, width, height, title, xAxisTitle, yAxisTitle,\n processedAnnotations, xRange, yRange, showLegend, showGridX, showGridY, showMarkers, markerSize,\n showCrosshairs, enablePeakDetection, peakDetectionOptions, showPeakAreas, boundaryMarkers,\n annotationOverlapThreshold, showExportButton, theme,\n ]);\n\n return (\n <div className=\"chromatogram-chart-container\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n </div>\n );\n};\n\nexport { ChromatogramChart };\n\n"],"names":["ChromatogramChart","series","width","height","title","xAxisTitle","yAxisTitle","annotations","xRange","yRange","showLegend","showGridX","showGridY","showMarkers","markerSize","showCrosshairs","baselineCorrection","baselineWindowSize","peakDetectionOptions","showPeakAreas","boundaryMarkers","annotationOverlapThreshold","showExportButton","enablePeakDetection","plotRef","useRef","theme","usePlotlyTheme","processedSeries","useMemo","s","validated","validateSeriesData","applyBaselineCorrection","processedAnnotations","x","y","processUserAnnotations","allDetectedPeaks","peaks","index","detected","detectPeaks","useEffect","currentRef","plotData","traceColor","seriesColor","extraContent","buildHoverExtraContent","trace","peaksWithData","collectPeaksWithBoundaryData","boundaryTraces","createBoundaryMarkerTraces","allPeaksWithMeta","ann","seriesIndex","peak","groups","groupOverlappingPeaks","plotlyAnnotations","group","createGroupAnnotations","layout","CHROMATOGRAM_LAYOUT","config","Plotly","jsx"],"mappings":";;;;;;;;;;AA8CA,MAAMA,KAAsD,CAAC;AAAA,EAC3D,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,E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AA,QAAA;AAAA,MACF;AAAA,IACF;AAGF,WAAAgE,EAAO,QAAQvB,GAAYC,GAAUmB,GAAQE,CAAM,GAE5C,MAAM;AACX,MAAItB,KACFuB,EAAO,MAAMvB,CAAU;AAAA,IAE3B;AAAA,EACF,GAAG;AAAA,IACDhB;AAAA,IAAiBU;AAAA,IAAkBrC,EAAO;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAYC;AAAA,IACpF4B;AAAA,IAAsB1B;AAAA,IAAQC;AAAA,IAAQC;AAAA,IAAYC;AAAA,IAAWC;AAAA,IAAWC;AAAA,IAAaC;AAAA,IACrFC;AAAA,IAAgBQ;AAAA,IAAqBL;AAAA,IAAsBC;AAAA,IAAeC;AAAA,IAC1EC;AAAA,IAA4BC;AAAA,IAAkBI;AAAA,EAAA,CAC/C,GAGC,gBAAA0C,EAAC,OAAA,EAAI,WAAU,gCACb,4BAAC,OAAA,EAAI,KAAK5C,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,GAAU,GAC/D;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../../utils/colors.cjs"),O=require("./constants.cjs"),A={default:{ax:0,ay:-35},overlap:[{ax:50,ay:-35},{ax:-60,ay:-35},{ax:70,ay:-55},{ax:-80,ay:-55},{ax:50,ay:-75},{ax:-60,ay:-75}]};function u(t,n){const e=[...t].sort((a,s)=>a.peak.x-s.peak.x),o=[];let r=[];for(const a of e){if(r.length===0){r.push(a);continue}const s=r[r.length-1];Math.abs(a.peak.x-s.peak.x)<n?r.push(a):(o.push(r),r=[a])}return r.length>0&&o.push(r),o}function c(t,n,e){const o=n===-1,r=o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR:T.seriesColor(n),a=o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR:r,s=t.text??(t._computed?.area===void 0?"":`Area: ${t._computed.area.toFixed(2)}`),i=o&&t.ax!==void 0?t.ax:e.ax,N=o&&t.ay!==void 0?t.ay:e.ay;return{x:t.x,y:t.y,text:s,showarrow:!0,arrowhead:2,arrowsize:1,arrowwidth:1,arrowcolor:r,ax:i,ay:N,font:{size:o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE:O.CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,color:a,family:"Inter, sans-serif"},bgcolor:O.CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,borderpad:2,bordercolor:o?void 0:r,borderwidth:o?0:1}}function l(t){if(t.length===1){const{peak:e,seriesIndex:o}=t[0];return[c(e,o,A.default)]}return[...t].sort((e,o)=>e.peak.y-o.peak.y).map(({peak:e,seriesIndex:o},r)=>{const a=A.overlap[r%A.overlap.length];return c(e,o,a)})}exports.ANNOTATION_SLOTS=A;exports.createGroupAnnotations=l;exports.createPeakAnnotation=c;exports.groupOverlappingPeaks=u;
|
|
2
2
|
//# sourceMappingURL=annotations.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.cjs","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"annotations.cjs","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR\n : seriesColor(seriesIndex);\n const textColor = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR\n : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","CHROMATOGRAM_ANNOTATION","seriesColor","textColor","text","ax","ay","createGroupAnnotations","group","a","slotIndex"],"mappings":"0JAcaA,EAAmB,CAC9B,QAAS,CAAE,GAAI,EAAG,GAAI,GAAA,EACtB,QAAS,CACP,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GA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AAA,EAEV,QAASF,EAAAA,wBAAwB,iBACjC,UAAW,EACX,YAAaF,EAAgB,OAAYC,EACzC,YAAaD,EAAgB,EAAI,CAAA,CAErC,CAKO,SAASQ,EACdC,EAC+B,CAC/B,GAAIA,EAAM,SAAW,EAAG,CACtB,KAAM,CAAE,KAAAZ,EAAM,YAAAC,GAAgBW,EAAM,CAAC,EACrC,MAAO,CAACb,EAAqBC,EAAMC,EAAaZ,EAAiB,OAAO,CAAC,CAC3E,CAKA,MAFoB,CAAC,GAAGuB,CAAK,EAAE,KAAK,CAACC,EAAGnB,IAAMmB,EAAE,KAAK,EAAInB,EAAE,KAAK,CAAC,EAE9C,IAAI,CAAC,CAAE,KAAAM,EAAM,YAAAC,CAAA,EAAea,IAAc,CAC3D,MAAMZ,EACJb,EAAiB,QAAQyB,EAAYzB,EAAiB,QAAQ,MAAM,EACtE,OAAOU,EAAqBC,EAAMC,EAAaC,CAAI,CACrD,CAAC,CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CHROMATOGRAM_ANNOTATION as
|
|
3
|
-
const
|
|
1
|
+
import { seriesColor as x } from "../../../utils/colors.js";
|
|
2
|
+
import { CHROMATOGRAM_ANNOTATION as i } from "./constants.js";
|
|
3
|
+
const c = {
|
|
4
4
|
default: { ax: 0, ay: -35 },
|
|
5
5
|
overlap: [
|
|
6
6
|
{ ax: 50, ay: -35 },
|
|
@@ -17,57 +17,57 @@ const i = {
|
|
|
17
17
|
// Left, level 3
|
|
18
18
|
]
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
const e = [...
|
|
22
|
-
let
|
|
20
|
+
function d(r, n) {
|
|
21
|
+
const e = [...r].sort((a, s) => a.peak.x - s.peak.x), o = [];
|
|
22
|
+
let t = [];
|
|
23
23
|
for (const a of e) {
|
|
24
|
-
if (
|
|
25
|
-
|
|
24
|
+
if (t.length === 0) {
|
|
25
|
+
t.push(a);
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
const s =
|
|
29
|
-
Math.abs(a.peak.x - s.peak.x) < n ?
|
|
28
|
+
const s = t[t.length - 1];
|
|
29
|
+
Math.abs(a.peak.x - s.peak.x) < n ? t.push(a) : (o.push(t), t = [a]);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return t.length > 0 && o.push(t), o;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const o = n === -1,
|
|
33
|
+
function u(r, n, e) {
|
|
34
|
+
const o = n === -1, t = o ? i.USER_ANNOTATION_COLOR : x(n), a = o ? i.USER_ANNOTATION_TEXT_COLOR : t, s = r.text ?? (r._computed?.area === void 0 ? "" : `Area: ${r._computed.area.toFixed(2)}`), O = o && r.ax !== void 0 ? r.ax : e.ax, l = o && r.ay !== void 0 ? r.ay : e.ay;
|
|
35
35
|
return {
|
|
36
|
-
x:
|
|
37
|
-
y:
|
|
36
|
+
x: r.x,
|
|
37
|
+
y: r.y,
|
|
38
38
|
text: s,
|
|
39
39
|
showarrow: !0,
|
|
40
40
|
arrowhead: 2,
|
|
41
41
|
arrowsize: 1,
|
|
42
42
|
arrowwidth: 1,
|
|
43
|
-
arrowcolor:
|
|
44
|
-
ax:
|
|
45
|
-
ay:
|
|
43
|
+
arrowcolor: t,
|
|
44
|
+
ax: O,
|
|
45
|
+
ay: l,
|
|
46
46
|
font: {
|
|
47
|
-
size: o ?
|
|
47
|
+
size: o ? i.USER_ANNOTATION_FONT_SIZE : i.AUTO_ANNOTATION_FONT_SIZE,
|
|
48
48
|
color: a,
|
|
49
49
|
family: "Inter, sans-serif"
|
|
50
50
|
},
|
|
51
|
-
bgcolor:
|
|
51
|
+
bgcolor: i.BACKGROUND_COLOR,
|
|
52
52
|
borderpad: 2,
|
|
53
|
-
bordercolor: o ? void 0 :
|
|
53
|
+
bordercolor: o ? void 0 : t,
|
|
54
54
|
borderwidth: o ? 0 : 1
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
const { peak: e, seriesIndex: o } =
|
|
60
|
-
return [
|
|
57
|
+
function p(r) {
|
|
58
|
+
if (r.length === 1) {
|
|
59
|
+
const { peak: e, seriesIndex: o } = r[0];
|
|
60
|
+
return [u(e, o, c.default)];
|
|
61
61
|
}
|
|
62
|
-
return [...
|
|
63
|
-
const a =
|
|
64
|
-
return
|
|
62
|
+
return [...r].sort((e, o) => e.peak.y - o.peak.y).map(({ peak: e, seriesIndex: o }, t) => {
|
|
63
|
+
const a = c.overlap[t % c.overlap.length];
|
|
64
|
+
return u(e, o, a);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
c as ANNOTATION_SLOTS,
|
|
69
|
+
p as createGroupAnnotations,
|
|
70
|
+
u as createPeakAnnotation,
|
|
71
|
+
d as groupOverlappingPeaks
|
|
72
72
|
};
|
|
73
73
|
//# sourceMappingURL=annotations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.js","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"annotations.js","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR\n : seriesColor(seriesIndex);\n const textColor = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR\n : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","CHROMATOGRAM_ANNOTATION","seriesColor","textColor","text","ax","ay","createGroupAnnotations","group","a","slotIndex"],"mappings":";;AAcO,MAAMA,IAAmB;AAAA,EAC9B,SAAS,EAAE,IAAI,GAAG,IAAI,IAAA;AAAA,EACtB,SAAS;AAAA,IACP,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAA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,EAAwB;AAAA,MAC5B,OAAOE;AAAA,MACP,QAAQ;AAAA,IAAA;AAAA,IAEV,SAASF,EAAwB;AAAA,IACjC,WAAW;AAAA,IACX,aAAaF,IAAgB,SAAYC;AAAA,IACzC,aAAaD,IAAgB,IAAI;AAAA,EAAA;AAErC;AAKO,SAASQ,EACdC,GAC+B;AAC/B,MAAIA,EAAM,WAAW,GAAG;AACtB,UAAM,EAAE,MAAAZ,GAAM,aAAAC,MAAgBW,EAAM,CAAC;AACrC,WAAO,CAACb,EAAqBC,GAAMC,GAAaZ,EAAiB,OAAO,CAAC;AAAA,EAC3E;AAKA,SAFoB,CAAC,GAAGuB,CAAK,EAAE,KAAK,CAACC,GAAGnB,MAAMmB,EAAE,KAAK,IAAInB,EAAE,KAAK,CAAC,EAE9C,IAAI,CAAC,EAAE,MAAAM,GAAM,aAAAC,EAAA,GAAea,MAAc;AAC3D,UAAMZ,IACJb,EAAiB,QAAQyB,IAAYzB,EAAiB,QAAQ,MAAM;AACtE,WAAOU,EAAqBC,GAAMC,GAAaC,CAAI;AAAA,EACrD,CAAC;AACH;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../utils/colors.cjs"),m=-5,y=-12,c=-16;function d(o,e,t,r){return t==="none"?[]:[{x:[o],y:[e],type:"scatter",mode:"markers",marker:{symbol:t==="diamond"?"diamond":"triangle-up",size:8,color:r},showlegend:!1,hoverinfo:"skip"}]}function T(o){const e=[];for(const{peaks:t,seriesIndex:r,x:s}of o){const a=f.seriesColor(r),i=m+r*c,u=y+r*c;for(const n of t){const k=n._computed?.startIndex??0,M=n._computed?.endIndex??0,l=s[k],p=s[M],R=n.startMarker??"triangle",_=n.endMarker??"diamond";e.push(...d(l,i,R,a)),e.push(...d(p,u,_,a))}}return e}exports.createBoundaryMarkerTraces=T;
|
|
2
2
|
//# sourceMappingURL=boundaryMarkers.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaryMarkers.cjs","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"boundaryMarkers.cjs","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, BoundaryMarkerType } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/** Base Y position for start boundary markers (below the x-axis) */\nconst BOUNDARY_MARKER_START_Y = -5;\n/** Y position for end boundary markers (below start markers) */\nconst BOUNDARY_MARKER_END_Y = -12;\n/** Y offset between series to prevent overlap */\nconst BOUNDARY_MARKER_SERIES_OFFSET = -16;\n\n/**\n * Create a marker trace for a boundary point.\n * Markers are placed on the x-axis below 0, staggered by series index.\n */\nfunction createMarkerTrace(\n xPos: number,\n yPos: number,\n markerType: BoundaryMarkerType,\n color: string\n): Plotly.Data[] {\n if (markerType === \"none\") {\n return [];\n }\n\n return [\n {\n x: [xPos],\n y: [yPos],\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: {\n symbol: markerType === \"diamond\" ? (\"diamond\" as const) : (\"triangle-up\" as const),\n size: 8,\n color,\n },\n showlegend: false,\n hoverinfo: \"skip\" as const,\n },\n ];\n}\n\n/**\n * Create boundary marker traces for peaks.\n * Uses per-peak startMarker/endMarker settings with defaults:\n * - startMarker: \"triangle\" (default)\n * - endMarker: \"diamond\" (default)\n */\nexport function createBoundaryMarkerTraces(\n allPeaks: {\n peaks: PeakAnnotation[];\n seriesIndex: number;\n x: number[];\n y: number[];\n }[]\n): Plotly.Data[] {\n const traces: Plotly.Data[] = [];\n\n for (const { peaks, seriesIndex, x } of allPeaks) {\n const color = seriesColor(seriesIndex);\n // Separate y positions for start vs end markers to prevent overlap when peaks are adjacent\n // Also stagger by series index to prevent overlap between different traces\n const startMarkerY = BOUNDARY_MARKER_START_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n const endMarkerY = BOUNDARY_MARKER_END_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n\n for (const peak of peaks) {\n const startIdx = peak._computed?.startIndex ?? 0;\n const endIdx = peak._computed?.endIndex ?? 0;\n const startX = x[startIdx];\n const endX = x[endIdx];\n\n // Get marker types with defaults: triangle at start, diamond at end\n const startMarkerType = peak.startMarker ?? \"triangle\";\n const endMarkerType = peak.endMarker ?? \"diamond\";\n\n // Create start boundary marker (upper row, staggered by series)\n traces.push(...createMarkerTrace(startX, startMarkerY, startMarkerType, color));\n\n // Create end boundary marker (lower row, staggered by series)\n traces.push(...createMarkerTrace(endX, endMarkerY, endMarkerType, color));\n }\n }\n\n return traces;\n}\n\n"],"names":["BOUNDARY_MARKER_START_Y","BOUNDARY_MARKER_END_Y","BOUNDARY_MARKER_SERIES_OFFSET","createMarkerTrace","xPos","yPos","markerType","color","createBoundaryMarkerTraces","allPeaks","traces","peaks","seriesIndex","x","seriesColor","startMarkerY","endMarkerY","peak","startIdx","endIdx","startX","endX","startMarkerType","endMarkerType"],"mappings":"6HAUMA,EAA0B,GAE1BC,EAAwB,IAExBC,EAAgC,IAMtC,SAASC,EACPC,EACAC,EACAC,EACAC,EACe,CACf,OAAID,IAAe,OACV,CAAA,EAGF,CACL,CACE,EAAG,CAACF,CAAI,EACR,EAAG,CAACC,CAAI,EACR,KAAM,UACN,KAAM,UACN,OAAQ,CACN,OAAQC,IAAe,UAAa,UAAuB,cAC3D,KAAM,EACN,MAAAC,CAAA,EAEF,WAAY,GACZ,UAAW,MAAA,CACb,CAEJ,CAQO,SAASC,EACdC,EAMe,CACf,MAAMC,EAAwB,CAAA,EAE9B,SAAW,CAAE,MAAAC,EAAO,YAAAC,EAAa,EAAAC,CAAA,IAAOJ,EAAU,CAChD,MAAMF,EAAQO,EAAAA,YAAYF,CAAW,EAG/BG,EAAef,EAA0BY,EAAcV,EACvDc,EAAaf,EAAwBW,EAAcV,EAEzD,UAAWe,KAAQN,EAAO,CACxB,MAAMO,EAAWD,EAAK,WAAW,YAAc,EACzCE,EAASF,EAAK,WAAW,UAAY,EACrCG,EAASP,EAAEK,CAAQ,EACnBG,EAAOR,EAAEM,CAAM,EAGfG,EAAkBL,EAAK,aAAe,WACtCM,EAAgBN,EAAK,WAAa,UAGxCP,EAAO,KAAK,GAAGP,EAAkBiB,EAAQL,EAAcO,EAAiBf,CAAK,CAAC,EAG9EG,EAAO,KAAK,GAAGP,EAAkBkB,EAAML,EAAYO,EAAehB,CAAK,CAAC,CAC1E,CACF,CAEA,OAAOG,CACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const x = -5,
|
|
3
|
-
function
|
|
1
|
+
import { seriesColor as m } from "../../../utils/colors.js";
|
|
2
|
+
const x = -5, l = -12, c = -16;
|
|
3
|
+
function d(o, e, t, r) {
|
|
4
4
|
return t === "none" ? [] : [
|
|
5
5
|
{
|
|
6
6
|
x: [o],
|
|
@@ -20,10 +20,10 @@ function i(o, e, t, r) {
|
|
|
20
20
|
function E(o) {
|
|
21
21
|
const e = [];
|
|
22
22
|
for (const { peaks: t, seriesIndex: r, x: s } of o) {
|
|
23
|
-
const a =
|
|
23
|
+
const a = m(r), i = x + r * c, k = l + r * c;
|
|
24
24
|
for (const n of t) {
|
|
25
|
-
const p = n._computed?.startIndex ?? 0,
|
|
26
|
-
e.push(...
|
|
25
|
+
const p = n._computed?.startIndex ?? 0, u = n._computed?.endIndex ?? 0, M = s[p], R = s[u], _ = n.startMarker ?? "triangle", f = n.endMarker ?? "diamond";
|
|
26
|
+
e.push(...d(M, i, _, a)), e.push(...d(R, k, f, a));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
return e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaryMarkers.js","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"boundaryMarkers.js","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, BoundaryMarkerType } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/** Base Y position for start boundary markers (below the x-axis) */\nconst BOUNDARY_MARKER_START_Y = -5;\n/** Y position for end boundary markers (below start markers) */\nconst BOUNDARY_MARKER_END_Y = -12;\n/** Y offset between series to prevent overlap */\nconst BOUNDARY_MARKER_SERIES_OFFSET = -16;\n\n/**\n * Create a marker trace for a boundary point.\n * Markers are placed on the x-axis below 0, staggered by series index.\n */\nfunction createMarkerTrace(\n xPos: number,\n yPos: number,\n markerType: BoundaryMarkerType,\n color: string\n): Plotly.Data[] {\n if (markerType === \"none\") {\n return [];\n }\n\n return [\n {\n x: [xPos],\n y: [yPos],\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: {\n symbol: markerType === \"diamond\" ? (\"diamond\" as const) : (\"triangle-up\" as const),\n size: 8,\n color,\n },\n showlegend: false,\n hoverinfo: \"skip\" as const,\n },\n ];\n}\n\n/**\n * Create boundary marker traces for peaks.\n * Uses per-peak startMarker/endMarker settings with defaults:\n * - startMarker: \"triangle\" (default)\n * - endMarker: \"diamond\" (default)\n */\nexport function createBoundaryMarkerTraces(\n allPeaks: {\n peaks: PeakAnnotation[];\n seriesIndex: number;\n x: number[];\n y: number[];\n }[]\n): Plotly.Data[] {\n const traces: Plotly.Data[] = [];\n\n for (const { peaks, seriesIndex, x } of allPeaks) {\n const color = seriesColor(seriesIndex);\n // Separate y positions for start vs end markers to prevent overlap when peaks are adjacent\n // Also stagger by series index to prevent overlap between different traces\n const startMarkerY = BOUNDARY_MARKER_START_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n const endMarkerY = BOUNDARY_MARKER_END_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n\n for (const peak of peaks) {\n const startIdx = peak._computed?.startIndex ?? 0;\n const endIdx = peak._computed?.endIndex ?? 0;\n const startX = x[startIdx];\n const endX = x[endIdx];\n\n // Get marker types with defaults: triangle at start, diamond at end\n const startMarkerType = peak.startMarker ?? \"triangle\";\n const endMarkerType = peak.endMarker ?? \"diamond\";\n\n // Create start boundary marker (upper row, staggered by series)\n traces.push(...createMarkerTrace(startX, startMarkerY, startMarkerType, color));\n\n // Create end boundary marker (lower row, staggered by series)\n traces.push(...createMarkerTrace(endX, endMarkerY, endMarkerType, color));\n }\n }\n\n return traces;\n}\n\n"],"names":["BOUNDARY_MARKER_START_Y","BOUNDARY_MARKER_END_Y","BOUNDARY_MARKER_SERIES_OFFSET","createMarkerTrace","xPos","yPos","markerType","color","createBoundaryMarkerTraces","allPeaks","traces","peaks","seriesIndex","x","seriesColor","startMarkerY","endMarkerY","peak","startIdx","endIdx","startX","endX","startMarkerType","endMarkerType"],"mappings":";AAUA,MAAMA,IAA0B,IAE1BC,IAAwB,KAExBC,IAAgC;AAMtC,SAASC,EACPC,GACAC,GACAC,GACAC,GACe;AACf,SAAID,MAAe,SACV,CAAA,IAGF;AAAA,IACL;AAAA,MACE,GAAG,CAACF,CAAI;AAAA,MACR,GAAG,CAACC,CAAI;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,QACN,QAAQC,MAAe,YAAa,YAAuB;AAAA,QAC3D,MAAM;AAAA,QACN,OAAAC;AAAA,MAAA;AAAA,MAEF,YAAY;AAAA,MACZ,WAAW;AAAA,IAAA;AAAA,EACb;AAEJ;AAQO,SAASC,EACdC,GAMe;AACf,QAAMC,IAAwB,CAAA;AAE9B,aAAW,EAAE,OAAAC,GAAO,aAAAC,GAAa,GAAAC,EAAA,KAAOJ,GAAU;AAChD,UAAMF,IAAQO,EAAYF,CAAW,GAG/BG,IAAef,IAA0BY,IAAcV,GACvDc,IAAaf,IAAwBW,IAAcV;AAEzD,eAAWe,KAAQN,GAAO;AACxB,YAAMO,IAAWD,EAAK,WAAW,cAAc,GACzCE,IAASF,EAAK,WAAW,YAAY,GACrCG,IAASP,EAAEK,CAAQ,GACnBG,IAAOR,EAAEM,CAAM,GAGfG,IAAkBL,EAAK,eAAe,YACtCM,IAAgBN,EAAK,aAAa;AAGxC,MAAAP,EAAO,KAAK,GAAGP,EAAkBiB,GAAQL,GAAcO,GAAiBf,CAAK,CAAC,GAG9EG,EAAO,KAAK,GAAGP,EAAkBkB,GAAML,GAAYO,GAAehB,CAAK,CAAC;AAAA,IAC1E;AAAA,EACF;AAEA,SAAOG;AACT;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O={MARGIN_LEFT:70,MARGIN_RIGHT:30,MARGIN_BOTTOM:60,MARGIN_TOP_WITH_TITLE:50,MARGIN_TOP_NO_TITLE:30,MARGIN_PAD:5},T={USER_ANNOTATION_FONT_SIZE:11,AUTO_ANNOTATION_FONT_SIZE:10,USER_ANNOTATION_COLOR:"rgba(100, 116, 139, 1)",USER_ANNOTATION_TEXT_COLOR:"rgba(26, 26, 26, 1)",BACKGROUND_COLOR:"#ffffff"};exports.CHROMATOGRAM_ANNOTATION=T;exports.CHROMATOGRAM_LAYOUT=O;
|
|
2
2
|
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../../../src/components/charts/ChromatogramChart/constants.ts"],"sourcesContent":["/**\n * Constants for ChromatogramChart component\n */\n\n/**\n * Layout constants for chart margins and spacing\n */\nexport const CHROMATOGRAM_LAYOUT = {\n /** Left margin in pixels */\n MARGIN_LEFT: 70,\n /** Right margin in pixels */\n MARGIN_RIGHT: 30,\n /** Bottom margin in pixels */\n MARGIN_BOTTOM: 60,\n /** Top margin with title in pixels */\n MARGIN_TOP_WITH_TITLE: 50,\n /** Top margin without title in pixels */\n MARGIN_TOP_NO_TITLE: 30,\n /** Padding around plot area */\n MARGIN_PAD: 5,\n} as const;\n\n/**\n * Annotation constants for peak labels and markers\n */\nexport const CHROMATOGRAM_ANNOTATION = {\n /** Default vertical offset for annotation arrows (negative = above point) */\n DEFAULT_ARROW_OFFSET_Y: -30,\n /** Font size for user-defined annotations */\n USER_ANNOTATION_FONT_SIZE: 11,\n /** Font size for auto-detected peak annotations */\n AUTO_ANNOTATION_FONT_SIZE: 10,\n} as const;\n\n"],"names":["CHROMATOGRAM_LAYOUT","CHROMATOGRAM_ANNOTATION"],"mappings":"gFAOO,MAAMA,EAAsB,CAEjC,YAAa,GAEb,aAAc,GAEd,cAAe,GAEf,sBAAuB,GAEvB,oBAAqB,GAErB,WAAY,CACd,EAKaC,EAA0B,CAIrC,0BAA2B,GAE3B,0BAA2B,
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../../../src/components/charts/ChromatogramChart/constants.ts"],"sourcesContent":["/**\n * Constants for ChromatogramChart component\n */\n\n/**\n * Layout constants for chart margins and spacing\n */\nexport const CHROMATOGRAM_LAYOUT = {\n /** Left margin in pixels */\n MARGIN_LEFT: 70,\n /** Right margin in pixels */\n MARGIN_RIGHT: 30,\n /** Bottom margin in pixels */\n MARGIN_BOTTOM: 60,\n /** Top margin with title in pixels */\n MARGIN_TOP_WITH_TITLE: 50,\n /** Top margin without title in pixels */\n MARGIN_TOP_NO_TITLE: 30,\n /** Padding around plot area */\n MARGIN_PAD: 5,\n} as const;\n\n/**\n * Annotation constants for peak labels and markers\n */\nexport const CHROMATOGRAM_ANNOTATION = {\n /** Default vertical offset for annotation arrows (negative = above point) */\n DEFAULT_ARROW_OFFSET_Y: -30,\n /** Font size for user-defined annotations */\n USER_ANNOTATION_FONT_SIZE: 11,\n /** Font size for auto-detected peak annotations */\n AUTO_ANNOTATION_FONT_SIZE: 10,\n /** Arrow color for user-defined annotations (grey 500) */\n USER_ANNOTATION_COLOR: \"rgba(100, 116, 139, 1)\",\n /** Text color for user-defined annotations (black 900) */\n USER_ANNOTATION_TEXT_COLOR: \"rgba(26, 26, 26, 1)\",\n /** Background color behind annotation text */\n BACKGROUND_COLOR: \"#ffffff\",\n} as const;\n\n"],"names":["CHROMATOGRAM_LAYOUT","CHROMATOGRAM_ANNOTATION"],"mappings":"gFAOO,MAAMA,EAAsB,CAEjC,YAAa,GAEb,aAAc,GAEd,cAAe,GAEf,sBAAuB,GAEvB,oBAAqB,GAErB,WAAY,CACd,EAKaC,EAA0B,CAIrC,0BAA2B,GAE3B,0BAA2B,GAE3B,sBAAuB,yBAEvB,2BAA4B,sBAE5B,iBAAkB,SACpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const O = {
|
|
2
2
|
/** Left margin in pixels */
|
|
3
3
|
MARGIN_LEFT: 70,
|
|
4
4
|
/** Right margin in pixels */
|
|
@@ -11,14 +11,20 @@ const T = {
|
|
|
11
11
|
MARGIN_TOP_NO_TITLE: 30,
|
|
12
12
|
/** Padding around plot area */
|
|
13
13
|
MARGIN_PAD: 5
|
|
14
|
-
},
|
|
14
|
+
}, T = {
|
|
15
15
|
/** Font size for user-defined annotations */
|
|
16
16
|
USER_ANNOTATION_FONT_SIZE: 11,
|
|
17
17
|
/** Font size for auto-detected peak annotations */
|
|
18
|
-
AUTO_ANNOTATION_FONT_SIZE: 10
|
|
18
|
+
AUTO_ANNOTATION_FONT_SIZE: 10,
|
|
19
|
+
/** Arrow color for user-defined annotations (grey 500) */
|
|
20
|
+
USER_ANNOTATION_COLOR: "rgba(100, 116, 139, 1)",
|
|
21
|
+
/** Text color for user-defined annotations (black 900) */
|
|
22
|
+
USER_ANNOTATION_TEXT_COLOR: "rgba(26, 26, 26, 1)",
|
|
23
|
+
/** Background color behind annotation text */
|
|
24
|
+
BACKGROUND_COLOR: "#ffffff"
|
|
19
25
|
};
|
|
20
26
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
T as CHROMATOGRAM_ANNOTATION,
|
|
28
|
+
O as CHROMATOGRAM_LAYOUT
|
|
23
29
|
};
|
|
24
30
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/components/charts/ChromatogramChart/constants.ts"],"sourcesContent":["/**\n * Constants for ChromatogramChart component\n */\n\n/**\n * Layout constants for chart margins and spacing\n */\nexport const CHROMATOGRAM_LAYOUT = {\n /** Left margin in pixels */\n MARGIN_LEFT: 70,\n /** Right margin in pixels */\n MARGIN_RIGHT: 30,\n /** Bottom margin in pixels */\n MARGIN_BOTTOM: 60,\n /** Top margin with title in pixels */\n MARGIN_TOP_WITH_TITLE: 50,\n /** Top margin without title in pixels */\n MARGIN_TOP_NO_TITLE: 30,\n /** Padding around plot area */\n MARGIN_PAD: 5,\n} as const;\n\n/**\n * Annotation constants for peak labels and markers\n */\nexport const CHROMATOGRAM_ANNOTATION = {\n /** Default vertical offset for annotation arrows (negative = above point) */\n DEFAULT_ARROW_OFFSET_Y: -30,\n /** Font size for user-defined annotations */\n USER_ANNOTATION_FONT_SIZE: 11,\n /** Font size for auto-detected peak annotations */\n AUTO_ANNOTATION_FONT_SIZE: 10,\n} as const;\n\n"],"names":["CHROMATOGRAM_LAYOUT","CHROMATOGRAM_ANNOTATION"],"mappings":"AAOO,MAAMA,IAAsB;AAAA;AAAA,EAEjC,aAAa;AAAA;AAAA,EAEb,cAAc;AAAA;AAAA,EAEd,eAAe;AAAA;AAAA,EAEf,uBAAuB;AAAA;AAAA,EAEvB,qBAAqB;AAAA;AAAA,EAErB,YAAY;AACd,GAKaC,IAA0B;AAAA;AAAA,EAIrC,2BAA2B;AAAA;AAAA,EAE3B,2BAA2B;
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/charts/ChromatogramChart/constants.ts"],"sourcesContent":["/**\n * Constants for ChromatogramChart component\n */\n\n/**\n * Layout constants for chart margins and spacing\n */\nexport const CHROMATOGRAM_LAYOUT = {\n /** Left margin in pixels */\n MARGIN_LEFT: 70,\n /** Right margin in pixels */\n MARGIN_RIGHT: 30,\n /** Bottom margin in pixels */\n MARGIN_BOTTOM: 60,\n /** Top margin with title in pixels */\n MARGIN_TOP_WITH_TITLE: 50,\n /** Top margin without title in pixels */\n MARGIN_TOP_NO_TITLE: 30,\n /** Padding around plot area */\n MARGIN_PAD: 5,\n} as const;\n\n/**\n * Annotation constants for peak labels and markers\n */\nexport const CHROMATOGRAM_ANNOTATION = {\n /** Default vertical offset for annotation arrows (negative = above point) */\n DEFAULT_ARROW_OFFSET_Y: -30,\n /** Font size for user-defined annotations */\n USER_ANNOTATION_FONT_SIZE: 11,\n /** Font size for auto-detected peak annotations */\n AUTO_ANNOTATION_FONT_SIZE: 10,\n /** Arrow color for user-defined annotations (grey 500) */\n USER_ANNOTATION_COLOR: \"rgba(100, 116, 139, 1)\",\n /** Text color for user-defined annotations (black 900) */\n USER_ANNOTATION_TEXT_COLOR: \"rgba(26, 26, 26, 1)\",\n /** Background color behind annotation text */\n BACKGROUND_COLOR: \"#ffffff\",\n} as const;\n\n"],"names":["CHROMATOGRAM_LAYOUT","CHROMATOGRAM_ANNOTATION"],"mappings":"AAOO,MAAMA,IAAsB;AAAA;AAAA,EAEjC,aAAa;AAAA;AAAA,EAEb,cAAc;AAAA;AAAA,EAEd,eAAe;AAAA;AAAA,EAEf,uBAAuB;AAAA;AAAA,EAEvB,qBAAqB;AAAA;AAAA,EAErB,YAAY;AACd,GAKaC,IAA0B;AAAA;AAAA,EAIrC,2BAA2B;AAAA;AAAA,EAE3B,2BAA2B;AAAA;AAAA,EAE3B,uBAAuB;AAAA;AAAA,EAEvB,4BAA4B;AAAA;AAAA,EAE5B,kBAAkB;AACpB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),M=require("plotly.js-dist"),e=require("react"),P=require("../../../hooks/use-plotly-theme.cjs"),k=require("../../../utils/colors.cjs"),R=({dataSeries:r,width:a=1e3,height:g=600,title:d="Dot Plot",xTitle:l="Columns",yTitle:n="Rows",variant:p="default",markerSize:f=8})=>{const s=e.useRef(null),t=P.usePlotlyTheme(),h=e.useMemo(()=>Array.isArray(r)?r:[r],[r]),c=k.CHART_COLORS,u=e.useMemo(()=>["circle","square","diamond","triangle-up","triangle-down","star"],[]),x=e.useMemo(()=>h.map((o,i)=>p==="default"?{...o,color:o.color||c[0],symbol:"circle",size:o.size||f}:{...o,color:o.color||c[i%c.length],symbol:o.symbol||u[i%u.length],size:o.size||f}),[h,p,f,c,u]),m=t.gridColor,b=e.useMemo(()=>x.map(o=>({type:"scatter",x:o.x,y:o.y,mode:"markers",name:o.name,marker:{color:o.color,size:o.size,symbol:o.symbol,line:{color:t.paperBg,width:1}},hovertemplate:`${l}: %{x}<br>${n}: %{y}<extra>${o.name}</extra>`})),[x,l,n,t]),y=e.useMemo(()=>({tickcolor:t.tickColor,ticklen:12,tickwidth:1,ticks:"outside",tickfont:{size:16,color:t.textColor,family:"Inter, sans-serif",weight:400},linecolor:t.lineColor,linewidth:1,position:0,zeroline:!1}),[t]),C=e.useMemo(()=>({text:d,x:.5,y:.95,xanchor:"center",yanchor:"top",font:{size:32,weight:600,family:"Inter, sans-serif",color:t.textColor,lineheight:1.2,standoff:30}}),[d,t]);return e.useEffect(()=>{if(!s.current)return;const o={width:a,height:g,font:{family:"Inter, sans-serif"},title:C,margin:{l:80,r:40,b:80,t:80,pad:0},showlegend:!0,legend:{x:.5,y:-.2,xanchor:"center",yanchor:"top",orientation:"h",font:{size:13,color:t.legendColor,family:"Inter, sans-serif",weight:500,lineheight:18}},xaxis:{title:{text:l,font:{size:16,color:t.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:m,...y},yaxis:{title:{text:n,font:{size:16,color:t.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:m,...y},paper_bgcolor:t.paperBg,plot_bgcolor:t.plotBg},i={responsive:!0,displayModeBar:!1,displaylogo:!1};M.newPlot(s.current,b,o,i);const w=s.current;return()=>{w&&M.purge(w)}},[a,g,l,n,b,C,y,m,t]),z.jsx("div",{className:"dotplot-container",style:{width:a},children:z.jsx("div",{ref:s,style:{width:"100%",height:"100%",margin:"0"}})})};exports.DotPlot=R;
|
|
2
2
|
//# sourceMappingURL=DotPlot.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPlot.cjs","sources":["../../../../src/components/charts/DotPlot/DotPlot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport {
|
|
1
|
+
{"version":3,"file":"DotPlot.cjs","sources":["../../../../src/components/charts/DotPlot/DotPlot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { CHART_COLORS } from \"@/utils/colors\";\n\ntype MarkerSymbol =\n | \"circle\"\n | \"square\"\n | \"diamond\"\n | \"triangle-up\"\n | \"triangle-down\"\n | \"star\";\n\ninterface DotPlotDataSeries {\n x: number[];\n y: number[];\n name: string;\n color?: string;\n symbol?: MarkerSymbol;\n size?: number;\n}\n\ntype DotPlotVariant = \"default\" | \"stacked\";\n\ntype DotPlotProps = {\n dataSeries: DotPlotDataSeries | DotPlotDataSeries[];\n width?: number;\n height?: number;\n title?: string;\n xTitle?: string;\n yTitle?: string;\n variant?: DotPlotVariant;\n markerSize?: number;\n};\n\nconst DotPlot: React.FC<DotPlotProps> = ({\n dataSeries,\n width = 1000,\n height = 600,\n title = \"Dot Plot\",\n xTitle = \"Columns\",\n yTitle = \"Rows\",\n variant = \"default\",\n markerSize = 8,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const seriesArray = useMemo(\n () => (Array.isArray(dataSeries) ? dataSeries : [dataSeries]),\n [dataSeries],\n );\n\n const defaultColors = CHART_COLORS;\n\n const defaultSymbols: MarkerSymbol[] = useMemo(\n () => [\n \"circle\",\n \"square\",\n \"diamond\",\n \"triangle-up\",\n \"triangle-down\",\n \"star\",\n ],\n [],\n );\n\n const seriesWithColors = useMemo(() => {\n return seriesArray.map((series, index) => {\n if (variant === \"default\") {\n // Default variant: all circles, use first color or series color\n return {\n ...series,\n color: series.color || defaultColors[0],\n symbol: \"circle\" as MarkerSymbol,\n size: series.size || markerSize,\n };\n } else {\n // Stacked variant: different symbols and colors for each series\n return {\n ...series,\n color: series.color || defaultColors[index % defaultColors.length],\n symbol:\n series.symbol || defaultSymbols[index % defaultSymbols.length],\n size: series.size || markerSize,\n };\n }\n });\n }, [seriesArray, variant, markerSize, defaultColors, defaultSymbols]);\n\n const gridColor = theme.gridColor;\n\n const plotData = useMemo(\n () =>\n seriesWithColors.map((series) => ({\n type: \"scatter\" as const,\n x: series.x,\n y: series.y,\n mode: \"markers\" as const,\n name: series.name,\n marker: {\n color: series.color,\n size: series.size,\n symbol: series.symbol,\n line: {\n color: theme.paperBg,\n width: 1,\n },\n },\n hovertemplate: `${xTitle}: %{x}<br>${yTitle}: %{y}<extra>${series.name}</extra>`,\n })),\n [seriesWithColors, xTitle, yTitle, theme],\n );\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n const titleOptions = useMemo(\n () => ({\n text: title,\n x: 0.5,\n y: 0.95,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n font: {\n size: 32,\n weight: 600,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n lineheight: 1.2,\n standoff: 30,\n },\n }),\n [title, theme],\n );\n\n useEffect(() => {\n if (!plotRef.current) return;\n\n const layout = {\n width,\n height,\n font: {\n family: \"Inter, sans-serif\",\n },\n title: titleOptions,\n margin: { l: 80, r: 40, b: 80, t: 80, pad: 0 },\n showlegend: true,\n legend: {\n x: 0.5,\n y: -0.2,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: {\n size: 13,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n lineheight: 18,\n },\n },\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n ...tickOptions,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n };\n\n const config = {\n responsive: true,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, plotData, layout, config);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n }\n };\n }, [width, height, xTitle, yTitle, plotData, titleOptions, tickOptions, gridColor, theme]);\n\n return (\n <div className=\"dotplot-container\" style={{ width: width }}>\n <div\n ref={plotRef}\n style={{\n width: \"100%\",\n height: \"100%\",\n margin: \"0\",\n }}\n />\n </div>\n );\n};\n\nexport { DotPlot };\nexport type { DotPlotDataSeries, DotPlotProps, DotPlotVariant, MarkerSymbol };\n"],"names":["DotPlot","dataSeries","width","height","title","xTitle","yTitle","variant","markerSize","plotRef","useRef","theme","usePlotlyTheme","seriesArray","useMemo","defaultColors","CHART_COLORS","defaultSymbols","seriesWithColors","series","index","gridColor","plotData","tickOptions","titleOptions","useEffect","layout","config","Plotly","plotElement","jsx"],"mappings":"4PAoCMA,EAAkC,CAAC,CACvC,WAAAC,EACA,MAAAC,EAAQ,IACR,OAAAC,EAAS,IACT,MAAAC,EAAQ,WACR,OAAAC,EAAS,UACT,OAAAC,EAAS,OACT,QAAAC,EAAU,UACV,WAAAC,EAAa,CACf,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,eAAA,EACRC,EAAcC,EAAAA,QAClB,IAAO,MAAM,QAAQb,CAAU,EAAIA,EAAa,CAACA,CAAU,EAC3D,CAACA,CAAU,CAAA,EAGPc,EAAgBC,EAAAA,aAEhBC,EAAiCH,EAAAA,QACrC,IAAM,CACJ,SACA,SACA,UACA,cACA,gBACA,MAAA,EAEF,CAAA,CAAC,EAGGI,EAAmBJ,EAAAA,QAAQ,IACxBD,EAAY,IAAI,CAACM,EAAQC,IAC1Bb,IAAY,UAEP,CACL,GAAGY,EACH,MAAOA,EAAO,OAASJ,EAAc,CAAC,EACtC,OAAQ,SACR,KAAMI,EAAO,MAAQX,CAAA,EAIhB,CACL,GAAGW,EACH,MAAOA,EAAO,OAASJ,EAAcK,EAAQL,EAAc,MAAM,EACjE,OACEI,EAAO,QAAUF,EAAeG,EAAQH,EAAe,MAAM,EAC/D,KAAME,EAAO,MAAQX,CAAA,CAG1B,EACA,CAACK,EAAaN,EAASC,EAAYO,EAAeE,CAAc,CAAC,EAE9DI,EAAYV,EAAM,UAElBW,EAAWR,EAAAA,QACf,IACEI,EAAiB,IAAKC,IAAY,CAChC,KAAM,UACN,EAAGA,EAAO,EACV,E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