<commit_before>import URI from "urijs";
import {Map} from "immutable";
import {pluckImm} from "../tools";
import CustomPopupChart from "./custom-popup-chart";
import Table from "../visualizations/tables/index";
import translatable from '../translatable';

class IndicatorTile extends CustomPopupChart{
  getCustomEP(){
    const {indicator} = this.props;
    return `flags/${indicator}/stats`;
  }

  getData(){
    const data = super.getData();
    if(!data) return [];
    const {monthly} = this.props;
    let dates = monthly ?
                  data.map(datum => {
                    const month = datum.get('month');
                    return this.t(`general:months:${month}`);
                  }).toJS() :
                  data.map(pluckImm('year')).toJS();

    let values = data.map(pluckImm('totalTrue')).toJS();

    //OCE-273, preventing the chart from showing only a dot
    if(dates.length == 1){
      dates.unshift("");
      dates.push(" ");
      values.unshift(0);
      values.push(0);
    }

    return [{
      x: dates,
      y: values,
      type: 'scatter',
      fill: 'tonexty'
    }];
  }

  getLayout(){<commit_msg>OCE-306 hoverinfo: 'none' for corruption type indicator tiles<commit_after>import URI from "urijs";
import {Map} from "immutable";
import {pluckImm} from "../tools";
import CustomPopupChart from "./custom-popup-chart";
import Table from "../visualizations/tables/index";
import translatable from '../translatable';

class IndicatorTile extends CustomPopupChart{
  getCustomEP(){
    const {indicator} = this.props;
    return `flags/${indicator}/stats`;
  }

  getData(){
    const data = super.getData();
    if(!data) return [];
    const {monthly} = this.props;
    let dates = monthly ?
                  data.map(datum => {
                    const month = datum.get('month');
                    return this.t(`general:months:${month}`);
                  }).toJS() :
                  data.map(pluckImm('year')).toJS();

    let values = data.map(pluckImm('totalTrue')).toJS();

    //OCE-273, preventing the chart from showing only a dot
    if(dates.length == 1){
      dates.unshift("");
      dates.push(" ");
      values.unshift(0);
      values.push(0);
    }

    return [{
      x: dates,
      y: values,
      hoverinfo: 'none',
      type: 'scatter',
      fill: 'tonexty'
    }];
  }

  getLayout(){
{'fraction_non_alphanumeric': 0.15716096324461343, 'fraction_numerical': 0.0063371356147021544, 'mean_word_length': 2.387696709585122, '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': '4218314', 'n_tokens_mistral': 743, 'n_tokens_neox': 720, 'n_words': 172}