l10n_server-2.x-dev/l10n_statistics/js/submissions.js

l10n_statistics/js/submissions.js
(function (Drupal, drupalSettings) {

  google.charts.load('current', {packages: ['corechart', 'bar']});
  google.charts.setOnLoadCallback(drawStacked);

  function drawStacked() {
    drupalSettings.l10nStatistics.submissions.years.forEach(function (value, index, arr) {
      let data = new google.visualization.DataTable();

      data.addColumn('string', 'Week');
      data.addColumn('number', 'Unknown');
      data.addColumn('number', 'Web');
      data.addColumn('number', 'Import');
      data.addColumn('number', 'Remote');

      let rows = drupalSettings.l10nStatistics.submissions.charts['year' + value];
      data.addRows(rows);

      let options = {
        title: 'Submissions ' + value,
        isStacked: true,
        hAxis: {
          title: 'Week of Year',
        },
        vAxis: {
          title: 'Submission count',
          minValue: 0,
        },
        legend: { position: 'bottom', alignment: 'start' },
        seriesType: 'bars',
      };

      let chart = new google.visualization.ColumnChart(
        document.getElementById('l10n-statistics-chart-' + value)
      );
      chart.draw(data, options);
    });
  }

} (Drupal, drupalSettings));

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc