<commit_before>Template.homeResidentActivitySumsByType.created = function () {
  // Get reference to template instance
  var instance = this;

  // set up home resident activity sums by type reactive variable
  var homeResidentsActivitySumsByType = new ReactiveVar();

  // Get home resident activity sums from server method
  Meteor.call('getHomeResidentsActivitySumsByType', function (error, activitySums) {
    //Set the home resident activity sums variable with the returned activity sums
    homeResidentsActivitySumsByType.set(activitySums);
  });
};
<commit_msg>Instance created and rendered functions<commit_after>Template.homeResidentActivitySumsByType.created = function () {
  // Get reference to template instance
  var instance = this;

  // Get current home ID
  instance.homeId = Router.current().params.homeId;

  // set up home resident activity sums by type reactive variable
 instance.homeResidentsActivitySumsByType = new ReactiveVar();

  // Get home resident activity sums from server method
  Meteor.call('getHomeResidentsActivitySumsByType', instance.homeId, function (error, activitySums) {
    //Set the home resident activity sums variable with the returned activity sums
    instance.homeResidentsActivitySumsByType.set(activitySums);
  });

  instance.autorun(function () {
    var homeResidentsActivitySumsByType = instance.homeResidentsActivitySumsByType.get();

   if (instance.view.isRendered && homeResidentsActivitySumsByType) {
      // Draw the chart
      var activityChart = new dimple.chart(instance.chartSvg, homeResidentsActivitySumsByType);
      activityChart.setBounds(60, 45, 510, 315)
      var residentAxis = activityChart.addCategoryAxis("x", "residentName");
     residentAxis.title = "Resident Name / Activity Count";
      var activitiesAxis = activityChart.addMeasureAxis("y", "sum");
     activitiesAxis.title = "Number of Activities";
      activityChart.addSeries("activityTypeName", dimple.plot.bar);
      activityChart.addLegend(200, 10, 380, 20, "right");
      activityChart.draw();
    };
  });
};

Template.homeResidentActivitySumsByType.rendered = function () {
  // Get reference to template instance
  var instance = this;

  // Get reference to chart div
 instance.chartSvg = dimple.newSvg("#residentActivitiesSummary", 600, 400);
};
{'fraction_non_alphanumeric': 0.09260869565217392, 'fraction_numerical': 0.011304347826086957, 'mean_word_length': 4.557971014492754, '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': '5204532', 'n_tokens_mistral': 659, 'n_tokens_neox': 612, 'n_words': 171}