Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angular2谷歌图表在typescript中指定列类型_Angular_Typescript_Charts - Fatal编程技术网

angular2谷歌图表在typescript中指定列类型

angular2谷歌图表在typescript中指定列类型,angular,typescript,charts,Angular,Typescript,Charts,我正试图从谷歌图表模块中获取时间线图表。这不是一个示例,这个特定的图表类型需要列的类型定义——这是所有示例都不需要的。我能找到的所有示例都是直接在JavaScript中设置类型。我不知道如何在TypeScript中指定列类型 错误是,“无效的数据表格式:列#1必须为'string'类型。” 这是JavaScript示例页面: 所有angular2谷歌图表示例都使用以下数据: public candle_ChartData = [ ['Day', 'Low', 'Opening v

我正试图从谷歌图表模块中获取时间线图表。这不是一个示例,这个特定的图表类型需要列的类型定义——这是所有示例都不需要的。我能找到的所有示例都是直接在JavaScript中设置类型。我不知道如何在TypeScript中指定列类型

错误是,“无效的数据表格式:列#1必须为'string'类型。”

这是JavaScript示例页面:

所有angular2谷歌图表示例都使用以下数据:

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]
    ];
我需要的是一种方法来指定
'Day'
应该是
'type:string,id:Day'

看起来这可能不受支持,我必须修改他们提供的指令来添加列输入。但很明显,如果不必要的话,我宁愿不花时间


所以我在输入问题后不久就找到了答案。在文件里,我只是没找对地方

以下是所需的格式:

public timeline_ChartData = [
    [ {label: 'President', id: 'President', type: 'string'}, 
      {label: 'Start', id: 'Start', type: 'date'},
      {label: 'End', id: 'End', type: 'date'}  ],
        [ 'Washington', new Date(1789, 3, 29), new Date(1797, 2, 3) ],
        [ 'Adams',      new Date(1797, 2, 3),  new Date(1801, 2, 3) ],
        [ 'Jefferson',  new Date(1801, 2, 3),  new Date(1809, 2, 3) ]
  ];
public timeline_ChartData = [
    [ {label: 'President', id: 'President', type: 'string'}, 
      {label: 'Start', id: 'Start', type: 'date'},
      {label: 'End', id: 'End', type: 'date'}  ],
        [ 'Washington', new Date(1789, 3, 29), new Date(1797, 2, 3) ],
        [ 'Adams',      new Date(1797, 2, 3),  new Date(1801, 2, 3) ],
        [ 'Jefferson',  new Date(1801, 2, 3),  new Date(1809, 2, 3) ]
  ];