Skip to content

Commit f51c00b

Browse files
committed
tamen
1 parent 284c676 commit f51c00b

File tree

2 files changed

+16
-42
lines changed

2 files changed

+16
-42
lines changed

app/(default)/(project)/TAMEn/chart/generalization-unseen.tsx

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ const robustnessConfig = {
4343

4444
const NARROW_CHART_PX = 560;
4545

46-
const PHASE_LABEL_SHORT: Record<string, string> = {
47-
"Herbal Transfer": "Herbal",
48-
"Cable Mounting": "Cable",
49-
"Binder Clip Removal": "Binder",
50-
};
51-
52-
const TASK_LABEL_SHORT: Record<string, string> = {
53-
"Herbal Transfer": "Herbal",
54-
"Cable Mounting": "Cable",
55-
};
56-
5746
function useChartNarrow(ref: React.RefObject<HTMLDivElement | null>) {
5847
const [narrow, setNarrow] = React.useState(false);
5948

@@ -74,7 +63,7 @@ function useChartNarrow(ref: React.RefObject<HTMLDivElement | null>) {
7463
export function GeneralizationUnseenChart() {
7564
const chartRef = React.useRef<HTMLDivElement>(null);
7665
const narrow = useChartNarrow(chartRef);
77-
const tickPx = narrow ? 7 : 10;
66+
const tickPx = narrow ? 8 : 10;
7867

7968
return (
8069
<Card className="border border-white/20 bg-black/60 text-white">
@@ -91,13 +80,13 @@ export function GeneralizationUnseenChart() {
9180
<ChartContainer
9281
ref={chartRef}
9382
config={chartConfig}
94-
className="!aspect-auto h-[232px] md:h-[235px]"
83+
className="!aspect-auto h-[248px] md:h-[235px]"
9584
>
9685
<BarChart
9786
data={chartData}
9887
margin={{
9988
top: 12,
100-
bottom: narrow ? 40 : 8,
89+
bottom: narrow ? 48 : 8,
10190
left: narrow ? 2 : 4,
10291
right: narrow ? 2 : 4,
10392
}}
@@ -110,18 +99,15 @@ export function GeneralizationUnseenChart() {
11099
tickLine={false}
111100
axisLine={false}
112101
tickMargin={narrow ? 2 : 8}
113-
angle={narrow ? -34 : 0}
102+
angle={narrow ? -36 : 0}
114103
textAnchor={narrow ? "end" : "middle"}
115104
interval={0}
116-
height={narrow ? 52 : 28}
105+
height={narrow ? 58 : 28}
117106
tick={{
118107
fontSize: tickPx,
119108
fill: "rgba(255,255,255,0.65)",
120109
}}
121110
dy={narrow ? 4 : 0}
122-
tickFormatter={(v) =>
123-
narrow ? (PHASE_LABEL_SHORT[String(v)] ?? String(v)) : String(v)
124-
}
125111
/>
126112
<YAxis
127113
domain={[0, 100]}
@@ -190,7 +176,7 @@ export function GeneralizationUnseenChart() {
190176
export function RobustnessDisturbanceChart() {
191177
const chartRef = React.useRef<HTMLDivElement>(null);
192178
const narrow = useChartNarrow(chartRef);
193-
const tickPx = narrow ? 7 : 10;
179+
const tickPx = narrow ? 8 : 10;
194180

195181
return (
196182
<Card className="border border-white/20 bg-black/60 text-white">
@@ -206,13 +192,13 @@ export function RobustnessDisturbanceChart() {
206192
<ChartContainer
207193
ref={chartRef}
208194
config={robustnessConfig}
209-
className="!aspect-auto h-[238px] md:h-[245px]"
195+
className="!aspect-auto h-[252px] md:h-[245px]"
210196
>
211197
<BarChart
212198
data={robustnessWholeTaskData}
213199
margin={{
214200
top: 12,
215-
bottom: narrow ? 40 : 8,
201+
bottom: narrow ? 46 : 8,
216202
left: narrow ? 2 : 4,
217203
right: narrow ? 2 : 4,
218204
}}
@@ -225,18 +211,15 @@ export function RobustnessDisturbanceChart() {
225211
tickLine={false}
226212
axisLine={false}
227213
tickMargin={narrow ? 2 : 8}
228-
height={narrow ? 48 : 28}
214+
height={narrow ? 54 : 28}
229215
interval={0}
230-
angle={narrow ? -32 : 0}
216+
angle={narrow ? -34 : 0}
231217
textAnchor={narrow ? "end" : "middle"}
232218
tick={{
233219
fontSize: tickPx,
234220
fill: "rgba(255,255,255,0.65)",
235221
}}
236222
dy={narrow ? 4 : 0}
237-
tickFormatter={(v) =>
238-
narrow ? (TASK_LABEL_SHORT[String(v)] ?? String(v)) : String(v)
239-
}
240223
/>
241224
<YAxis
242225
domain={[0, 100]}

app/(default)/(project)/TAMEn/chart/policy-rollouts-average.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,7 @@ const chartConfig = {
5656
},
5757
} satisfies ChartConfig
5858

59-
const X_AXIS_SHORT: Record<string, string> = {
60-
"1": "Herbal",
61-
"2": "Cable",
62-
"3": "Binder",
63-
"4": "Dish",
64-
"5": "Avg.",
65-
}
66-
67-
/** Chart area narrower than this → shorten X labels & shrink ticks (avoids overlap in padded layouts). */
59+
/** Chart area narrower than this → tilt X labels & tighten margins (full names, no abbreviations). */
6860
const NARROW_CHART_PX = 560
6961

7062
export function PolicyRolloutsAverage() {
@@ -82,7 +74,7 @@ export function PolicyRolloutsAverage() {
8274
return () => ro.disconnect()
8375
}, [])
8476

85-
const tickPx = narrowChart ? 7 : 11
77+
const tickPx = narrowChart ? 8 : 11
8678

8779
return (
8880
<Card className="border border-white/20 bg-black text-white">
@@ -93,14 +85,14 @@ export function PolicyRolloutsAverage() {
9385
<ChartContainer
9486
ref={chartRef}
9587
config={chartConfig}
96-
className="!aspect-auto h-[278px] md:h-[260px]"
88+
className="!aspect-auto h-[292px] md:h-[260px]"
9789
>
9890
<BarChart
9991
accessibilityLayer
10092
data={chartData}
10193
margin={{
10294
top: 12,
103-
bottom: narrowChart ? 44 : 24,
95+
bottom: narrowChart ? 52 : 24,
10496
left: narrowChart ? 6 : 16,
10597
right: narrowChart ? 4 : 16,
10698
}}
@@ -113,17 +105,16 @@ export function PolicyRolloutsAverage() {
113105
tickMargin={narrowChart ? 2 : 8}
114106
axisLine={false}
115107
interval={0}
116-
height={narrowChart ? 52 : 32}
108+
height={narrowChart ? 58 : 32}
117109
tick={{
118110
fontSize: tickPx,
119111
fill: "rgba(255,255,255,0.65)",
120112
}}
121-
angle={narrowChart ? -35 : 0}
113+
angle={narrowChart ? -38 : 0}
122114
textAnchor={narrowChart ? "end" : "middle"}
123115
dy={narrowChart ? 4 : 0}
124116
tickFormatter={(value) => {
125117
const v = String(value)
126-
if (narrowChart && X_AXIS_SHORT[v]) return X_AXIS_SHORT[v]
127118
const full =
128119
chartConfig[v as keyof typeof chartConfig]?.label
129120
return typeof full === "string" ? full : v

0 commit comments

Comments
 (0)