<commit_before>var d3 = require('d3');
var _ = require('lodash');

module.exports = {

	create: function(data) {

		// !!! these should be added to the actual data
		data = {
			labels: {
				xAxis: 'Months',
				yAxis: 'Calories',
				keys: {
					BREAKFAST: 'Breakfast',
					LUNCH: 'Lunch',
					DINNER: 'Dinner',
					TOTAL: 'Total'
				}
			},
			keys: [
				'BREAKFAST',
				'LUNCH',
				'DINNER',
				'TOTAL'
			],
			BREAKFAST: {
				0: {
					x: 0,
					y: 5,
					xAxisLabel: 'January'
				},
				1: {
					x: 1,
					y: 50,
					xAxisLabel: 'February'
				},
				2: {
					x: 2,
					y: 25,
					xAxisLabel: 'February'
				}
			},
			LUNCH: {

			},
			DINNER: {

			},
			TOTAL: {

			}

		};

		// i guess we need to do some data cleaning here
		var lineKeys = data.keys;
		var monthKeys = [0,1,2,3,4,5,6,7,8,9,10,11,12];




		var margin = {top: 20, right: 80, bottom: 30, left: 50},
		    width = 960 - margin.left - margin.right,
		    height = 500 - margin.top - margin.bottom;

		var parseDate = d3.time.format("%Y%m%d").parse;

		var x = d3.scale.ordinal()
				.domain(monthKeys);
		    //.range([0, width]);

		var y = d3.scale.linear()
		    .range([height, 0]);

		// set the domain of the different lines
		// distinguished by color
		var color = d3.scale.category10()
				.domain(lineKeys);

		var xAxis = d3.svg.axis()
		    .scale(x)
		    .orient("bottom");

		var yAxis = d3.svg.axis()
		    .scale(y)
		    .orient("left");

		var line = d3.svg.line()
		    .interpolate("basis")
		    .x(function(d) { return x(d.x); })
		    .y(function(d) { return y(d.y); });

		var svg = d3.select("body").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 + ")");


		// start doing stuff with the data

		// set the domain of the different lines
		// distinguished by color
	  // color.domain(data.keys);



	  // data.forEach(function(d) {
	  //   d.date = parseDate(d.date);
	  // });

	  // var lines = color.domain().map(function(key) {
	  //   return {
	  //     key: key,
	  //     values: data[key]
	  //   };
	  // });

	  y.domain([
	  	5,
	  	50
	  ]);

	  svg.append("g")
	      .attr("class", "x axis")
	      .attr("transform", "translate(0," + height + ")")
	      .call(xAxis);

	  svg.append("g")
	      .attr("class", "y axis")
	      .call(yAxis)
	    .append("text")
	      .attr("transform", "rotate(-90)")
	      .attr("y", 6)
	      .attr("dy", ".71em")
	      .style("text-anchor", "end")
	      .text("Temperature (ºF)");

	  var city = svg.selectAll(".city")
	      .data(cities)
	    .enter().append("g")
	      .attr("class", "city");
<commit_msg>got the x axis working<commit_after>var d3 = require('d3');
var _ = require('lodash');

module.exports = {

	create: function(data) {

		// !!! these should be added to the actual data
		data = {
			labels: {
				xAxis: 'Months',
				yAxis: 'Calories',
				keys: {
					BREAKFAST: 'Breakfast',
					LUNCH: 'Lunch',
					DINNER: 'Dinner',
					TOTAL: 'Total'
				}
			},
			keys: [
				'BREAKFAST',
				'LUNCH',
				'DINNER',
				'TOTAL'
			],
			BREAKFAST: {
				0: {
					x: 0,
					y: 5,
					xAxisLabel: 'January'
				},
				1: {
					x: 1,
					y: 50,
					xAxisLabel: 'February'
				},
				2: {
					x: 2,
					y: 25,
					xAxisLabel: 'February'
				}
			},
			LUNCH: {

			},
			DINNER: {

			},
			TOTAL: {

			}

		};

		// i guess we need to do some data cleaning here
		var lineKeys = data.keys;
		var monthKeys = [0,1,2,3,4,5,6,7,8,9,10,11,12];




		var margin = {top: 20, right: 80, bottom: 30, left: 50},
		    width = 960 - margin.left - margin.right,
		    height = 500 - margin.top - margin.bottom;

		var x = d3.scale.ordinal()
				.domain(monthKeys)
		    .rangePoints([0, width], 0);

		var y = d3.scale.linear()
		    .range([height, 0]);

		// set the domain of the different lines
		// distinguished by color
		var color = d3.scale.category10()
				.domain(lineKeys);

		var xAxis = d3.svg.axis()
		    .scale(x)
		    .orient("bottom");

		var yAxis = d3.svg.axis()
		    .scale(y)
		    .orient("left");

		var line = d3.svg.line()
		    .interpolate("basis")
		    .x(function(d) { return x(d.x); })
		    .y(function(d) { return y(d.y); });

		var svg = d3.select("body").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 + ")");


		// start doing stuff with the data

		lines = [
			{
				label: 'Breakfast',
				points: [
					{
						x: 4,
						y: 10
					},
					{
						x: 6,
						y: 30
					}
				]
			}
		];

	  // var lines = color.domain().map(function(key) {
	  //   return {
	  //     key: key,
	  //     values: data[key]
	  //   };
	  // });

	  y.domain([
	    0,
	    d3.max(lines, function(l) { return d3.max(l.points, function(p) { return p.y; }); })
	  ]);

	  debugger;

	  svg.append("g")
	      .attr("class", "x axis")
	      .attr("transform", "translate(0," + height + ")")
	      .call(xAxis);

	  svg.append("g")
	      .attr("class", "y axis")
	      .call(yAxis)
	    .append("text")
	      .attr("transform", "rotate(-90)")
	      .attr("y", 6)
	      .attr("dy", ".71em")
	      .style("text-anchor", "end")
	      .text("Temperature (ºF)");

	  var city = svg.selectAll(".city")
	      .data(cities)
	    .enter().append("g")
	      .attr("class", "city");

{'fraction_non_alphanumeric': 0.19329246303642264, 'fraction_numerical': 0.02416155787955283, 'mean_word_length': 1.9647247461250668, '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': '5736371', 'n_tokens_mistral': 2672, 'n_tokens_neox': 2070, 'n_words': 449}