mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Merge remote-tracking branch 'upstream/master' into merge_7_25
This commit is contained in:
@@ -488,3 +488,25 @@ function test_formatter_PatternFormat() {
|
||||
|
||||
table.draw(view, { allowHtml: true, showRowNumber: true, width: '100%', height: '100%' });
|
||||
}
|
||||
|
||||
function test_ChartsLoad() {
|
||||
google.charts.load('current', {packages: ['corechart', 'table', 'sankey']});
|
||||
|
||||
function drawChart() {
|
||||
// Define the chart to be drawn.
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('string', 'Element');
|
||||
data.addColumn('number', 'Percentage');
|
||||
data.addRows([
|
||||
['Nitrogen', 0.78],
|
||||
['Oxygen', 0.21],
|
||||
['Other', 0.01]
|
||||
]);
|
||||
|
||||
// Instantiate and draw the chart.
|
||||
var chart = new google.visualization.PieChart(document.getElementById('myPieChart'));
|
||||
chart.draw(data, null);
|
||||
}
|
||||
|
||||
google.charts.setOnLoadCallback(drawChart);
|
||||
}
|
||||
|
||||
45
google.visualization/index.d.ts
vendored
45
google.visualization/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Google Visualisation Apis
|
||||
// Project: https://developers.google.com/chart/
|
||||
// Definitions by: Dan Ludwig <https://github.com/danludwig>
|
||||
// Definitions by: Dan Ludwig <https://github.com/danludwig>, Gregory Moore <https://github.com/gmoore-sjcorg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace google {
|
||||
@@ -9,6 +9,12 @@ declare namespace google {
|
||||
function setOnLoadCallback(handler: Function): void;
|
||||
function setOnLoadCallback(handler: () => void): void;
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/basic_load_libs
|
||||
namespace charts {
|
||||
function load(version: string, packages: Object): void;
|
||||
function setOnLoadCallback(handler: Function): void;
|
||||
}
|
||||
|
||||
//https://developers.google.com/chart/interactive/docs/reference
|
||||
namespace visualization {
|
||||
|
||||
@@ -141,6 +147,7 @@ declare namespace google {
|
||||
id?: string;
|
||||
role?: string;
|
||||
pattern?: string;
|
||||
p?: any;
|
||||
}
|
||||
|
||||
export interface DataObject {
|
||||
@@ -186,6 +193,42 @@ declare namespace google {
|
||||
|
||||
function arrayToDataTable(data: any[], firstRowIsData?: boolean): DataTable;
|
||||
|
||||
//#endregion
|
||||
//#region Query
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/reference#query
|
||||
export class Query {
|
||||
constructor(dataSourceUrl: string, options?: QueryOptions);
|
||||
|
||||
abort(): void;
|
||||
|
||||
setRefreshInterval(intervalSeconds: number): void;
|
||||
setTimeout(timeoutSeconds: number): void;
|
||||
setQuery(queryString:string): void;
|
||||
|
||||
send(callback: (response: QueryResponse) => void): void;
|
||||
}
|
||||
|
||||
export interface QueryOptions {
|
||||
sendMethod?: string,
|
||||
makeRequestParams?: Object
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region QueryResponse
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/reference#queryresponse
|
||||
export class QueryResponse {
|
||||
constructor(responseObject: Object);
|
||||
|
||||
getDataTable(): DataTable;
|
||||
getDetailedMessage(): string;
|
||||
getMessage(): string;
|
||||
getReasons(): string[];
|
||||
hasWarning(): boolean;
|
||||
isError(): boolean;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region DataView
|
||||
|
||||
|
||||
Reference in New Issue
Block a user