bruAristimunha commited on
Commit
3b7f8cf
·
1 Parent(s): 1155fb2

Fix chart Y-axis: show architecture names and use automargin

Browse files

Y-axis labels were clipped because model IDs are long and the left
margin was fixed. Now shows the foundation model architecture name
(since adapter type is already indicated by the grouping) with numeric
suffixes for duplicates, and uses Plotly automargin so the axis sizes
itself to fit the labels.

frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Chart/useChartData.js CHANGED
@@ -16,11 +16,11 @@ const getScore = (model, key, display) => {
16
  return v != null && !isNaN(v) ? v : null;
17
  };
18
 
19
- const shortName = (model) => {
20
- const id = model.id || model.model?.name || "?";
21
- const parts = id.split("/");
22
- const name = parts.length > 1 ? parts.slice(1).join("/") : id;
23
- return name.length > 32 ? name.slice(0, 29) + "..." : name;
24
  };
25
 
26
  const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
@@ -93,6 +93,14 @@ const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
93
  const color = getAdapterColor(adapterKey);
94
  const label = getAdapterLabel(adapterKey);
95
 
 
 
 
 
 
 
 
 
96
  const ys = [];
97
  const xs = [];
98
  const stds = [];
@@ -102,7 +110,13 @@ const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
102
  ys.push(y);
103
  xs.push(m._score);
104
  stds.push(m._std);
105
- const n = shortName(m);
 
 
 
 
 
 
106
  names.push(n);
107
  allYTicks.push(y);
108
  allYLabels.push(n);
@@ -179,7 +193,7 @@ const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
179
 
180
  const layout = {
181
  height,
182
- margin: { l: 170, r: 30, t: 40, b: 60 },
183
  title: {
184
  text: `<b>${datasetLabel}</b>`,
185
  x: 0.5,
@@ -210,6 +224,7 @@ const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
210
  ticklen: 3,
211
  zeroline: false,
212
  range: [yMin, yMax],
 
213
  tickfont: { size: 11 },
214
  },
215
  shapes,
 
16
  return v != null && !isNaN(v) ? v : null;
17
  };
18
 
19
+ // Display name for the Y-axis. Since models are already grouped by adapter,
20
+ // show just the architecture (foundation model) as the primary label.
21
+ // Duplicates within a group get a numeric suffix.
22
+ const displayName = (model) => {
23
+ return model.model?.architecture || model.model?.name || model.id || "?";
24
  };
25
 
26
  const useChartData = (filteredData, scoreDisplay, selectedDataset) => {
 
93
  const color = getAdapterColor(adapterKey);
94
  const label = getAdapterLabel(adapterKey);
95
 
96
+ // Deduplicate display names within this group
97
+ const nameCounts = new Map();
98
+ models.forEach((m) => {
99
+ const base = displayName(m);
100
+ nameCounts.set(base, (nameCounts.get(base) || 0) + 1);
101
+ });
102
+ const nameIndex = new Map();
103
+
104
  const ys = [];
105
  const xs = [];
106
  const stds = [];
 
110
  ys.push(y);
111
  xs.push(m._score);
112
  stds.push(m._std);
113
+ const base = displayName(m);
114
+ let n = base;
115
+ if (nameCounts.get(base) > 1) {
116
+ const idx = (nameIndex.get(base) || 0) + 1;
117
+ nameIndex.set(base, idx);
118
+ n = `${base} (${idx})`;
119
+ }
120
  names.push(n);
121
  allYTicks.push(y);
122
  allYLabels.push(n);
 
193
 
194
  const layout = {
195
  height,
196
+ margin: { l: 20, r: 30, t: 40, b: 60 },
197
  title: {
198
  text: `<b>${datasetLabel}</b>`,
199
  x: 0.5,
 
224
  ticklen: 3,
225
  zeroline: false,
226
  range: [yMin, yMax],
227
+ automargin: true,
228
  tickfont: { size: 11 },
229
  },
230
  shapes,