I am currently attempting to implement the Timeline chart functionality from the angular2-google-chart module for Google Charts. Unlike the other examples provided, this specific chart type requires a column type definition — a requirement not present in the existing samples. Most of the available resources demonstrate setting the type directly in JavaScript, leaving me puzzled on how to specify the column type in TypeScript.
The error message I encounter is: "Invalid data table format: column #1 must be of type 'string'."
You can access the JavaScript example page here: https://developers.google.com/chart/interactive/docs/gallery/timeline
dataTable.addColumn({ type: 'string', id: 'President' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Washington', new Date(1789, 3, 30), new Date(1797, 2, 4) ],
[ 'Adams', new Date(1797, 2, 4), new Date(1801, 2, 4) ],
[ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]);
All the angular2-google-chart examples utilize data structured like this:
public candle_ChartData = [
['Day', 'Low', 'Opening value', 'Closing value', 'High'],
['Mon', 28, 28, 38, 38],
['Tue', 38, 38, 55, 55],
['Wed', 55, 55, 77, 77],
['Thu', 77, 77, 66, 66],
['Fri', 66, 66, 22, 22]
];
What I am seeking is a method to explicitly define that 'Day'
should have a 'type: string, id: Day'
specification.
It seems that this functionality may not be supported, prompting potential modification of the supplied directive to incorporate the necessary column input. Nonetheless, it would be preferable to avoid such adjustments unless absolutely necessary.