<commit_before>const COLOR_PINK = "rgb(255, 99, 132)";
const COLOR_GREEN = "rgb(99, 255, 132)";
const COLOR_BLUE = "rgb(51, 153, 255)";

// TODO: DRY with stats.js
function drawChart(ctx, title, labels, axes, dataSets) {
  var chart = new Chart(ctx, {
    type: "line",
    data: {
      labels: labels,
      datasets: dataSets,
    },
    options: {
      responsive: true,
      stacked: false,
      title: {
        display: true,
        text: title,
      },
      scales: {
        yAxes: axes,
      },
    },
  });
}

async function makeMetricChart(ctx) {
  const resp = await fetchData();

  const y_axis = {
    id: "y-axis",<commit_msg>Chart clearing<commit_after>const COLOR_PINK = "rgb(255, 99, 132)";
const COLOR_GREEN = "rgb(99, 255, 132)";
const COLOR_BLUE = "rgb(51, 153, 255)";

let lastChart = undefined;

// TODO: DRY with stats.js
function drawChart(ctx, title, labels, axes, dataSets) {
  if (lastChart) {
    lastChart.clear();
  }

  lastChart = new Chart(ctx, {
    type: "line",
    data: {
      labels: labels,
      datasets: dataSets,
    },
    options: {
      responsive: true,
      stacked: false,
      title: {
        display: true,
        text: title,
      },
      scales: {
        yAxes: axes,
      },
    },
  });
}

async function makeMetricChart(ctx) {
  const resp = await fetchData();

  const y_axis = {
    id: "y-axis",
{'fraction_non_alphanumeric': 0.14410480349344978, 'fraction_numerical': 0.034934497816593885, 'mean_word_length': 2.411910669975186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6018015', 'n_tokens_mistral': 535, 'n_tokens_neox': 483, 'n_words': 125}