Merge pull request #12452 from DefinitelyTyped/highcharts

Convert highcharts definitions to module style
This commit is contained in:
jramsay
2016-11-03 17:19:43 -07:00
committed by GitHub
16 changed files with 228 additions and 230 deletions
+36 -34
View File
@@ -3,41 +3,43 @@
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="highcharts" />
import { ChartObject, IndividualSeriesOptions, Options } from "highcharts";
interface HighChartsNGConfig {
options: __Highcharts.Options;
//The below properties are watched separately for changes.
declare global {
interface HighChartsNGConfig {
options: Options;
//The below properties are watched separately for changes.
//Series object (optional) - a list of series using normal highcharts series options.
series?: __Highcharts.IndividualSeriesOptions[];
//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 | string;
//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: __Highcharts.ChartObject) => void;
}
//Series object (optional) - a list of series using normal highcharts series options.
series?: IndividualSeriesOptions[];
//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 | string;
//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: ChartObject) => void;
}
//Instantiated Chart
interface HighChartsNGChart extends HighChartsNGConfig {
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
getHighcharts(): __Highcharts.ChartObject;
//Instantiated Chart
interface HighChartsNGChart extends HighChartsNGConfig {
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
getHighcharts(): ChartObject;
}
}
+1
View File
@@ -0,0 +1 @@
HighchartsMore(Highcharts);
+3 -7
View File
@@ -3,10 +3,6 @@
// Definitions by: Maciej Suchecki <http://github.com/mc-suchecki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
declare var HighchartsMore: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/highcharts-more" {
export = HighchartsMore;
}
declare var HighchartsMore: (H: Highcharts.Static) => Highcharts.Static;
export = HighchartsMore;
export as namespace HighchartsMore;
+116 -116
View File
@@ -1,5 +1,5 @@
/// <reference types="jquery" />
import * as Highcharts from "highcharts"; // May also use /// <reference types="highcharts" />
function originalTests() {
Highcharts.setOptions({
@@ -16,13 +16,13 @@ function originalTests() {
});
var animate: __Highcharts.Animation = {
var animate: Highcharts.Animation = {
duration: 200,
easing: "linear"
};
var gradient: __Highcharts.Gradient = {
var gradient: Highcharts.Gradient = {
linearGradient: {
x1: 0,
y1: 0,
@@ -42,19 +42,19 @@ function originalTests() {
renderTo: "container"
},
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
});
chart1.addSeries<__Highcharts.BarChartSeriesOptions>({
chart1.addSeries<Highcharts.BarChartSeriesOptions>({
enableMouseTracking: true,
data: [1, 2, 3, 4, 5]
});
console.log((<__Highcharts.LineChartSeriesOptions>chart1.series[0].options).dashStyle);
console.log((<Highcharts.LineChartSeriesOptions>chart1.series[0].options).dashStyle);
var chart2 = new Highcharts.Chart({
chart: {
@@ -85,7 +85,7 @@ function originalTests() {
legend: {
enabled: false
},
series: [<__Highcharts.ScatterChartSeriesOptions>{
series: [<Highcharts.ScatterChartSeriesOptions>{
data: [
[550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144],
[581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730],
@@ -113,14 +113,14 @@ function originalTests() {
var r = new Highcharts.Renderer(div, 20, 30);
var box = r.text("Hello", 10, 10).getBBox();
var highChartSettings: __Highcharts.Options = {
var highChartSettings: Highcharts.Options = {
chart: {
width: 400,
height: 400
},
xAxis: [{
}],
series: [<__Highcharts.PieChartSeriesOptions>{
series: [<Highcharts.PieChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
};
@@ -129,16 +129,16 @@ function originalTests() {
chart.series[0].setVisible(true, true);
});
var singleYAxisOptions: __Highcharts.Options = {
var singleYAxisOptions: Highcharts.Options = {
yAxis: {}
};
var multipleYAxisOptions: __Highcharts.Options = {
var multipleYAxisOptions: Highcharts.Options = {
yAxis: [{}, {}]
};
var renderToIdChart = new Highcharts.Chart("container", {
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
@@ -147,7 +147,7 @@ function originalTests() {
var renderToElementChart = new Highcharts.Chart(div, {
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
@@ -156,7 +156,7 @@ function originalTests() {
var createWithFunction = Highcharts.chart({
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
@@ -165,7 +165,7 @@ function originalTests() {
var createWithFunctionRenderToId = Highcharts.chart("container", {
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
@@ -174,7 +174,7 @@ function originalTests() {
var createWithFunctionRenderToElement = Highcharts.chart(div, {
xAxis: {},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
@@ -183,7 +183,7 @@ function originalTests() {
}
function test_alldefaults() {
var options: __Highcharts.Options = {
var options: Highcharts.Options = {
chart: {},
credits: {},
data: {},
@@ -207,19 +207,19 @@ function test_alldefaults() {
}
function test_ChartOptions() {
var emptyChartOptions: __Highcharts.ChartOptions = {
var emptyChartOptions: Highcharts.ChartOptions = {
events: {},
options3d: {},
resetZoomButton: {}
};
var allValuesSet: __Highcharts.ChartOptions = {
var allValuesSet: Highcharts.ChartOptions = {
alignTicks: false,
animation: {
duration: 500,
easing: "linear"
},
backgroundColor: <__Highcharts.Gradient> {
backgroundColor: <Highcharts.Gradient> {
linearGradient: {
x1: 0,
y1: 0,
@@ -233,7 +233,7 @@ function test_ChartOptions() {
borderWidth: 5,
className: "class",
defaultSeriesType: "deprecated",
events: <__Highcharts.ChartEvents> {
events: <Highcharts.ChartEvents> {
addSeries: () => {},
afterPrint: () => {},
beforePrint: () => {},
@@ -252,21 +252,21 @@ function test_ChartOptions() {
marginLeft: 10,
marginRight: 10,
marginTop: 10,
options3d: <__Highcharts.ChartOptions3d> {
options3d: <Highcharts.ChartOptions3d> {
alpha: 20,
beta: 20,
depth: 50,
enabled: true,
frame: {
back: <__Highcharts.ChartOptions3dFrame> {
back: <Highcharts.ChartOptions3dFrame> {
color: "black",
size: 2
},
bottom: <__Highcharts.ChartOptions3dFrame> {
bottom: <Highcharts.ChartOptions3dFrame> {
color: "black",
size: 2
},
side: <__Highcharts.ChartOptions3dFrame> {
side: <Highcharts.ChartOptions3dFrame> {
color: "black",
size: 2
}
@@ -280,7 +280,7 @@ function test_ChartOptions() {
plotBackgroundImage: "http://image.url/image.jpg",
plotBorderColor: "grey",
plotBorderWidth: 5,
plotShadow: <__Highcharts.Shadow> {
plotShadow: <Highcharts.Shadow> {
color: "magenta",
offsetX: 10,
offsetY: 10,
@@ -290,15 +290,15 @@ function test_ChartOptions() {
polar: true,
reflow: false,
renderTo: "elementId",
resetZoomButton: <__Highcharts.ChartResetZoomButton> {
position: <__Highcharts.Position> {
resetZoomButton: <Highcharts.ChartResetZoomButton> {
position: <Highcharts.Position> {
align: "left",
verticalAlign: "top",
x: 5,
y: 5
},
relativeTo: "chart",
theme: <__Highcharts.ButtonTheme> {
theme: <Highcharts.ButtonTheme> {
display: "hidden",
fill: "black",
stroke: "white",
@@ -364,7 +364,7 @@ function test_ChartOptions() {
});
// animation example
$('#container').highcharts(<__Highcharts.Options> {
$('#container').highcharts(<Highcharts.Options> {
chart: {
animation: {
duration: 1500,
@@ -449,7 +449,7 @@ function test_ChartOptions() {
chart: {
events: {
addSeries: function () {
var label = (<__Highcharts.ChartObject>this).renderer.label('A series was added, about to redraw chart', 100, 120)
var label = (<Highcharts.ChartObject>this).renderer.label('A series was added, about to redraw chart', 100, 120)
.attr({
fill: Highcharts.getOptions().colors[0],
padding: 10,
@@ -578,7 +578,7 @@ function test_ChartOptions() {
}
function test_CreditsOptions() {
var allDefaults: __Highcharts.CreditsOptions = {};
var allDefaults: Highcharts.CreditsOptions = {};
// custom url and text example
$('#container').highcharts({
@@ -597,7 +597,7 @@ function test_CreditsOptions() {
function test_Data() {
// all defaults
var data: __Highcharts.DataOptions = {};
var data: Highcharts.DataOptions = {};
// data from table example
$('#container').highcharts({
@@ -631,10 +631,10 @@ function test_Data() {
}
},
series: [
<__Highcharts.LineChartSeriesOptions> {
<Highcharts.LineChartSeriesOptions> {
lineWidth: 1
},
<__Highcharts.AreaSplineChartSeriesOptions> {
<Highcharts.AreaSplineChartSeriesOptions> {
type: 'areaspline',
color: '#c4392d',
negativeColor: '#5679c4',
@@ -645,7 +645,7 @@ function test_Data() {
// limited data example
$('#container').highcharts({
data: <__Highcharts.DataOptions> {
data: <Highcharts.DataOptions> {
csv: document.getElementById('csv').innerHTML,
startRow: 114,
endRow: 134,
@@ -655,7 +655,7 @@ function test_Data() {
xAxis: {
allowDecimals: false
},
series: [<__Highcharts.LineChartSeriesOptions> {
series: [<Highcharts.LineChartSeriesOptions> {
name: 'Annual mean'
}]
});
@@ -675,7 +675,7 @@ function test_Data() {
}
function test_Drilldown() {
var allDefaults: __Highcharts.DrilldownOptions = {};
var allDefaults: Highcharts.DrilldownOptions = {};
// multiseries drilldown example
$('#container').highcharts({
@@ -686,14 +686,14 @@ function test_Drilldown() {
type: 'category'
},
plotOptions: {
series: <__Highcharts.ColumnChart> {
series: <Highcharts.ColumnChart> {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [<__Highcharts.ColumnChartSeriesOptions>{
series: [<Highcharts.ColumnChartSeriesOptions>{
name: '2010',
data: [{
name: 'Republican',
@@ -708,7 +708,7 @@ function test_Drilldown() {
y: 4,
drilldown: 'other-2010'
}]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
name: '2014',
data: [{
name: 'Republican',
@@ -725,7 +725,7 @@ function test_Drilldown() {
}]
}],
drilldown: {
series: [<__Highcharts.ColumnChartSeriesOptions>{
series: [<Highcharts.ColumnChartSeriesOptions>{
id: 'republican-2010',
data: [
['East', 4],
@@ -733,7 +733,7 @@ function test_Drilldown() {
['North', 1],
['South', 4]
]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
id: 'democrats-2010',
data: [
['East', 6],
@@ -741,7 +741,7 @@ function test_Drilldown() {
['North', 2],
['South', 4]
]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
id: 'other-2010',
data: [
['East', 2],
@@ -749,7 +749,7 @@ function test_Drilldown() {
['North', 3],
['South', 2]
]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
id: 'republican-2014',
data: [
['East', 2],
@@ -757,7 +757,7 @@ function test_Drilldown() {
['North', 1],
['South', 7]
]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
id: 'democrats-2014',
data: [
['East', 4],
@@ -765,7 +765,7 @@ function test_Drilldown() {
['North', 5],
['South', 3]
]
}, <__Highcharts.ColumnChartSeriesOptions>{
}, <Highcharts.ColumnChartSeriesOptions>{
id: 'other-2014',
data: [
['East', 7],
@@ -783,14 +783,14 @@ function test_Drilldown() {
type: 'column'
},
plotOptions: {
series: <__Highcharts.ColumnChart> {
series: <Highcharts.ColumnChart> {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [<__Highcharts.ColumnChartSeriesOptions>{
series: [<Highcharts.ColumnChartSeriesOptions>{
name: 'Things',
colorByPoint: true,
data: [{
@@ -858,7 +858,7 @@ function test_Drilldown() {
}
function test_Exporting() {
var allDefaults: __Highcharts.ExportingOptions = {};
var allDefaults: Highcharts.ExportingOptions = {};
// source size example
$('#container').highcharts({
@@ -890,13 +890,13 @@ function test_Exporting() {
}
function test_Loading() {
var allDefaults: __Highcharts.LoadingOptions = {};
var allDefaults: Highcharts.LoadingOptions = {};
// examples
// the button handler
var isLoading = false,
$button = $('#button'),
chart: __Highcharts.ChartObject;
chart: Highcharts.ChartObject;
$button.click(function () {
if (!isLoading) {
@@ -932,7 +932,7 @@ function test_Loading() {
}
function test_Navigation() {
var allDefaults: __Highcharts.NavigationOptions = {};
var allDefaults: Highcharts.NavigationOptions = {};
// examples
$('#container').highcharts({
@@ -974,7 +974,7 @@ function test_Navigation() {
}
function test_NoData() {
var allDefaults: __Highcharts.NoDataOptions = {};
var allDefaults: Highcharts.NoDataOptions = {};
// example
$('#container').highcharts({
@@ -1000,7 +1000,7 @@ function test_NoData() {
}
function test_AreaOptions() {
var allDefaults: __Highcharts.AreaChartSeriesOptions = {};
var allDefaults: Highcharts.AreaChartSeriesOptions = {};
// examples
$('#container').highcharts({
@@ -1011,12 +1011,12 @@ function test_AreaOptions() {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: <__Highcharts.AreaChartSeriesOptions> {
series: <Highcharts.AreaChartSeriesOptions> {
fillColor: {
linearGradient: [0, 0, 0, 300],
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, (<__Highcharts.Gradient>Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')]
[1, (<Highcharts.Gradient>Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')]
]
},
fillOpacity: 0.1,
@@ -1036,7 +1036,7 @@ function test_AreaOptions() {
}
function test_AreaRange() {
var allDefaults: __Highcharts.AreaRangeChartSeriesOptions = {};
var allDefaults: Highcharts.AreaRangeChartSeriesOptions = {};
// example
$('#container').highcharts({
@@ -1044,7 +1044,7 @@ function test_AreaRange() {
type: "arearange",
zoomType: 'x'
},
series: [<__Highcharts.AreaRangeChartSeriesOptions>{
series: [<Highcharts.AreaRangeChartSeriesOptions>{
data: (function (arr: number[], len: number) {
var i: number;
for (i = 0; i < len; i = i + 1) {
@@ -1090,7 +1090,7 @@ function test_AreaRange() {
legend: {
enabled: false
},
series: [<__Highcharts.AreaRangeChartSeriesOptions> {
series: [<Highcharts.AreaRangeChartSeriesOptions> {
name: 'Temperatures',
data: data,
dataLabels: {
@@ -1105,7 +1105,7 @@ function test_AreaRange() {
}
function test_Bar() {
var allDefaults: __Highcharts.BarChartSeriesOptions = {};
var allDefaults: Highcharts.BarChartSeriesOptions = {};
$('#container').highcharts({
chart: {
@@ -1115,7 +1115,7 @@ function test_Bar() {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: <__Highcharts.BarChartSeriesOptions> {
series: <Highcharts.BarChartSeriesOptions> {
borderColor: '#303030',
borderRadius: 5,
borderWidth: 2,
@@ -1174,7 +1174,7 @@ function test_Bar() {
// grouping example
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function (color: string) {
return (<__Highcharts.Gradient>Highcharts.Color(color))
return (<Highcharts.Gradient>Highcharts.Color(color))
.setOpacity(0.5)
.get('rgba');
});
@@ -1209,19 +1209,19 @@ function test_Bar() {
shadow: false
}
},
series: [<__Highcharts.BarChartSeriesOptions> {
series: [<Highcharts.BarChartSeriesOptions> {
name: 'Tokyo',
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
pointPadding: 0
}, <__Highcharts.BarChartSeriesOptions> {
}, <Highcharts.BarChartSeriesOptions> {
name: 'New York',
data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3],
pointPadding: 0.1
}, <__Highcharts.BarChartSeriesOptions> {
}, <Highcharts.BarChartSeriesOptions> {
name: 'London',
data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2],
pointPadding: 0.2
}, <__Highcharts.BarChartSeriesOptions> {
}, <Highcharts.BarChartSeriesOptions> {
name: 'Berlin',
data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1],
pointPadding: 0.3
@@ -1230,7 +1230,7 @@ function test_Bar() {
}
function test_BoxPlot() {
var allDefaults: __Highcharts.BoxPlotChartSeriesOptions = {};
var allDefaults: Highcharts.BoxPlotChartSeriesOptions = {};
// boxplot example
$('#container').highcharts({
@@ -1282,7 +1282,7 @@ function test_BoxPlot() {
}
function test_Bubble() {
var allDefaults: __Highcharts.BubbleChartSeriesOptions = {};
var allDefaults: Highcharts.BubbleChartSeriesOptions = {};
// bubble example
$('#container').highcharts({
@@ -1307,7 +1307,7 @@ function test_Bubble() {
maxSize: 50
}
},
series: [<__Highcharts.BubbleChartSeriesOptions> {
series: [<Highcharts.BubbleChartSeriesOptions> {
data: [
[9, 81, 13],
[98, 5, 39],
@@ -1344,7 +1344,7 @@ function test_Bubble() {
subtitle: {
text: 'Size is computed by absolute value on negative bubbles'
},
series: [<__Highcharts.BubbleChartSeriesOptions>{
series: [<Highcharts.BubbleChartSeriesOptions>{
data: [
[-5, 0, -5],
[-4, 0, -4],
@@ -1365,19 +1365,19 @@ function test_Bubble() {
}
function test_Column() {
var allDefaults: __Highcharts.ColumnChartSeriesOptions = {};
var allDefaults: Highcharts.ColumnChartSeriesOptions = {};
// same options as bar chart
}
function test_ColumnRange() {
var allDefaults: __Highcharts.ColumnRangeChartSeriesOptions = {};
var allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {};
// same options as bar chart and datalabels from arearange
}
function test_ErrorBar() {
var allDefaults: __Highcharts.ErrorBarChartSeriesOptions = {};
var allDefaults: Highcharts.ErrorBarChartSeriesOptions = {};
// error bar styling example
$('#container').highcharts({
@@ -1401,7 +1401,7 @@ function test_ErrorBar() {
tooltip: {
shared: true
},
series: [<__Highcharts.SplineChartSeriesOptions>{
series: [<Highcharts.SplineChartSeriesOptions>{
name: 'Temperature',
type: 'spline',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
@@ -1411,7 +1411,7 @@ function test_ErrorBar() {
tooltip: {
pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f}°C</b><br/>'
}
}, <__Highcharts.ErrorBarChartSeriesOptions> {
}, <Highcharts.ErrorBarChartSeriesOptions> {
color: '#FF0000',
name: 'Temperature error',
type: 'errorbar',
@@ -1428,7 +1428,7 @@ function test_ErrorBar() {
}
function test_Funnel() {
var allDefaults: __Highcharts.FunnelChartSeriesOptions = {};
var allDefaults: Highcharts.FunnelChartSeriesOptions = {};
// funnel demo
$('#container').highcharts({
@@ -1441,7 +1441,7 @@ function test_Funnel() {
x: -50
},
plotOptions: {
series: <__Highcharts.FunnelChartSeriesOptions> {
series: <Highcharts.FunnelChartSeriesOptions> {
dataLabels: {
enabled: true,
format: '<b>{point.name}</b> ({point.y:,.0f})',
@@ -1472,7 +1472,7 @@ function test_Funnel() {
}
function test_Gauge() {
var allDefaults: __Highcharts.GaugeChartSeriesOptions = {};
var allDefaults: Highcharts.GaugeChartSeriesOptions = {};
// example
$('#container').highcharts({
@@ -1518,7 +1518,7 @@ function test_Gauge() {
}
}
},
series: [<__Highcharts.GaugeChartSeriesOptions> {
series: [<Highcharts.GaugeChartSeriesOptions> {
data: [80],
overshoot: 5
}]
@@ -1526,7 +1526,7 @@ function test_Gauge() {
}
function test_HeatMap() {
var allDefaults: __Highcharts.HeatMapSeriesOptions = {};
var allDefaults: Highcharts.HeatMapSeriesOptions = {};
// heatmap demo
$('#container').highcharts({
@@ -1574,7 +1574,7 @@ function test_HeatMap() {
],
min: -5
},
series: [<__Highcharts.HeatMapSeriesOptions> {
series: [<Highcharts.HeatMapSeriesOptions> {
borderWidth: 0,
colsize: 24 * 36e5, // one day
tooltip: {
@@ -1586,7 +1586,7 @@ function test_HeatMap() {
}
function test_Line() {
var allDefaults: __Highcharts.LineChartSeriesOptions = {};
var allDefaults: Highcharts.LineChartSeriesOptions = {};
// step example
$('#container').highcharts({
@@ -1596,17 +1596,17 @@ function test_Line() {
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [<__Highcharts.LineChartSeriesOptions>{
series: [<Highcharts.LineChartSeriesOptions>{
data: [1, 2, 3, 4, null, 6, 7, null, 9],
step: 'right',
name: 'Right',
linecap: 'round'
}, <__Highcharts.LineChartSeriesOptions>{
}, <Highcharts.LineChartSeriesOptions>{
data: [5, 6, 7, 8, null, 10, 11, null, 13],
step: 'center',
name: 'Center',
linecap: 'round'
}, <__Highcharts.LineChartSeriesOptions>{
}, <Highcharts.LineChartSeriesOptions>{
data: [9, 10, 11, 12, null, 14, 15, null, 17],
step: 'left',
name: 'Left',
@@ -1616,7 +1616,7 @@ function test_Line() {
}
function test_Pie() {
var allDefaults: __Highcharts.PieChartSeriesOptions = {};
var allDefaults: Highcharts.PieChartSeriesOptions = {};
// pie demo
$('#container').highcharts({
@@ -1646,7 +1646,7 @@ function test_Pie() {
}
}
},
series: [<__Highcharts.PieChartSeriesOptions>{
series: [<Highcharts.PieChartSeriesOptions>{
name: "Brands",
colorByPoint: true,
data: [{
@@ -1705,7 +1705,7 @@ function test_Pie() {
center: ['50%', '75%']
}
},
series: [<__Highcharts.PieChartSeriesOptions>{
series: [<Highcharts.PieChartSeriesOptions>{
type: 'pie',
name: 'Browser share',
innerSize: '50%',
@@ -1757,7 +1757,7 @@ function test_Pie() {
}
function test_Polygon() {
var allDefaults: __Highcharts.PolygonChartSeriesOptions = {};
var allDefaults: Highcharts.PolygonChartSeriesOptions = {};
$('#container').highcharts({
chart: {
@@ -1786,7 +1786,7 @@ function test_Polygon() {
}
function test_Pyramid() {
var allDefaults: __Highcharts.PyramidChartSeriesOptions = {};
var allDefaults: Highcharts.PyramidChartSeriesOptions = {};
// pyramid demo
$('#container').highcharts({
@@ -1825,10 +1825,10 @@ function test_Pyramid() {
}
function test_SolidGauge() {
var allDefaults: __Highcharts.SolidGaugeChartSeriesOptions = {};
var allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {};
// partial solid gauge demo
var gaugeOptions: __Highcharts.Options = {
var gaugeOptions: Highcharts.Options = {
chart: {
type: 'solidgauge'
},
@@ -1880,10 +1880,10 @@ function test_SolidGauge() {
}
function test_TreeMap() {
var allDefaults: __Highcharts.TreeMapChartSeriesOptions = {};
var allDefaults: Highcharts.TreeMapChartSeriesOptions = {};
// allowDrillToNode
var treeMap: __Highcharts.TreeMapChartSeriesOptions = {
var treeMap: Highcharts.TreeMapChartSeriesOptions = {
type: "treemap",
layoutAlgorithm: 'squarified',
allowDrillToNode: true,
@@ -1932,10 +1932,10 @@ function test_TreeMap() {
}
function test_Waterfall() {
var allDefaults: __Highcharts.WaterFallChartSeriesOptions = {};
var allDefaults: Highcharts.WaterFallChartSeriesOptions = {};
// partial waterfall demo
var series: __Highcharts.WaterFallChartSeriesOptions = {
var series: Highcharts.WaterFallChartSeriesOptions = {
upColor: Highcharts.getOptions().colors[2],
color: Highcharts.getOptions().colors[3],
data: [{
@@ -1978,9 +1978,9 @@ function test_Waterfall() {
}
function test_AxisOptions() {
var allDefaults: __Highcharts.AxisOptions = {};
var allDefaults: Highcharts.AxisOptions = {};
var axis: __Highcharts.AxisOptions = {
var axis: Highcharts.AxisOptions = {
allowDecimals: false,
alternateGridColor: '#000000',
breaks: [{
@@ -2168,31 +2168,31 @@ function test_AxisObject() {
axis.toPixels(10, true);
axis.toValue(10);
axis.toValue(10, true);
axis.update(<__Highcharts.AxisOptions>{});
axis.update(<__Highcharts.AxisOptions>{}, true);
axis.update(<Highcharts.AxisOptions>{});
axis.update(<Highcharts.AxisOptions>{}, true);
}
function test_ChartObject() {
var chart = $("#container").highcharts();
chart.addAxis(<__Highcharts.AxisOptions>{});
chart.addAxis(<__Highcharts.AxisOptions>{}, true);
chart.addAxis(<__Highcharts.AxisOptions>{}, true, false);
chart.addAxis(<__Highcharts.AxisOptions>{}, true, true, false);
chart.addAxis(<__Highcharts.AxisOptions>{}, true, true, {duration: 50});
chart.addSeries(<__Highcharts.IndividualSeriesOptions>{});
chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false);
chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false, false);
chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false, {duration: 50});
chart.addSeriesAsDrilldown(<__Highcharts.PointObject>{}, <__Highcharts.IndividualSeriesOptions>{});
chart.addAxis(<Highcharts.AxisOptions>{});
chart.addAxis(<Highcharts.AxisOptions>{}, true);
chart.addAxis(<Highcharts.AxisOptions>{}, true, false);
chart.addAxis(<Highcharts.AxisOptions>{}, true, true, false);
chart.addAxis(<Highcharts.AxisOptions>{}, true, true, {duration: 50});
chart.addSeries(<Highcharts.IndividualSeriesOptions>{});
chart.addSeries(<Highcharts.IndividualSeriesOptions>{}, false);
chart.addSeries(<Highcharts.IndividualSeriesOptions>{}, false, false);
chart.addSeries(<Highcharts.IndividualSeriesOptions>{}, false, {duration: 50});
chart.addSeriesAsDrilldown(<Highcharts.PointObject>{}, <Highcharts.IndividualSeriesOptions>{});
var container = chart.container;
console.log(container.id);
chart.destroy();
chart.drillUp();
chart.exportChart(<__Highcharts.ExportingOptions>{}, <__Highcharts.Options>{});
chart.exportChartLocal(<__Highcharts.ExportingOptions>{}, <__Highcharts.Options>{});
chart.exportChart(<Highcharts.ExportingOptions>{}, <Highcharts.Options>{});
chart.exportChartLocal(<Highcharts.ExportingOptions>{}, <Highcharts.Options>{});
var object = chart.get('axisIdOrSeriesIdOrPointId');
var svg1 = chart.getSVG();
var svg2 = chart.getSVG(<__Highcharts.Options>{});
var svg2 = chart.getSVG(<Highcharts.Options>{});
var selectedPoints = chart.getSelectedPoints();
var selectedSeries = chart.getSelectedSeries();
chart.hideLoading();
@@ -2257,7 +2257,7 @@ function test_ElementObject() {
}
function test_PointObject() {
var point = <__Highcharts.PointObject>$('#container').highcharts().get('point1');
var point = <Highcharts.PointObject>$('#container').highcharts().get('point1');
var category = point.category;
var percentage = point.percentage;
point.index;
@@ -2298,7 +2298,7 @@ function test_RendererObject() {
}
function test_SeriesObject() {
var series = <__Highcharts.SeriesObject>$('#container').highcharts().get('series1');
var series = <Highcharts.SeriesObject>$('#container').highcharts().get('series1');
series.addPoint(0);
series.addPoint([0, 0]);
series.addPoint({});
+2 -2
View File
@@ -1,5 +1,5 @@
/// <reference types="jquery" />
import * as Highcharts from "highcharts";
var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
@@ -55,7 +55,7 @@ $(function () {
}
},
series: [<__Highcharts.AreaRangeChartSeriesOptions>{
series: [<Highcharts.AreaRangeChartSeriesOptions>{
name: 'USD to EUR',
data: someData,
lineColor: "blue"
+13 -13
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace __Highstock {
interface ChartObject extends __Highcharts.ChartObject {
interface ChartObject extends Highcharts.ChartObject {
options: Options;
}
@@ -22,9 +22,9 @@ declare namespace __Highstock {
maskInside?: boolean;
outlineColor?: string;
outlineWidth?: number;
series?: __Highcharts.IndividualSeriesOptions;
xAxis?: __Highcharts.AxisOptions;
yAxis?: __Highcharts.AxisOptions;
series?: Highcharts.IndividualSeriesOptions;
xAxis?: Highcharts.AxisOptions;
yAxis?: Highcharts.AxisOptions;
}
interface RangeSelectorButton {
@@ -53,8 +53,8 @@ declare namespace __Highstock {
x?: number;
y?: number;
};
inputStyle?: __Highcharts.CSSObject;
labelStyle?: __Highcharts.CSSObject;
inputStyle?: Highcharts.CSSObject;
labelStyle?: Highcharts.CSSObject;
selected?: number;
}
@@ -79,7 +79,7 @@ declare namespace __Highstock {
trackBorderWidth?: number;
}
interface Options extends __Highcharts.Options {
interface Options extends Highcharts.Options {
navigator?: NavigatorOptions;
rangeSelector?: RangeSelectorOptions;
scrollbar?: ScrollbarOptions;
@@ -90,7 +90,7 @@ declare namespace __Highstock {
new (options: Options, callback: (chart: ChartObject) => void): ChartObject;
}
interface Static extends __Highcharts.Static {
interface Static extends Highcharts.Static {
StockChart: Chart;
}
}
@@ -101,21 +101,21 @@ interface JQuery {
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {__Highcharts.Options} options Options for this chart
* @param {Highcharts.Options} options Options for this chart
* @return current {JQuery} selector the current JQuery selector
**/
highcharts(type: "StockChart", options: __Highstock.Options): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {__Highcharts.Options} options Options for this chart
* @param {Highcharts.Options} 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: __Highstock.Options, callback: (chart: __Highstock.ChartObject) => void): JQuery;
highcharts(type: string): __Highcharts.ChartObject;
highcharts(type: string, options: __Highcharts.Options): JQuery;
highcharts(type: string, options: __Highcharts.Options, callback: (chart: __Highcharts.ChartObject) => void): JQuery;
highcharts(type: string): Highcharts.ChartObject;
highcharts(type: string, options: Highcharts.Options): JQuery;
highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
}
+27 -33
View File
@@ -3,7 +3,7 @@
// Definitions by: Damiano Gambarotto <http://github.com/damianog>, Dan Lewi Harkestad <http://github.com/baltie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace __Highcharts {
declare namespace Highcharts {
interface Position {
align?: string;
verticalAlign?: string;
@@ -2244,7 +2244,7 @@ declare namespace __Highcharts {
formAttributes?: any;
/**
* Path where Highcharts will look for export module dependencies to load on demand if they don't already exist on
* window. Should currently point to location of CanVG library (https://github.com/canvg/canvg) and RGBColor.js,
* window. Should currently point to location of CanVG library (https://github.com/canvg/canvg) and RGBColor.js,
* required for client side export in certain browsers.
* @default 'http://code.highcharts.com/{version}/lib'
* @since 5.0.0
@@ -2989,7 +2989,7 @@ declare namespace __Highcharts {
*/
padding?: number;
/**
* Whether to reserve space for the labels. This can be turned off when for example the labels are rendered inside
* Whether to reserve space for the labels. This can be turned off when for example the labels are rendered inside
* the plot area instead of outside.
* @default true
* @since 4.1.10
@@ -4952,8 +4952,8 @@ declare namespace __Highcharts {
}
/* You will rarely, if ever, want to use this interface directly. Instead it is much more useful to use one of the derived
* interfaces (AreaChartSeriesOptions, LineChartSeriesOptions, etc.)
*/
* interfaces (AreaChartSeriesOptions, LineChartSeriesOptions, etc.)
*/
interface IndividualSeriesOptions {
type?: string;
/**
@@ -6445,33 +6445,27 @@ declare namespace __Highcharts {
}
}
interface JQuery {
highcharts(): __Highcharts.ChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {Options} options Options for this chart
* @return current {JQuery} selector the current JQuery selector
**/
highcharts(options: __Highcharts.Options): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {Options} 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(options: __Highcharts.Options, callback: (chart: __Highcharts.ChartObject) => void): JQuery;
declare global {
interface JQuery {
highcharts(): Highcharts.ChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {Options} options Options for this chart
* @return current {JQuery} selector the current JQuery selector
**/
highcharts(options: Highcharts.Options): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param {Options} 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(options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
}
}
/**
* Enabling the usage of ES6 module loading.
*/
declare var Highcharts: __Highcharts.Static;
/**
* Declaration for ES6 module loading.
*/
declare module "highcharts" {
export = __Highcharts;
}
declare var Highcharts: Highcharts.Static;
export = Highcharts;
export as namespace Highcharts;
+1
View File
@@ -0,0 +1 @@
HighchartsBoost(Highcharts);
@@ -3,10 +3,8 @@
// Definitions by: Daniel Martin <http://github.com/inad9300>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
import { Static } from "highcharts";
declare var HighchartsBoost: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/modules/boost" {
export = HighchartsBoost;
}
declare var HighchartsBoost: (H: Static) => Static;
export = HighchartsBoost;
export as namespace HighchartsBoost;
+1
View File
@@ -0,0 +1 @@
HighchartsExporting(Highcharts);
@@ -3,10 +3,8 @@
// Definitions by: Maciej Suchecki <http://github.com/mc-suchecki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
import { Static } from "highcharts";
declare var HighchartsExporting: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/modules/exporting" {
export = HighchartsExporting;
}
declare var HighchartsExporting: (H: Static) => Static;
export = HighchartsExporting;
export as namespace HighchartsExporting;
@@ -1,7 +1,3 @@
/// <reference path="highcharts-modules-no-data-to-display.d.ts" />
/// <reference path="highcharts.d.ts" />
/// <reference types="jquery" />
function test_NoDataToDisplay() {
var chart = $("#container").highcharts();
var chartHasData = chart.hasData();
@@ -2,8 +2,10 @@
// Project: http://www.highcharts.com/
// Definitions by: Andrey Zolotin <http://github.com/nitoloz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
declare namespace __Highcharts {
import * as Hc from "highcharts";
declare module "highcharts" {
interface ChartObject {
/**
* Returns true if there are data points within the plot area now
@@ -0,0 +1 @@
HighchartsExporting(Highcharts);
@@ -3,10 +3,8 @@
// Definitions by: Daniel Martin <http://github.com/inad9300>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="highcharts.d.ts" />
import { Static } from "highcharts";
declare var HighchartsOfflineExporting: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/modules/offline-exporting" {
export = HighchartsOfflineExporting;
}
declare var HighchartsOfflineExporting: (H: Static) => Static;
export = HighchartsOfflineExporting;
export as namespace HighchartsOfflineExporting;
+11 -1
View File
@@ -14,8 +14,18 @@
},
"files": [
"index.d.ts",
"highstock.d.ts",
"highcharts-tests.ts",
"modules/boost.d.ts",
"modules/boost-tests.ts",
"modules/exporting.d.ts",
"modules/exporting-tests.ts",
"modules/no-data-to-display.d.ts",
"modules/no-data-to-display-tests.ts",
"modules/offline-exporting.d.ts",
"modules/offline-exporting-tests.ts",
"highcharts-more.d.ts",
"highcharts-more-tests.ts",
"highstock.d.ts",
"highstock-tests.ts"
]
}