<commit_before>import FrontendYearFilterableChart from "../../oce/visualizations/charts/frontend-filterable";

class CancelledFunding extends FrontendYearFilterableChart{
  static getName(t){return t('charts:cancelledFunding:title')}

  getData(){
    let data = super.getData();
    if(!data) return [];
    let {traceColors, hoverFormatter} = this.props.styling.charts;
    let trace = {
      x: [],
      y: [],
      type: 'bar',
      marker: {
        color: traceColors[0]
      }
    };

    if(hoverFormatter){
      trace.text = [];
      trace.hoverinfo = "text";
    }

    data.forEach(datum => {
      let year = datum.get('year');
      let totalCancelledTendersAmount = datum.get('totalCancelledTendersAmount');
      trace.x.push(year);
      trace.y.push(totalCancelledTendersAmount);
      if(hoverFormatter) trace.text.push(hoverFormatter(totalCancelledTendersAmount));
    });

    return [trace];
  }


  getLayout(){
    return {
      xaxis: {
        title: this.t('charts:cancelledFunding:xAxisTitle'),
        type: 'category'
      },
      yaxis: {
        title: this.t('charts:cancelledFunding:yAxisTitle')
      }
    }
  }
}

CancelledFunding.endpoint = 'totalCancelledTendersByYearByRationale';
CancelledFunding.excelEP = 'cancelledTendersByYearByRationaleExcelChart';

export default CancelledFunding;<commit_msg>OCE-128 Monthly timeline for cancelled by reason chart<commit_after>import FrontendDateFilterableChart from "../../oce/visualizations/charts/frontend-date-filterable";

class CancelledFunding extends FrontendDateFilterableChart{
  static getName(t){return t('charts:cancelledFunding:title')}

  getData(){
    let data = super.getData();
    if(!data) return [];
    let {traceColors, hoverFormatter} = this.props.styling.charts;
    let trace = {
      x: [],
      y: [],
      type: 'bar',
      marker: {
        color: traceColors[0]
      }
    };

    if(hoverFormatter){
      trace.text = [];
      trace.hoverinfo = "text";
    }

    data.forEach(datum => {
      const date = datum.has('month') ? datum.get('month') : datum.get('year');
      let totalCancelledTendersAmount = datum.get('totalCancelledTendersAmount');
      trace.x.push(date);
      trace.y.push(totalCancelledTendersAmount);
      if(hoverFormatter) trace.text.push(hoverFormatter(totalCancelledTendersAmount));
    });

    return [trace];
  }


  getLayout(){
    return {
      xaxis: {
        title: this.props.monthly ? this.t('general:month') : this.t('general:year'),
        type: 'category'
      },
      yaxis: {
        title: this.t('charts:cancelledFunding:yAxisTitle')
      }
    }
  }
}

CancelledFunding.endpoint = 'totalCancelledTendersByYearByRationale';
CancelledFunding.excelEP = 'cancelledTendersByYearByRationaleExcelChart';

export default CancelledFunding;
{'fraction_non_alphanumeric': 0.13259864912904373, 'fraction_numerical': 0.0017774617845716318, 'mean_word_length': 3.2831050228310503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6194075', 'n_tokens_mistral': 937, 'n_tokens_neox': 894, 'n_words': 138}