Skip to content

Commit 78f5549

Browse files
committed
minor
1 parent 9493cad commit 78f5549

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

assets/js/main.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,22 @@ function drawBarChartPerBar(cfg){
185185

186186
bars.push({x,y,w:barW,h:bh,label:labels[i],value:v});
187187

188-
const t = labels[i].length>18 ? labels[i].slice(0,16)+"…" : labels[i];
189-
const isRiseLabel = (t === "RISE" || labels[i] === "RISE");
190-
ctx.fillStyle="rgba(11,16,32,.85)";
191-
ctx.font=(isRiseLabel?"700 ":"500 ")+"11px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";
192-
ctx.textAlign="center"; ctx.textBaseline="top";
193-
ctx.fillText(t, pad.l + i*groupW + groupW/2, pad.t+plotH+12);
188+
// === 修改开始:支持 \n 换行 ===
189+
const lines = labels[i].split('\n'); // 按换行符分割
190+
const isRiseLabel = (labels[i] === "RISE");
191+
192+
ctx.fillStyle = "rgba(11,16,32,.85)";
193+
ctx.font = (isRiseLabel ? "700 " : "500 ") + "11px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";
194+
ctx.textAlign = "center";
195+
ctx.textBaseline = "top";
196+
197+
lines.forEach((line, lineIdx) => {
198+
// 只有当单行文本过长时才截断(防止意外截断你的长标签)
199+
const textToDraw = (line.length > 20) ? line.slice(0, 18) + "…" : line;
200+
// lineIdx * 14 控制行间距
201+
ctx.fillText(textToDraw, pad.l + i * groupW + groupW / 2, pad.t + plotH + 12 + (lineIdx * 14));
202+
});
203+
// === 修改结束 ===
194204
}
195205

196206
if(cfg.title){
@@ -292,12 +302,22 @@ function drawGroupedBarChart(cfg){
292302

293303
bars.push({x,y,w:barW*0.92,h:bh,label:labels[i],series:s.name,value:v});
294304
}
295-
const t = labels[i].length>18 ? labels[i].slice(0,16)+"…" : labels[i];
296-
const isRiseLabel = (t === "RISE" || labels[i] === "RISE");
297-
ctx.fillStyle="rgba(11,16,32,.85)";
298-
ctx.font=(isRiseLabel?"700 ":"500 ")+"11px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";
299-
ctx.textAlign="center"; ctx.textBaseline="top";
300-
ctx.fillText(t, pad.l + i*groupW + groupW/2, pad.t+plotH+12);
305+
// === 修改开始:支持 \n 换行 ===
306+
const lines = labels[i].split('\n'); // 按换行符分割
307+
const isRiseLabel = (labels[i] === "RISE");
308+
309+
ctx.fillStyle = "rgba(11,16,32,.85)";
310+
ctx.font = (isRiseLabel ? "700 " : "500 ") + "11px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";
311+
ctx.textAlign = "center";
312+
ctx.textBaseline = "top";
313+
314+
lines.forEach((line, lineIdx) => {
315+
// 只有当单行文本过长时才截断(防止意外截断你的长标签)
316+
const textToDraw = (line.length > 20) ? line.slice(0, 18) + "…" : line;
317+
// lineIdx * 14 控制行间距
318+
ctx.fillText(textToDraw, pad.l + i * groupW + groupW / 2, pad.t + plotH + 12 + (lineIdx * 14));
319+
});
320+
// === 修改结束 ===
301321
}
302322

303323
if(cfg.title){

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ <h3>Dynamics Model Comparisons</h3>
490490

491491
</div>
492492

493-
<script>window.__RISE_CHARTS__ = {"main": {"Dynamic Brick Sorting": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [35.0, 15.0, 10.0, 10.0, 50.0, 85.0], "score": [8.28, 6.1, 7.68, 6.65, 9.0, 9.78]}, "Backpack Packing": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [30.0, 50.0, 35.0, 10.0, 40.0, 85.0], "score": [4.25, 7.0, 5.88, 3.5, 6.13, 9.5]}, "Box Closing": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [35.0, 40.0, 10.0, 10.0, 60.0, 95.0], "score": [7.5, 7.5, 4.75, 7.63, 8.13, 9.88]}}, "offline_ratio": {"ratio": [0.1, 0.3, 0.6, 0.9], "pick": [15.0, 78.75, 90.0, 90.0], "sort": [83.33, 80.95, 87.5, 80.56], "comp": [5.0, 25.0, 50.0, 30.0]}, "online_integration": {"labels": ["(\u2717,\u2717)", "(\u2713,\u2717)", "(\u2713,\u2713)"], "pick": [80.0, 96.25, 98.75], "sort": [76.56, 84.42, 92.41], "comp": [35.0, 40.0, 70.0]}, "module": {"labels": ["w/o Pre-train", "w/o Task-Centric", "w/o Progress", "w/o TD Learning", "RISE (all)"], "score": [7.43, 8.78, 8.78, 8.38, 9.43]}};</script>
493+
<script>window.__RISE_CHARTS__ = {"main": {"Dynamic Brick Sorting": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [35.0, 15.0, 10.0, 10.0, 50.0, 85.0], "score": [8.28, 6.1, 7.68, 6.65, 9.0, 9.78]}, "Backpack Packing": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [30.0, 50.0, 35.0, 10.0, 40.0, 85.0], "score": [4.25, 7.0, 5.88, 3.5, 6.13, 9.5]}, "Box Closing": {"methods": ["\u03c00.5", "\u03c00.5 + DAgger", "\u03c00.5 + PPO", "\u03c00.5 + DSRL", "RECAP", "RISE (Ours)"], "succ": [35.0, 40.0, 10.0, 10.0, 60.0, 95.0], "score": [7.5, 7.5, 4.75, 7.63, 8.13, 9.88]}}, "offline_ratio": {"ratio": [0.1, 0.3, 0.6, 0.9], "pick": [15.0, 78.75, 90.0, 90.0], "sort": [83.33, 80.95, 87.5, 80.56], "comp": [5.0, 25.0, 50.0, 30.0]}, "online_integration": {"labels": ["None", "+ online action", "+ online action\n + online state"], "pick": [80.0, 96.25, 98.75], "sort": [76.56, 84.42, 92.41], "comp": [35.0, 40.0, 70.0]}, "module": {"labels": ["w/o Pre-train", "w/o Task-Centric", "w/o Progress", "w/o TD Learning", "RISE (all)"], "score": [7.43, 8.78, 8.78, 8.38, 9.43]}};</script>
494494
</section>
495495

496496
<!-- <hr/> -->

0 commit comments

Comments
 (0)