<commit_before>/* jshint maxstatements: 50 */

var ping = ping || {};

ping.graph = {};

ping.graph.create = function (vnode) {
  var margin = {top: 20, right: 50, bottom: 50, left: 60};
  var width = vnode.dom.clientWidth - margin.left - margin.right;
  var height = 300 - margin.top - margin.bottom;

  var x = d3.scaleTime().range([0, width]);
  var y = d3.scaleLinear().range([height, 0]);
  var z = d3.scaleOrdinal(d3.schemeCategory10);

  var line = d3.line()
      .curve(d3.curveLinear)
      .x(function(d) { return x(d.time); })
      .y(function(d) { return y(d.latency); });

  var timeParse = d3.timeParse('%H:%M:%S');

  var xAxis = d3.axisBottom(x)
      .tickFormat(d3.timeFormat(':%S'));
  var yAxis = d3.axisLeft(y)
      .tickFormat(function (v) { return v + ' ms'; });

  // Create SVG
  var svg = d3.select(vnode.dom).append('svg')
      .attr('width', width + margin.left + margin.right)
      .attr('height', height + margin.top + margin.bottom)
      .append('g')
      .attr('transform',
            'translate(' + margin.left + ',' + margin.top + ')');

  // X axis
  svg.append('g')
    .attr('class', 'x-axis')
    .attr('transform', 'translate(0,' + height + ')')
    .call(xAxis);

  // Y axis
  svg.append('g')
    .attr('class', 'y-axis')
    .call(yAxis);
<commit_msg>ping: Display unit above Y axis<commit_after>/* jshint maxstatements: 50 */

var ping = ping || {};

ping.graph = {};

ping.graph.create = function (vnode) {
  var margin = {top: 20, right: 50, bottom: 50, left: 60};
  var width = vnode.dom.clientWidth - margin.left - margin.right;
  var height = 300 - margin.top - margin.bottom;

  var x = d3.scaleTime().range([0, width]);
  var y = d3.scaleLinear().range([height, 0]);
  var z = d3.scaleOrdinal(d3.schemeCategory10);

  var line = d3.line()
      .curve(d3.curveLinear)
      .x(function(d) { return x(d.time); })
      .y(function(d) { return y(d.latency); });

  var timeParse = d3.timeParse('%H:%M:%S');

  var xAxis = d3.axisBottom(x)
      .tickFormat(d3.timeFormat(':%S'));
  var yAxis = d3.axisLeft(y);

  // Create SVG
  var svg = d3.select(vnode.dom).append('svg')
      .attr('width', width + margin.left + margin.right)
      .attr('height', height + margin.top + margin.bottom)
      .append('g')
      .attr('transform',
            'translate(' + margin.left + ',' + margin.top + ')');

  // X axis
  svg.append('g')
    .attr('class', 'x-axis')
    .attr('transform', 'translate(0,' + height + ')')
    .call(xAxis);

  // Y axis
  svg.append('g')
    .attr('class', 'y-axis')
    .call(yAxis)
    .append('text')
    .attr('y', -10)
    .attr('x', 40)
    .text('Latency (ms)');

{'fraction_non_alphanumeric': 0.2063372312334968, 'fraction_numerical': 0.023387400980761978, 'mean_word_length': 2.832369942196532, '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': '2112021', 'n_tokens_mistral': 1031, 'n_tokens_neox': 971, 'n_words': 207}