<commit_before>var d3 = require('d3');
var fs = require('fs');
var _ = require('underscore');
var default_layout = require('./axes.js').default_layout;
require('./brush');

// data
var content = fs.readFileSync('./df.json');
var df = JSON.parse(content);

_.each(df, function(arr, key) {
  if (!_.isArray(arr)) {
    return;
  }
  df[key] = _.last(arr, 1500);
});

var Figure = require('./figure.js');
var Line = require('./line.js');
var CandleStick = require('./candlestick.js');

var df2 = [];
var i = -1;
while (++i < df.high.length) {
  df2.push(df.high[i]+1);
}

var line = Line().data(df2);
var line2 = Line().data(df.high);
var candle = CandleStick().data(df);

var WIDTH = 1400;
var HEIGHT = 800;

d3.selectAll('body svg').remove();
var svg = d3.select('body').append('svg:svg');
var focus_svg = d3.select('body').append('svg:svg').attr('class', 'focus');

focus = Figure();
focus
  .width(1400)
  .height(100)
  .margin(40)
  .index(df.index);

focus(focus_svg);
focus.layer(line2, 'focus');
var brush = focus.brush();

fig = Figure();
fig.margin(40).width(WIDTH).height(HEIGHT).index(df.index);
fig(svg);
fig.x.attach(brush);

fig.layer(line, 'line');
fig.layer(line2, 'line2');
fig.layer(candle, 'candle');

// default to only first 100
fig.xchange([0, 100]);

default_layout(fig);

module.exports = null;<commit_msg>started playing with multiple figures<commit_after>var d3 = require('d3');
var fs = require('fs');
var _ = require('underscore');
var default_layout = require('./axes.js').default_layout;
require('./brush');

// data
var content = fs.readFileSync('./df.json');
var df = JSON.parse(content);

_.each(df, function(arr, key) {
  if (!_.isArray(arr)) {
    return;
  }
  df[key] = _.last(arr, 1500);
});

var Figure = require('./figure.js');
var Line = require('./line.js');
var CandleStick = require('./candlestick.js');

var df2 = [];
var i = -1;
while (++i < df.high.length) {
  df2.push(df.high[i]+1);
}

var line = Line().data(df2);
var line2 = Line().data(df.high);
var candle = CandleStick().data(df);

var WIDTH = 1400;
var HEIGHT = 800;

d3.selectAll('body svg').remove();
var svg = d3.select('body').append('svg:svg');
var svg2 = d3.select('body').append('svg:svg');
var focus_svg = d3.select('body').append('svg:svg').attr('class', 'focus');

focus = Figure();
focus.width(WIDTH)
  .margin({'left':40})
  .height(100)
  .index(df.index);

focus(focus_svg);
focus.layer(line2, 'focus');
var brush = focus.brush();

fig = Figure();
fig
  .width(WIDTH)
  .height(HEIGHT)
  .index(df.index);
fig(svg);

fig.x.attach(brush);

fig.layer(line, 'line');
fig.layer(line2, 'line2');
fig.layer(candle, 'candle');

// default to only first 100
fig.xchange([0, 100]);

fig.default_layout();

fig2 = Figure();
fig2
  .margin({'left':40})
  .width(WIDTH)
  .height(300)
  .index(df.index);
fig2(svg2);

fig2.x.attach(brush);
fig2.layer(line, 'line');
fig2.layer(line, 'line');
fig2.grid();

module.exports = null;
{'fraction_non_alphanumeric': 0.22460804362644854, 'fraction_numerical': 0.03237900477164281, 'mean_word_length': 4.655105973025048, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3905714', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1120, 'n_words': 230}