Added definitions for highstock

This commit is contained in:
David Deutsch
2015-04-18 14:27:41 -04:00
parent bb62e74e97
commit cc9f049850
2 changed files with 184 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
/// <reference path="highstock.d.ts" />
var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
$(function () {
$('#container').highcharts('StockChart', {
chart: {
type: "arearange"
},
navigator: {
height: 80,
maskFill: 'rgba(255, 198, 220, 0.75)',
handles: {
backgroundColor: 'yellow',
borderColor: 'red'
}
},
rangeSelector: {
allButtonsEnabled: true,
selected: 1,
buttonTheme: { // styles for the buttons
fill: 'none',
stroke: 'none',
'stroke-width': 0,
r: 8,
style: {
color: '#039',
fontWeight: 'bold'
},
states: {
hover: {
},
select: {
fill: '#039',
style: {
color: 'white'
}
}
}
},
inputBoxBorderColor: 'gray',
inputBoxWidth: 120,
inputBoxHeight: 18,
inputStyle: {
color: '#039',
fontWeight: 'bold'
},
labelStyle: {
color: 'silver',
fontWeight: 'bold'
}
},
series: [<HighchartsAreaRangeChartSeriesOptions>{
name: 'USD to EUR',
data: someData,
lineColor: "blue"
}]
});
});
+120
View File
@@ -0,0 +1,120 @@
// Type definitions for Highstock 2.1.5
// Project: http://www.highcharts.com/
// Definitions by: David Deutsch <http://github.com/DavidKDeutsch>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
interface HighstockChartObject extends HighchartsChartObject {
options: HighstockOptions;
}
interface HighstockNavigatorOptions {
adaptToUpdatedData?: boolean;
baseSeries?: string | number;
enabled?: boolean;
handles?: {
backgoundColor?: string;
borderColor?: string;
};
height?: number;
margin?: number;
maskFill?: string;
maskInside?: boolean;
outlineColor?: string;
outlineWidth?: number;
series?: HighchartsIndividualSeriesOptions;
xAxis?: HighchartsAxisOptions;
yAxis?: HighchartsAxisOptions;
}
interface RangeSelectorButton {
type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
count: number;
text: string;
dataGrouping?: any; //not sure how this works
}
interface HighstockRangeSelectorOptions {
allButtonsEnabled?: boolean;
buttonSpacing?: number;
buttonTheme?: any;
buttons?: RangeSelectorButton[];
enabled?: boolean;
inputBoxBorderColor?: string;
inputBoxHeight?: number;
inputBoxWidth?: number;
inputDateFormat?: string;
inputDateParser?: (date: string) => number;
inputEditDateFormat?: string;
inputEnabled?: boolean;
inputPosition?: {
align?: string;
verticalAlign?: string;
x?: number;
y?: number;
};
inputStyle?: HighchartsCSSObject;
labelStyle?: HighchartsCSSObject;
selected?: number;
}
interface HighstockScrollbarOptions {
barBackgroundColor?: string;
barBorderColor?: string;
barBorderRadius?: number;
barBorderWidth?: number;
buttonArrowColor?: string;
buttonBackgroundColor?: string;
buttonBorderColor?: string;
buttonBorderRadius?: number;
buttonBorderWidth?: number;
enabled?: boolean;
height?: number;
liveRedraw?: boolean;
minWidth?: number;
rifleColor?: string;
trackBackgroundColor?: string;
trackBorderColor?: string;
trackBorderRadius?: number;
trackBorderWidth?: number;
}
interface HighstockOptions extends HighchartsOptions {
navigator?: HighstockNavigatorOptions;
rangeSelector?: HighstockRangeSelectorOptions;
scrollbar?: HighstockScrollbarOptions;
}
interface HighstockChart {
new (options: HighstockOptions): HighstockChartObject;
new (options: HighstockOptions, callback: (chart: HighstockChartObject) => void): HighstockChartObject;
}
interface HighchartsStatic {
StockChart: HighstockChart;
}
interface JQuery {
highcharts(type: "StockChart"): HighstockChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {HighchartsOptions} options Options for this chart
* @return current {JQuery} selector the current JQuery selector
**/
highcharts(type: "StockChart", options: HighstockOptions): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {HighchartsOptions} options Options for this chart
* @param callback Callback function used to manipulate the constructed chart instance
* @return current {JQuery} selector the current JQuery selector
**/
highcharts(type: "StockChart", options: HighstockOptions, callback: (chart: HighstockChartObject) => void): JQuery;
highcharts(type: string): HighchartsChartObject;
highcharts(type: string, options: HighchartsOptions): JQuery;
highcharts(type: string, options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void): JQuery;
}