mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 19:55:00 +00:00
perf: cache diagonal pattern and optimize label access in chart rendering
This commit is contained in:
parent
0e2c703e77
commit
277d7c0e04
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
var ctx = document.getElementById('editChart').getContext('2d');
|
var ctx = document.getElementById('editChart').getContext('2d');
|
||||||
|
const diagonalPattern = pattern.draw('diagonal', 'rgba(54, 162, 235, 0.2)');
|
||||||
const HIGHTLIGHT_MODEL = 'no no no no';
|
const HIGHTLIGHT_MODEL = 'no no no no';
|
||||||
var leaderboardData = {
|
var leaderboardData = {
|
||||||
labels: [],
|
labels: [],
|
||||||
|
@ -9,9 +10,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
backgroundColor: function(context) {
|
backgroundColor: function(context) {
|
||||||
const row = allData[context.dataIndex];
|
const row = allData[context.dataIndex];
|
||||||
if (row && row.edit_format === 'whole') {
|
if (row && row.edit_format === 'whole') {
|
||||||
return pattern.draw('diagonal', 'rgba(54, 162, 235, 0.2)');
|
return diagonalPattern;
|
||||||
}
|
}
|
||||||
const label = context.chart.data.labels[context.dataIndex] || '';
|
const label = leaderboardData.labels[context.dataIndex] || '';
|
||||||
return (label && label.includes(HIGHTLIGHT_MODEL)) ? 'rgba(255, 99, 132, 0.2)' : 'rgba(54, 162, 235, 0.2)';
|
return (label && label.includes(HIGHTLIGHT_MODEL)) ? 'rgba(255, 99, 132, 0.2)' : 'rgba(54, 162, 235, 0.2)';
|
||||||
},
|
},
|
||||||
borderColor: function(context) {
|
borderColor: function(context) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue