Initial push for highcharts-ng definitions and tests.

This commit is contained in:
Scott Hatcher
2015-08-25 15:41:27 -07:00
parent 71a7d5306a
commit 1613bfdbda
2 changed files with 77 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="highcharts-ng.d.ts" />
/// <reference path="../angularjs/angular.d.ts" />
var app = angular.module('app', ['highcharts-ng']);
class AppController {
chartConfig: HighChartsNGConfig = {
options: {
chart: {
type: 'bar'
},
tooltip: {
style: {
padding: 10,
fontWeight: 'bold'
}
},
credits: {
enabled: false
},
plotOptions: {}
},
series: [{
data: [10, 15, 12, 8, 7]
}],
title: {
text: 'My Awesome Chart'
},
loading: true
};
constructor($timeout: ng.ITimeoutService) {
let vm = this;
$timeout(function() {
//Some async action
vm.chartConfig.loading = false;
});
}
}
app.controller("AppController", AppController);
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for highcharts-ng 0.0.8
// Project: https://github.com/pablojim/highcharts-ng
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../highcharts/highcharts.d.ts" />
interface HighChartsNGConfig {
options: HighchartsChartOptions;
//The below properties are watched separately for changes.
//Series object (optional) - a list of series using normal highcharts series options.
series?: number[]|[number, number][]| HighchartsDataPoint[];
//Title configuration (optional)
title?: {
text?: string;
};
//Boolean to control showng loading status on chart (optional)
//Could be a string if you want to show specific loading text.
loading?: boolean;
//Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled.
//properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum
xAxis?: {
currentMin?: number;
currentMax?: number;
title?: { text?: string }
},
//Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
useHighStocks?: boolean;
//size (optional) if left out the chart will default to size of the div or something sensible.
size?: {
width?: number;
height?: number;
};
//function (optional) - setup some logic for the chart
func?: (chart) => void;
}