From 2230500a96a22db47129588f659a899cc5f623e9 Mon Sep 17 00:00:00 2001 From: lyun Date: Sun, 1 Nov 2026 13:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E8=B6=8B=E5=8A=BF?= =?UTF-8?q?=E6=9F=B1=E5=BD=A2=E9=87=87=E7=94=A801=E8=BD=BB=E5=BA=A6?= =?UTF-8?q?=E5=8A=A0=E6=B7=B1=E5=B9=B6=E5=90=8C=E6=AD=A5=E5=85=AD=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DESIGN.md | 8 ++++++++ web/src/QueryPage.tsx | 16 +++++++++++----- web/src/trendBarPalette.ts | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 web/src/trendBarPalette.ts diff --git a/DESIGN.md b/DESIGN.md index 0348324..3e76890 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -55,3 +55,11 @@ - 后续本地调整:顶部指标卡片恢复随页面滚动,移除其标题下的“(去本部报废)”,保留表头口径提示及切换功能;口径切换与卡片共用一行,移除上方独占空行并压缩卡片内边距。顶部筛选栏及表格冻结列不变。实际滚动检查、类型检查及31项相关检查通过,2026-10-31 已发布。 - 原口径隐藏亮片与综合合格率的说明图标,去本部报废口径保留图标;黑片总重量规则图标始终保留。构建及32项检查通过,已实测线上切换,2026-10-31 已发布。 + +## 2026-11-01:趋势柱形 01 轻度加深(用户确认) + +- 保留现有布局、堆叠、坐标轴、目标线及三条合格率折线的颜色和算法。 +- 浅蓝主题合格重量柱:默认 #99A8E3,选中 #7F92DA,悬停 #6078CE;报废重量柱:默认 #E49A70,选中 #DB8656,悬停 #CD7546。 +- 未选中月份保色 50%,替代原来的 28%;既有 340 毫秒过渡及再次点击取消选择保持。 +- 六主题共用 web/src/trendBarPalette.ts;其他浅色主题沿用各自蓝色方向,午夜黑同步增强对比度。 +- 方案已获用户明确发布授权。候选预览控制栏和其他深度候选不进入正式页面。 diff --git a/web/src/QueryPage.tsx b/web/src/QueryPage.tsx index 5a7b1a1..df6888f 100644 --- a/web/src/QueryPage.tsx +++ b/web/src/QueryPage.tsx @@ -1,3 +1,5 @@ +import { trendBarPalette } from './trendBarPalette'; +import { getWorkspaceTheme } from './ui-themes'; import { queryScrapWeight, queryTotalScrapWeight, type QueryRateBasis } from './queryMetricValues'; import { BusinessValue } from './BusinessValue'; import { usePageCache } from './pageCache'; @@ -1281,13 +1283,17 @@ export function TrendChart({ rows, mode, stage, rateBasis, targetRate, selectedP const { fontFamily, numericFamily, fontSize, tooltipFontSize } = queryChartTypography(container.current); const ink = css.getPropertyValue('--ink').trim() || '#111111'; const blue = css.getPropertyValue('--blue').trim() || '#5368d7'; - const barColor = css.getPropertyValue('--blue-muted').trim() || '#b0bcee'; + const bars = trendBarPalette(getWorkspaceTheme(document.documentElement.dataset.workspaceTheme).id); + const barColor = bars.qualified; const teal = css.getPropertyValue('--teal').trim() || '#008f7d'; const line = css.getPropertyValue('--line').trim() || '#dfe5ef'; const surface = css.getPropertyValue('--surface').trim() || '#ffffff'; const labels = rows.map(row => row.periodLabel || String(row.month)); const barData = (field: 'qualifiedWeight' | 'scrapWeight') => rows.map(row => ({ value: hasStageRows(row, stage) ? stageValue(row, stage, field, rateBasis) : null, + itemStyle: { color: field === 'qualifiedWeight' + ? (String(row.period ?? row.month) === selectedPeriod ? bars.selectedQualified : bars.qualified) + : (String(row.period ?? row.month) === selectedPeriod ? bars.selectedScrap : bars.scrap) }, })); const formatTooltip = (params: unknown, onlyRates = false) => { const items: ChartTooltipParam[] = Array.isArray(params) ? params as ChartTooltipParam[] : [params as ChartTooltipParam]; @@ -1328,8 +1334,8 @@ export function TrendChart({ rows, mode, stage, rateBasis, targetRate, selectedP { type: 'value', name: '合格率 / %', nameGap: 18, min: minRate, max: maxRate, nameTextStyle: { color: ink, align: 'right', fontSize }, axisLabel: { color: ink, formatter: '{value}%', fontFamily: numericFamily, fontSize }, axisLine: { show: false }, axisTick: { show: false }, splitLine: { show: false } }, ], series: [ - { id: 'qualified-weight', name: `${stageName}合格重量`, type: 'bar', z: 1, stack: 'weight', yAxisIndex: 0, barWidth, itemStyle: { color: barColor }, emphasis: { itemStyle: { color: blue } }, data: barData('qualifiedWeight') }, - { id: 'scrap-weight', name: `${stageName}报废重量`, type: 'bar', z: 1, stack: 'weight', yAxisIndex: 0, barWidth, itemStyle: { color: '#edaa83' }, emphasis: { itemStyle: { color: '#e58e5d' } }, data: barData('scrapWeight') }, + { id: 'qualified-weight', name: `${stageName}合格重量`, type: 'bar', z: 1, stack: 'weight', yAxisIndex: 0, barWidth, itemStyle: { color: barColor }, emphasis: { itemStyle: { color: bars.hoverQualified } }, data: barData('qualifiedWeight') }, + { id: 'scrap-weight', name: `${stageName}报废重量`, type: 'bar', z: 1, stack: 'weight', yAxisIndex: 0, barWidth, itemStyle: { color: bars.scrap }, emphasis: { itemStyle: { color: bars.hoverScrap } }, data: barData('scrapWeight') }, { id: 'composite-rate', name: '综合合格率', type: 'line', yAxisIndex: 1, ...pointStyle, ...targetLine, lineStyle: { width: 2.5, color: blue }, itemStyle: { color: blue, borderColor: surface, borderWidth: 1.5 }, data: rows.map(row => rateNumber(visibleCompositeRate(row, rateBasis))) }, { id: 'black-rate', name: '黑片合格率', type: 'line', yAxisIndex: 1, ...pointStyle, lineStyle: { width: 1.8, color: '#9278bf' }, itemStyle: { color: '#9278bf', borderColor: surface, borderWidth: 1 }, data: rows.map(row => rateNumber(visibleStageRate(row, 'black'))) }, { id: 'bright-rate', name: '亮片合格率', type: 'line', yAxisIndex: 1, ...pointStyle, lineStyle: { width: 1.8, color: teal }, itemStyle: { color: teal, borderColor: surface, borderWidth: 1 }, data: rows.map(row => rateNumber(visibleStageRate(row, 'bright', rateBasis))) }, @@ -1350,7 +1356,7 @@ export function TrendChart({ rows, mode, stage, rateBasis, targetRate, selectedP } instance.setOption(option, { replaceMerge: ['series', 'yAxis'], lazyUpdate: false }); refreshBarMasks(); - }, [rows, mode, stage, rateBasis, targetRate, themeRevision, refreshBarMasks, onlyStage]); + }, [rows, mode, stage, rateBasis, targetRate, themeRevision, refreshBarMasks, onlyStage, selectedPeriod]); const dimmedPeriod = selectedPeriod === lineSelectedPeriod ? undefined : selectedPeriod; @@ -1373,7 +1379,7 @@ export function TrendChart({ rows, mode, stage, rateBasis, targetRate, selectedP const dimmed = dimmedPeriod != null && mask.period !== dimmedPeriod; return [ { id: `wash-${mask.period}`, type: 'rect', silent: true, z: 2, transition: ['shape'], - shape: { x: mask.left, y: mask.top, width: mask.width, height: dimmed ? mask.height : 0 }, style: { fill: surface, opacity: .72 } }, + shape: { x: mask.left, y: mask.top, width: mask.width, height: dimmed ? mask.height : 0 }, style: { fill: surface, opacity: trendBarPalette(getWorkspaceTheme(document.documentElement.dataset.workspaceTheme).id).wash } }, { id: `focus-${mask.period}`, type: 'rect', silent: true, z: 3, transition: ['style'], shape: { x: mask.left, y: mask.top, width: mask.width, height: mask.height }, style: { fill: 'transparent', stroke: 'rgba(137,165,255,.7)', lineWidth: 1, shadowBlur: 11, shadowColor: 'rgba(117,151,255,.26)', opacity: dimmedPeriod === mask.period ? 1 : 0 } }, diff --git a/web/src/trendBarPalette.ts b/web/src/trendBarPalette.ts new file mode 100644 index 0000000..f669ba9 --- /dev/null +++ b/web/src/trendBarPalette.ts @@ -0,0 +1,14 @@ +import {getWorkspaceTheme,type WorkspaceThemeId} from './ui-themes'; +export type BarPalette={qualified:string;scrap:string;selectedQualified:string;selectedScrap:string;hoverQualified:string;hoverScrap:string;wash:number}; +const selected:BarPalette={qualified:'#99A8E3',scrap:'#E49A70',selectedQualified:'#7F92DA',selectedScrap:'#DB8656',hoverQualified:'#6078CE',hoverScrap:'#CD7546',wash:.50}; +export const blend=(front:string,back:string,alpha:number)=>'#'+[0,2,4].map(offset=>Math.round(parseInt(front.slice(1+offset,3+offset),16)*alpha+parseInt(back.slice(1+offset,3+offset),16)*(1-alpha)).toString(16).padStart(2,'0')).join('').toUpperCase(); +/** 已确认的 01 轻度加深:沿用各主题蓝色方向及原有交互。 */ +export function trendBarPalette(themeId:WorkspaceThemeId):BarPalette { + const p=selected,theme=getWorkspaceTheme(themeId); + if(themeId==='light')return p; + if(themeId==='dark'){ + const qualified='#6076A7'; + return {...p,qualified,selectedQualified:blend(qualified,'#B8C8FF',.72),hoverQualified:blend(qualified,'#CCD8FF',.60),scrap:'#E6A171',selectedScrap:blend(p.selectedScrap,'#FFD1A6',.56),hoverScrap:blend(p.hoverScrap,'#FFCC9A',.54)}; + } + return {...p,qualified:blend(theme.muted,theme.primary,.76),selectedQualified:blend(theme.muted,theme.primary,.50),hoverQualified:blend(theme.primary,'#263451',.94)}; +}