let max_score = 1;
let last_score = null;
let scores = [];
+ let scores_missing = [];
for (let halfmove_num = first_move_num; halfmove_num <= last_move_num; ++halfmove_num) {
if (data['score_history'][halfmove_num]) {
let score = compute_plot_score(data['score_history'][halfmove_num]);
last_score = score;
if (score < min_score) min_score = score;
if (score > max_score) max_score = score;
+ scores_missing.push(false);
+ } else {
+ scores_missing.push(true);
}
scores.push(last_score);
}
let color;
if (scores[i] === 0) {
color = [0.5, 0.5, 0.5];
- rect.setAttributeNS(null, 'y', base_y - 1);
+ rect.setAttributeNS(null, 'y', base_y);
rect.setAttributeNS(null, 'height', 1);
} else if (scores[i] > 0) {
color = [0.2, 0.4, 0.8];
rect.setAttributeNS(null, 'y', base_y - extent);
- rect.setAttributeNS(null, 'height', extent);
+ rect.setAttributeNS(null, 'height', extent + 1);
} else {
color = [1.0, 0.267, 0.267];
rect.setAttributeNS(null, 'y', base_y);
- rect.setAttributeNS(null, 'height', -extent);
+ rect.setAttributeNS(null, 'height', -extent + 1);
}
let hlcolor = [color[0], color[1], color[2]];
if (scores[i] !== 0) {
hlcolor[1] = Math.min(hlcolor[1] * 1.4, 1.0);
hlcolor[2] = Math.min(hlcolor[2] * 1.4, 1.0);
}
- rect.style.fill = 'rgb(' + color[0]*100.0 + '%, ' + color[1]*100.0 + '%, ' + color[2]*100.0 + '%)';
+ let alpha = scores_missing[i] ? 50 : 100;
+ rect.style.fill = 'rgba(' + color[0]*100.0 + '%, ' + color[1]*100.0 + '%, ' + color[2]*100.0 + '%, ' + alpha + '%)';
// score_history contains the Nth _position_, but format_tooltip
// wants to format the Nth _move_; thus the -1.