<commit_before>import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { forkJoin } from 'rxjs';
import { finalize } from 'rxjs/operators';

import { humanReadableSize } from '../../units-utils';
import { defaultChartOptions, getChart, PulseChartComponent, tooltipLabel } from '../pulse-chart';

@Component({
  selector: 'cs-pulse-cpu-chart',
  templateUrl: '../pulse-chart.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PulseCpuRamChartComponent extends PulseChartComponent implements OnInit {
  public ngOnInit() {
    const unitTranslations = this.unitTranslations;
    const ramConverter = val => humanReadableSize(val * 1000, true, unitTranslations);

    this.charts = getChart([
      {
        id: 'cpu',
        options: {
          ...defaultChartOptions,
          scales: {
            ...defaultChartOptions.scales,
            yAxes: [
              {
                ticks: {
                  ...defaultChartOptions.scales.yAxes[0].ticks,
                  suggestedMax: 100,
                  userCallback(val) {
                    return `${val}%`;
                  },
                },
              },
            ],
          },
          tooltips: {
            ...defaultChartOptions.tooltips,
            callbacks: {
              label: (tooltipItem, data) => {
                return `${tooltipLabel(tooltipItem, data) + tooltipItem.yLabel}%`;
              },
            },
          },
        },
      },
      {
        id: 'ram',
        options: {
          ...defaultChartOptions,
          scales: {
            ...defaultChartOptions.scales,
            yAxes: [
              {
                ticks: {
                  ...defaultChartOptions.scales.yAxes[0].ticks,
                  userCallback(val) {
                    return ramConverter(val);
                  },
                },<commit_msg>fix(pulse-plugin): fixed lint error(#1617)<commit_after>import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { forkJoin } from 'rxjs';
import { finalize } from 'rxjs/operators';

import { humanReadableSize } from '../../units-utils';
import { defaultChartOptions, getChart, PulseChartComponent, tooltipLabel } from '../pulse-chart';

@Component({
  selector: 'cs-pulse-cpu-chart',
  templateUrl: '../pulse-chart.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PulseCpuRamChartComponent extends PulseChartComponent implements OnInit {
  public ngOnInit() {
    const unitTranslations = this.unitTranslations;
    const ramConverter = val => humanReadableSize(val * 1000, true, unitTranslations);

    this.charts = getChart([
      {
        id: 'cpu',
        options: {
          ...defaultChartOptions,
          scales: {
            ...defaultChartOptions.scales,
            yAxes: [
              {
                ticks: {
                  ...defaultChartOptions.scales.yAxes[0].ticks,
                  suggestedMax: 100,
                  userCallback(val) {
                    return `${val}%`;
                  },
                },
              },
            ],
          },
          tooltips: {
            ...defaultChartOptions.tooltips,
            callbacks: {
              label: (tooltipItem, data) => {
                return `${tooltipLabel(tooltipItem, data)}${tooltipItem.yLabel}%`;
              },
            },
          },
        },
      },
      {
        id: 'ram',
        options: {
          ...defaultChartOptions,
          scales: {
            ...defaultChartOptions.scales,
            yAxes: [
              {
                ticks: {
                  ...defaultChartOptions.scales.yAxes[0].ticks,
                  userCallback(val) {
                    return ramConverter(val);
                  },
                },
{'fraction_non_alphanumeric': 0.12006277792309704, 'fraction_numerical': 0.005754642950562386, 'mean_word_length': 1.527428949107733, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7662165', 'n_tokens_mistral': 1061, 'n_tokens_neox': 985, 'n_words': 180}