<commit_before>$(document).ready(function () {
  var charts = [];

  function buildChartData(positions) {
    var data = {
      labels: [],
      datasets: []
    };
    var smaDataset = {
      type: "line",
      label: "10-month SMA",
      data: [],
      fill: false,
      borderColor: "rgb(33, 133, 181)",
      pointRadius: 0
    };
    var priceDataset = {
      type: "bar",
      label: "Price",
      data: [],
      backgroundColor: "rgba(35, 139, 69, 0.5)"
    };
    positions.forEach(function (position) {
      var date = formatDate(position.date);
      var status = position.invested ? "Invested" : "Move to G";
      data.labels.push([date, status]);
      smaDataset.data.push(position.sma);
      priceDataset.data.push(position.price);
    });
    data.datasets.push(smaDataset);
    data.datasets.push(priceDataset);
    return data;
  }

  function renderChart(targetElement, data) {
    var chart = new Chart(targetElement, {
      type: "bar",
      data: data
    });
  }

  function formatDate(isoDate) {
    var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    var dateComponents = isoDate.split("-");
    var year = dateComponents[0];
    var month = parseInt(dateComponents[1]);
    return monthNames[month - 1] + " " + year;
  }

  $("canvas.chart").each(function () {
    var fund = $(this).data("fund");
    var targetElement = $(this);
    $.getJSON("/data/" + fund + ".json", function (json) {
      var positions = json["positions"];
      var data = buildChartData(positions);
      renderChart(targetElement, data);
    });
  });
});
<commit_msg>use line chart for prices<commit_after>$(document).ready(function () {
  var charts = [];

  function buildChartData(positions) {
    var data = {
      labels: [],
      datasets: []
    };
    var smaDataset = {
      type: "line",
      label: "10-month SMA",
      data: [],
      fill: false,
      borderColor: "rgb(33, 133, 181)"
    };
    var priceDataset = {
      type: "line",
      label: "Price",
      data: [],
      backgroundColor: "rgba(35, 139, 69, 0.3)",
      borderColor: "rgb(35, 139, 69)"
    };
    positions.forEach(function (position) {
      var date = formatDate(position.date);
      var status = position.invested ? "Invested" : "Move to G";
      data.labels.push([date, status]);
      smaDataset.data.push(position.sma);
      priceDataset.data.push(position.price);
    });
    data.datasets.push(smaDataset);
    data.datasets.push(priceDataset);
    return data;
  }

  function renderChart(targetElement, data) {
    var chart = new Chart(targetElement, {
      type: "line",
      data: data
    });
  }

  function formatDate(isoDate) {
    var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    var dateComponents = isoDate.split("-");
    var year = dateComponents[0];
    var month = parseInt(dateComponents[1]);
    return monthNames[month - 1] + " " + year;
  }

  $("canvas.chart").each(function () {
    var fund = $(this).data("fund");
    var targetElement = $(this);
    $.getJSON("/data/" + fund + ".json", function (json) {
      var positions = json["positions"];
      var data = buildChartData(positions);
      renderChart(targetElement, data);
    });
  });
});

{'fraction_non_alphanumeric': 0.17506791427709026, 'fraction_numerical': 0.01569574403863568, 'mean_word_length': 2.7361894024802704, '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': '4865020', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1064, 'n_words': 240}