thinkwee
commited on
Commit
·
05228ad
1
Parent(s):
7247a32
update animation
Browse files
charts.js
CHANGED
|
@@ -765,6 +765,20 @@ function initRankingCharts() {
|
|
| 765 |
return;
|
| 766 |
}
|
| 767 |
renderRankingCharts('novelty', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 768 |
}
|
| 769 |
|
| 770 |
// Ranking mode toggle event listener
|
|
@@ -936,13 +950,39 @@ function initTurnCharts() {
|
|
| 936 |
showlegend: false
|
| 937 |
};
|
| 938 |
|
| 939 |
-
Plotly.newPlot(`turn-${scenario}`, traces, layout, plotlyConfig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 940 |
});
|
| 941 |
}
|
| 942 |
|
| 943 |
// ============================================================================
|
| 944 |
// PROBING RESULTS - 3 Charts with animated mode switching
|
| 945 |
// ============================================================================
|
|
|
|
|
|
|
| 946 |
function initProbingCharts() {
|
| 947 |
// Check if data is loaded
|
| 948 |
if (typeof DDR_DATA === 'undefined' || !DDR_DATA.probing) {
|
|
@@ -950,6 +990,33 @@ function initProbingCharts() {
|
|
| 950 |
return;
|
| 951 |
}
|
| 952 |
renderProbingCharts('byProgress');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 953 |
}
|
| 954 |
|
| 955 |
function renderProbingCharts(mode) {
|
|
@@ -1128,7 +1195,31 @@ function initErrorChart() {
|
|
| 1128 |
margin: { t: 50, r: 20, b: 100, l: 50 }
|
| 1129 |
};
|
| 1130 |
|
| 1131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1132 |
}
|
| 1133 |
|
| 1134 |
// ============================================================================
|
|
@@ -1145,6 +1236,8 @@ const ENTROPY_MODELS = [
|
|
| 1145 |
|
| 1146 |
let currentEntropyScenario = '10k';
|
| 1147 |
|
|
|
|
|
|
|
| 1148 |
function initEntropyCharts() {
|
| 1149 |
if (typeof ENTROPY_DATA === 'undefined') {
|
| 1150 |
// Retry if data not loaded yet
|
|
@@ -1164,6 +1257,25 @@ function initEntropyCharts() {
|
|
| 1164 |
|
| 1165 |
// Initial render
|
| 1166 |
renderEntropyCharts('10k');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1167 |
}
|
| 1168 |
|
| 1169 |
function renderEntropyCharts(scenario) {
|
|
|
|
| 765 |
return;
|
| 766 |
}
|
| 767 |
renderRankingCharts('novelty', false);
|
| 768 |
+
|
| 769 |
+
// Add fade-in animation for ranking charts
|
| 770 |
+
setTimeout(() => {
|
| 771 |
+
['mimic', '10k', 'globem'].forEach((id, index) => {
|
| 772 |
+
const chart = document.getElementById(`ranking-${id}`);
|
| 773 |
+
if (chart) {
|
| 774 |
+
chart.style.opacity = '0';
|
| 775 |
+
chart.style.transition = `opacity 0.6s ease-out ${index * 150}ms`;
|
| 776 |
+
requestAnimationFrame(() => {
|
| 777 |
+
chart.style.opacity = '1';
|
| 778 |
+
});
|
| 779 |
+
}
|
| 780 |
+
});
|
| 781 |
+
}, 100);
|
| 782 |
}
|
| 783 |
|
| 784 |
// Ranking mode toggle event listener
|
|
|
|
| 950 |
showlegend: false
|
| 951 |
};
|
| 952 |
|
| 953 |
+
Plotly.newPlot(`turn-${scenario}`, traces, layout, plotlyConfig).then(() => {
|
| 954 |
+
// Animate fill areas growing from baseline
|
| 955 |
+
const graphDiv = document.getElementById(`turn-${scenario}`);
|
| 956 |
+
if (!graphDiv) return;
|
| 957 |
+
|
| 958 |
+
// Get all fill paths and animate them
|
| 959 |
+
const paths = graphDiv.querySelectorAll('.scatterlayer .trace path');
|
| 960 |
+
paths.forEach((path, index) => {
|
| 961 |
+
const len = path.getTotalLength();
|
| 962 |
+
if (len > 0) {
|
| 963 |
+
path.style.transition = 'none';
|
| 964 |
+
path.style.strokeDasharray = len + ' ' + len;
|
| 965 |
+
path.style.strokeDashoffset = len;
|
| 966 |
+
path.style.opacity = '0';
|
| 967 |
+
|
| 968 |
+
// Staggered animation
|
| 969 |
+
const delay = index * 50;
|
| 970 |
+
requestAnimationFrame(() => {
|
| 971 |
+
path.style.transition = `stroke-dashoffset 0.8s ease-out ${delay}ms, opacity 0.4s ease-out ${delay}ms`;
|
| 972 |
+
path.style.strokeDashoffset = '0';
|
| 973 |
+
path.style.opacity = '1';
|
| 974 |
+
});
|
| 975 |
+
}
|
| 976 |
+
});
|
| 977 |
+
});
|
| 978 |
});
|
| 979 |
}
|
| 980 |
|
| 981 |
// ============================================================================
|
| 982 |
// PROBING RESULTS - 3 Charts with animated mode switching
|
| 983 |
// ============================================================================
|
| 984 |
+
let probingChartsInitialized = false;
|
| 985 |
+
|
| 986 |
function initProbingCharts() {
|
| 987 |
// Check if data is loaded
|
| 988 |
if (typeof DDR_DATA === 'undefined' || !DDR_DATA.probing) {
|
|
|
|
| 990 |
return;
|
| 991 |
}
|
| 992 |
renderProbingCharts('byProgress');
|
| 993 |
+
|
| 994 |
+
// Add line drawing animation for initial render
|
| 995 |
+
if (!probingChartsInitialized) {
|
| 996 |
+
probingChartsInitialized = true;
|
| 997 |
+
setTimeout(() => {
|
| 998 |
+
['mimic', 'globem', '10k'].forEach((scenario, scenarioIndex) => {
|
| 999 |
+
const graphDiv = document.getElementById(`probing-${scenario}`);
|
| 1000 |
+
if (!graphDiv) return;
|
| 1001 |
+
|
| 1002 |
+
const paths = graphDiv.querySelectorAll('.scatterlayer .trace .lines path');
|
| 1003 |
+
paths.forEach((path, index) => {
|
| 1004 |
+
const len = path.getTotalLength();
|
| 1005 |
+
if (len > 0) {
|
| 1006 |
+
path.style.transition = 'none';
|
| 1007 |
+
path.style.strokeDasharray = len + ' ' + len;
|
| 1008 |
+
path.style.strokeDashoffset = len;
|
| 1009 |
+
|
| 1010 |
+
const delay = scenarioIndex * 100 + index * 60;
|
| 1011 |
+
requestAnimationFrame(() => {
|
| 1012 |
+
path.style.transition = `stroke-dashoffset 0.8s ease-out ${delay}ms`;
|
| 1013 |
+
path.style.strokeDashoffset = '0';
|
| 1014 |
+
});
|
| 1015 |
+
}
|
| 1016 |
+
});
|
| 1017 |
+
});
|
| 1018 |
+
}, 200);
|
| 1019 |
+
}
|
| 1020 |
}
|
| 1021 |
|
| 1022 |
function renderProbingCharts(mode) {
|
|
|
|
| 1195 |
margin: { t: 50, r: 20, b: 100, l: 50 }
|
| 1196 |
};
|
| 1197 |
|
| 1198 |
+
// Start with zero-height bars for animation
|
| 1199 |
+
const initialTraces = [{
|
| 1200 |
+
...traces[0],
|
| 1201 |
+
y: data.map(() => 0), // Start at 0
|
| 1202 |
+
text: data.map(() => '') // Hide text initially
|
| 1203 |
+
}];
|
| 1204 |
+
|
| 1205 |
+
Plotly.newPlot('error-chart', initialTraces, layout, plotlyConfig).then(() => {
|
| 1206 |
+
// Animate bars growing from 0 to target values
|
| 1207 |
+
setTimeout(() => {
|
| 1208 |
+
Plotly.animate('error-chart', {
|
| 1209 |
+
data: traces,
|
| 1210 |
+
traces: [0]
|
| 1211 |
+
}, {
|
| 1212 |
+
transition: {
|
| 1213 |
+
duration: 800,
|
| 1214 |
+
easing: 'cubic-out'
|
| 1215 |
+
},
|
| 1216 |
+
frame: {
|
| 1217 |
+
duration: 800,
|
| 1218 |
+
redraw: true
|
| 1219 |
+
}
|
| 1220 |
+
});
|
| 1221 |
+
}, 200);
|
| 1222 |
+
});
|
| 1223 |
}
|
| 1224 |
|
| 1225 |
// ============================================================================
|
|
|
|
| 1236 |
|
| 1237 |
let currentEntropyScenario = '10k';
|
| 1238 |
|
| 1239 |
+
let entropyChartsInitialized = false;
|
| 1240 |
+
|
| 1241 |
function initEntropyCharts() {
|
| 1242 |
if (typeof ENTROPY_DATA === 'undefined') {
|
| 1243 |
// Retry if data not loaded yet
|
|
|
|
| 1257 |
|
| 1258 |
// Initial render
|
| 1259 |
renderEntropyCharts('10k');
|
| 1260 |
+
|
| 1261 |
+
// Add scatter point animation for initial render
|
| 1262 |
+
if (!entropyChartsInitialized) {
|
| 1263 |
+
entropyChartsInitialized = true;
|
| 1264 |
+
setTimeout(() => {
|
| 1265 |
+
for (let i = 0; i < 6; i++) {
|
| 1266 |
+
const chart = document.getElementById(`entropy-model-${i}`);
|
| 1267 |
+
if (chart) {
|
| 1268 |
+
chart.style.opacity = '0';
|
| 1269 |
+
chart.style.transform = 'scale(0.95)';
|
| 1270 |
+
chart.style.transition = `opacity 0.5s ease-out ${i * 100}ms, transform 0.5s ease-out ${i * 100}ms`;
|
| 1271 |
+
requestAnimationFrame(() => {
|
| 1272 |
+
chart.style.opacity = '1';
|
| 1273 |
+
chart.style.transform = 'scale(1)';
|
| 1274 |
+
});
|
| 1275 |
+
}
|
| 1276 |
+
}
|
| 1277 |
+
}, 100);
|
| 1278 |
+
}
|
| 1279 |
}
|
| 1280 |
|
| 1281 |
function renderEntropyCharts(scenario) {
|