Диаграммы Google: множественный выбор на временной шкале - PullRequest
0 голосов
/ 25 мая 2020

Я использую angular -google-charts. Я создал график временной шкалы со следующим кодом:

public chartType = ChartType.Timeline;
  public columns = [
    { type: 'string', id: 'Row' },
    { type: 'string', id: 'Name' },
    { type: 'date', id: 'Start' },
    { type: 'date', id: 'End' }
  ];
  public data = [
    ['theoretical', 'file-h', new Date(1789, 8, 25), new Date(1790, 2, 22)],
    ['theoretical', 'file-a', new Date(1789, 3, 30), new Date(1797, 2, 4)],
    ['theoretical', 'file-d', new Date(1789, 3, 21), new Date(1797, 2, 4)],
    ['theoretical', 'file-b', new Date(1797, 2, 4), new Date(1801, 2, 4)],
    ['theoretical', 'file-c', new Date(1801, 2, 4), new Date(1809, 2, 4)],
    ['theoretical', 'file-e', new Date(1797, 2, 4), new Date(1801, 2, 4)],
    ['theoretical', 'file-f', new Date(1801, 2, 4), new Date(1805, 2, 4)],
    ['theoretical', 'file-g', new Date(1805, 2, 4), new Date(1812, 3, 20)],
    ['theoretical', 'file-i', new Date(1790, 2, 22), new Date(1793, 11, 31)],
    ['theoretical', 'file-j', new Date(1794, 0, 2), new Date(1795, 7, 20)],
    ['theoretical', 'file-k', new Date(1795, 7, 20), new Date(1800, 4, 12)],
    ['theoretical', 'file-l', new Date(1800, 4, 13), new Date(1800, 5, 5)],
    ['delays', 'file-m', new Date(1800, 5, 13), new Date(1801, 2, 4)],
    ['delays', 'file-n,', new Date(1801, 2, 5), new Date(1801, 4, 1)],
    ['delays', 'file-o', new Date(1800, 4, 2), new Date(1809, 2, 3)]
  ];
  public options = {
    colors: ['#cd0000', '#68a846'],
    timeline: { colorByRowLabel: true }
  };

И шаблон:

<google-chart [type]="chartType" height="500" [columns]="columns" [data]="data" [options]="options">
</google-chart>

В настоящее время одновременно можно выбрать только одну строку. Это ограничение временной шкалы: см. https://developers.google.com/chart/interactive/docs/gallery/timeline#methods =>

getSelection ()
Возвращает массив выбранных объектов диаграммы. Выбираемые объекты - столбцы, записи легенды и категории. Для этой диаграммы в любой момент можно выбрать только одну сущность.

Проблема в том, что необходимо выбрать несколько строк; каждую строку можно удалить, но пользователь должен иметь возможность выбрать несколько, чтобы упростить работу.

https://groups.google.com/forum/#! topic / google-visualization-api / h2kxAwxP8j8 не является надежным решением ( строки нельзя отменить). Есть ли способ сделать это правильно?

...