aider/docs
Paul Gauthier 6d9043cf24 aider: Added a bar chart using Chart.js to the leaderboard.md file.
# Aider chat conversation:

USER: add a bar chart using chart.js

ASSISTANT: To add a bar chart using Chart.js to the `leaderboard.md` file, you will need to include the Chart.js library, prepare a canvas element where the chart will be rendered, and write the JavaScript code to create the bar chart. Here's the diff that adds these elements to the `leaderboard.md` file:

```diff
--- docs/leaderboard.md
+++ docs/leaderboard.md
@@ ... @@
 <table style="width: 90%; max-width: 800px; margin: auto; border-collapse: collapse; box-shadow: 0 2px 4px rgba(0,0,0,0.1); font-size: 14px;">
   <!-- Table content -->
 </table>
+
+<canvas id="leaderboardChart" width="800" height="450"></canvas>
+
+<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
+<script>
+document.addEventListener('DOMContentLoaded', function () {
+  var ctx = document.getElementById('leaderboardChart').getContext('2d');
+  var leaderboardData = {
+    labels: [], // Populate with model names
+    datasets: [{
+      label: 'Percent correct',
+      data: [], // Populate with percent correct values
+      backgroundColor: 'rgba(54, 162, 235, 0.2)',
+      borderColor: 'rgba(54, 162, 235, 1)',
+      borderWidth: 1
+    }]
+  };
+
+  // Fetch leaderboard data and populate the chart
+  fetch('/_data/leaderboard.csv')
+    .then(function (response) {
+      return response.text();
+    })
+    .then(function (text) {
+      var rows = text.split('\n');
+      rows.forEach(function (row) {
+        var columns = row.split(',');
+        if (columns.length === 4) {
+          leaderboardData.labels.push(columns[0]);
+          leaderboardData.datasets[0].data.push(parseFloat(columns[1]));
+        }
+      });
+      new Chart(ctx, {
+        type: 'bar',
+        data: leaderboardData,
+        options: {
+          scales: {
+            y: {
+              beginAtZero: true
+            }
+          }
+        }
+      });
+    });
+});
+</script>
```

This diff adds a canvas element for the chart, includes the Chart.js library from a CDN, and provides a script that initializes the bar chart with data from the leaderboard CSV file. The script fetches the CSV data, parses it, and populates the chart with the model names and their corresponding "Percent correct" values.
2024-05-04 10:11:25 -07:00
..
benchmarks-0125.md added images 2024-02-19 17:46:30 -08:00
benchmarks-1106.md added images 2024-02-19 17:46:30 -08:00
benchmarks-speed-1106.md canonical_url 2024-02-23 08:54:38 -08:00
benchmarks.md added images 2024-02-19 17:46:30 -08:00
commands.md Added /web to commands doc 2024-02-08 14:39:18 -08:00
conventions.md instructions->conventions 2024-02-24 07:16:29 -08:00
ctags.md layout 2024-02-19 14:56:35 -08:00
docker.md Added libportaudio2 to the docker container 2023-10-18 13:38:41 -07:00
faq.md copy 2024-04-29 20:42:44 -07:00
install.md copy 2024-05-02 08:31:13 -07:00
leaderboard.md aider: Added a bar chart using Chart.js to the leaderboard.md file. 2024-05-04 10:11:25 -07:00
llms.md copy 2024-05-03 17:14:56 -07:00
repomap.md added images 2024-02-19 17:46:30 -08:00
unified-diffs.md copy 2024-02-24 14:51:52 -08:00
voice.md copy 2023-09-25 12:25:22 -07:00