<commit_before>'use strict';

var gauge = require('../')
  , deepXtend = require('deep-extend')
  , small = require('../defaults/small')
  , simple = require('../defaults/simple');

function smallGauge () {
  var smallEl = document.createElement('div');
  document.body.appendChild(smallEl);
  gauge(smallEl, deepXtend(small, { label: { text: 'Proc Mem' } }));
}

function simpleGauge () {
  var simpleEl = document.createElement('div');
  document.body.appendChild(simpleEl);
  gauge(simpleEl, { label: { text: 'Main Mem' } });
}

simpleGauge();
smallGauge();<commit_msg>nicely tuned examples<commit_after>'use strict';

var gauge = require('../')
  , deepXtend = require('deep-extend')
  , small = require('../defaults/small')
  , simple = require('../defaults/simple')
  , gauges = [];

function createGauge (opts) {
  var el = document.createElement('div');
  el.setAttribute('class', 'gauge-container');
  document.body.appendChild(el);
  var g = gauge(el, opts);
  g.currentValue = g._range / 2;
  gauges.push(g);
}

function getRandomNextValue(gauge) {
  gauge.currentValue += (Math.random() - 0.5) * gauge._range / 10; 
  return gauge.currentValue;
}

function updateGauges() {
  gauges.forEach(function (gauge) {
    gauge.redraw(getRandomNextValue(gauge));
  });
}

// TODO: fix deep extend - currently messes with original
createGauge({ label: { text: 'Main Mem' } });
createGauge(deepXtend(small, { label: { text: 'Proc Mem' } }));

setInterval(updateGauges, 500);
{'fraction_non_alphanumeric': 0.17886178861788618, 'fraction_numerical': 0.005420054200542005, 'mean_word_length': 4.470370370370371, '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': '6090957', 'n_tokens_mistral': 492, 'n_tokens_neox': 483, 'n_words': 100}