<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Highstock from 'highcharts/highstock';
import ReactHighcharts from 'react-highcharts';
import moment from 'moment';
import { Card, CardTitle, CardText } from 'material-ui/Card';

const Charts = ReactHighcharts.withHighcharts(Highstock);

class DashboardChart extends Component {

  componentWillMount() {
    this.config = this.buildConfig();
  }

  componentWillReceiveProps(newProps) {
    this.config = this.buildConfig(newProps);
  }

  buildConfig(props) {
    const fechasLength = props && props.fechas ? props.fechas.length :
      (this.props && this.props.fechas ? this.props.fechas.length : 0);
    const fechas = props ? props.fechas : this.props.fechas;
    return {
      chart: {
        marginRight: 130,
        marginBottom: 40,
      },
      title: {
        text: '',
        x: -20, // center
      },
      xAxis: {
        type: 'datetime',
        categories: fechas ? fechas.map(fecha => moment(fecha)) : [],
        tickInterval: 6,
        labels: {
          enabled: true,
          formatter() {
            if (this.value <= 0) {
              return '';
            }
            const date = moment(this.value);
            return `${date.date() < 10 ? '0' : ''}${date.date()}/${date.month() < 10 ? '0' : ''}${date.month() + 1
            } <br> ${date.hour() < 10 ? '0' : ''}${date.hour()}:${date.minute() < 10 ? '0' : ''}${date.minute()}`;
          },
        },
        min: fechasLength < 50 ? 0 : fechasLength - 50,
        max: fechasLength,
      },
      yAxis: {
        title: {
          text: '% de utilizacion',
        },
        plotLines: [{
          value: 0,
          width: 1,
          color: '#808080',
        }],
        min: 0,
        max: 100,
      },
      tooltip: {
        shared: true,
        valueSuffix: '%',
        crosshairs: true,
      },
      legend: {
        layout: 'vertical',<commit_msg>display dates correctly<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Highstock from 'highcharts/highstock';
import ReactHighcharts from 'react-highcharts';
import moment from 'moment';
import { Card, CardTitle, CardText } from 'material-ui/Card';

const Charts = ReactHighcharts.withHighcharts(Highstock);

class DashboardChart extends Component {

  componentWillMount() {
    this.config = this.buildConfig();
  }

  componentWillReceiveProps(newProps) {
    this.config = this.buildConfig(newProps);
  }

  buildConfig(props) {
    const datesLength = props && props.fechas ? props.fechas.length :
      (this.props && this.props.fechas ? this.props.fechas.length : 0);
    const dates = props ? props.fechas : this.props.fechas;
    return {
      chart: {
        marginRight: 130,
        marginBottom: 40,
      },
      title: {
        text: '',
        x: -20, // center
      },
      xAxis: {
        type: 'datetime',
        categories: dates ? dates.map(date => moment(date).format()) : [],
        tickInterval: 6,
        labels: {
          enabled: true,
          formatter() {
            if (this.value <= 0) {
              return '';
            }
            const date = moment(this.value);
            return `${date.date() < 10 ? '0' : ''}${date.date()}/${date.month() < 10 ? '0' : ''}${date.month() + 1
            } <br> ${date.hour() < 10 ? '0' : ''}${date.hour()}:${date.minute() < 10 ? '0' : ''}${date.minute()}`;
          },
        },
        min: datesLength < 50 ? 0 : datesLength - 50,
        max: datesLength,
      },
      yAxis: {
        title: {
          text: '% de utilizacion',
        },
        plotLines: [{
          value: 0,
          width: 1,
          color: '#808080',
        }],
        min: 0,
        max: 100,
      },
      tooltip: {
        shared: true,
        valueSuffix: '%',
        crosshairs: true,
      },
      legend: {
        layout: 'vertical',
{'fraction_non_alphanumeric': 0.15468354430379747, 'fraction_numerical': 0.020253164556962026, 'mean_word_length': 1.9573353293413174, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 7, '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': '1775187', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1216, 'n_words': 273}