diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index f1a464f491..e80e0cb7a3 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -66,7 +66,7 @@ $(() => { } }, - series: [ { + series: [{ name: 'USD to EUR', data: someData, lineColor: "blue" diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index c1fd8b5676..2bb429ec7a 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -40,12 +40,12 @@ function originalTests() { renderTo: "container" }, xAxis: {}, - series: [ { + series: [{ 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], description: "foo", type: "line", allowPointSelect: true - }] + } as Highcharts.LineChartSeriesOptions] }); chart1.addSeries({ @@ -61,7 +61,7 @@ function originalTests() { height: 400, spacingRight: 20 }, - xAxis: [ { + xAxis: [{ description: 'x-foo', min: 1, max: 1000, @@ -71,7 +71,7 @@ function originalTests() { gridLineWidth: 1, type: 'logarithmic' }], - yAxis: [ { + yAxis: [{ description: 'y-foo', min: 1, max: 1000, @@ -85,7 +85,7 @@ function originalTests() { legend: { enabled: false }, - series: [ { + series: [{ 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], @@ -114,12 +114,12 @@ function originalTests() { renderTo: "container" }, xAxis: {}, - series: [ { + series: [{ data: [[1, 1, 2], [2, 2, 3], [3, 2, 3]], description: "foo", type: "columnrange", allowPointSelect: true - }] + } as Highcharts.ColumnRangeChartSeriesOptions] }); const chart4 = new Highcharts.Chart({ @@ -127,12 +127,12 @@ function originalTests() { renderTo: "container" }, xAxis: {}, - series: [ { + series: [{ data: [["01-01-2018", 1, 2], ["02-01-2018", 2, 3], ["03-01-2018", 2, 3]], description: "column range data", type: "columnrange", allowPointSelect: true - }] + } as Highcharts.ColumnRangeChartSeriesOptions] }); const div: HTMLDivElement = null as any; @@ -146,7 +146,7 @@ function originalTests() { }, xAxis: [{ }], - series: [ { + series: [{ 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] }] }; @@ -164,47 +164,47 @@ function originalTests() { const renderToIdChart = new Highcharts.Chart("container", { xAxis: {}, - series: [ { + series: [{ 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 - }] + } as Highcharts.LineChartSeriesOptions] }); const renderToElementChart = new Highcharts.Chart(div, { xAxis: {}, - series: [ { + series: [{ 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 - }] + } as Highcharts.LineChartSeriesOptions] }); const createWithFunction = Highcharts.chart({ xAxis: {}, - series: [ { + series: [{ 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 - }] + } as Highcharts.LineChartSeriesOptions] }); const createWithFunctionRenderToId = Highcharts.chart("container", { xAxis: {}, - series: [ { + series: [{ 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 - }] + } as Highcharts.LineChartSeriesOptions] }); const createWithFunctionRenderToElement = Highcharts.chart(div, { xAxis: {}, - series: [ { + series: [{ 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 - }] + } as Highcharts.LineChartSeriesOptions] }); } @@ -245,7 +245,7 @@ function test_ChartOptions() { duration: 500, easing: "linear" }, - backgroundColor: { + backgroundColor: { linearGradient: { x1: 0, y1: 0, @@ -261,7 +261,7 @@ function test_ChartOptions() { colorCount: 42, defaultSeriesType: "deprecated", description: "an arbitrary description", - events: { + events: { addSeries: () => { }, afterPrint: () => { }, beforePrint: () => { }, @@ -281,21 +281,21 @@ function test_ChartOptions() { marginLeft: 10, marginRight: 10, marginTop: 10, - options3d: { + options3d: { alpha: 20, beta: 20, depth: 50, enabled: true, frame: { - back: { + back: { color: "black", size: 2 }, - bottom: { + bottom: { color: "black", size: 2 }, - side: { + side: { color: "black", size: 2 } @@ -309,7 +309,7 @@ function test_ChartOptions() { plotBackgroundImage: "http://image.url/image.jpg", plotBorderColor: "grey", plotBorderWidth: 5, - plotShadow: { + plotShadow: { color: "magenta", offsetX: 10, offsetY: 10, @@ -319,15 +319,15 @@ function test_ChartOptions() { polar: true, reflow: false, renderTo: "elementId", - resetZoomButton: { - position: { + resetZoomButton: { + position: { align: "left", verticalAlign: "top", x: 5, y: 5 }, relativeTo: "chart", - theme: { + theme: { display: "hidden", fill: "black", stroke: "white", @@ -394,7 +394,7 @@ function test_ChartOptions() { }); // animation example - $('#container').highcharts( { + $('#container').highcharts({ chart: { animation: { duration: 1500, @@ -479,7 +479,7 @@ function test_ChartOptions() { chart: { events: { addSeries() { - const label = ( this).renderer.label('A series was added, about to redraw chart', 100, 120) + const label = (this as Highcharts.ChartObject).renderer.label('A series was added, about to redraw chart', 100, 120) .attr({ fill: Highcharts.getOptions().colors[0], padding: 10, @@ -729,21 +729,21 @@ function test_Data() { } }, series: [ - { + { lineWidth: 1 }, - { + { type: 'areaspline', color: '#c4392d', negativeColor: '#5679c4', fillOpacity: 0.5 - } + } as Highcharts.AreaSplineChartSeriesOptions ] }); // limited data example $('#container').highcharts({ - data: { + data: { csv: document.getElementById('csv').innerHTML, startRow: 114, endRow: 134, @@ -753,7 +753,7 @@ function test_Data() { xAxis: { allowDecimals: false }, - series: [ { + series: [{ name: 'Annual mean' }] }); @@ -784,14 +784,14 @@ function test_Drilldown() { type: 'category' }, plotOptions: { - series: { + series: { borderWidth: 0, dataLabels: { enabled: true } - } + } as Highcharts.ColumnChart }, - series: [ { + series: [{ name: '2010', data: [{ name: 'Republican', @@ -806,7 +806,7 @@ function test_Drilldown() { y: 4, drilldown: 'other-2010' }] - }, { + }, { name: '2014', data: [{ name: 'Republican', @@ -823,7 +823,7 @@ function test_Drilldown() { }] }], drilldown: { - series: [ { + series: [{ id: 'republican-2010', data: [ ['East', 4], @@ -831,7 +831,7 @@ function test_Drilldown() { ['North', 1], ['South', 4] ] - }, { + }, { id: 'democrats-2010', data: [ ['East', 6], @@ -839,7 +839,7 @@ function test_Drilldown() { ['North', 2], ['South', 4] ] - }, { + }, { id: 'other-2010', data: [ ['East', 2], @@ -847,7 +847,7 @@ function test_Drilldown() { ['North', 3], ['South', 2] ] - }, { + }, { id: 'republican-2014', data: [ ['East', 2], @@ -855,7 +855,7 @@ function test_Drilldown() { ['North', 1], ['South', 7] ] - }, { + }, { id: 'democrats-2014', data: [ ['East', 4], @@ -863,7 +863,7 @@ function test_Drilldown() { ['North', 5], ['South', 3] ] - }, { + }, { id: 'other-2014', data: [ ['East', 7], @@ -881,14 +881,14 @@ function test_Drilldown() { type: 'column' }, plotOptions: { - series: { + series: { borderWidth: 0, dataLabels: { enabled: true } - } + } as Highcharts.ColumnChart }, - series: [ { + series: [{ name: 'Things', colorByPoint: true, data: [{ @@ -903,7 +903,7 @@ function test_Drilldown() { name: 'Cars', y: 4 }] - }], + } as Highcharts.ColumnChartSeriesOptions], drilldown: { activeAxisLabelStyle: { textDecoration: 'none', @@ -976,7 +976,7 @@ function test_Exporting() { series: [{ 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] }], - exporting: { + exporting: { error: () => { console.log('succesfully asserted exporting.error'); }, @@ -987,7 +987,7 @@ function test_Exporting() { chartOptions: { subtitle: null } - } + } as Highcharts.ExportingOptions }); } @@ -1113,12 +1113,12 @@ function test_AreaOptions() { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { - series: { + series: { fillColor: { linearGradient: [0, 0, 0, 300], stops: [ [0, Highcharts.getOptions().colors[0]], - [1, ( Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')] + [1, ((Highcharts.Color(Highcharts.getOptions().colors[0])) as Highcharts.Gradient).setOpacity(0).get('rgba')] ] }, fillOpacity: 0.1, @@ -1129,7 +1129,7 @@ function test_AreaOptions() { threshold: 100, trackByArea: true, stickyTracking: false // to show the difference in tracking - } + } as Highcharts.AreaChartSeriesOptions }, series: [{ 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] @@ -1146,7 +1146,7 @@ function test_AreaRange() { type: "arearange", zoomType: 'x' }, - series: [ { + series: [{ data: (((arr: number[], len: number) => { for (let i = 0; i < len; i = i + 1) { arr.push(i); @@ -1191,7 +1191,7 @@ function test_AreaRange() { legend: { enabled: false }, - series: [ { + series: [{ name: 'Temperatures', data, dataLabels: { @@ -1199,7 +1199,7 @@ function test_AreaRange() { yHigh: 20, yLow: -20 } - }] + } as Highcharts.AreaRangeChartSeriesOptions] }); }); } @@ -1215,7 +1215,7 @@ function test_Bar() { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { - series: { + series: { borderColor: '#303030', borderRadius: 5, borderWidth: 2, @@ -1240,7 +1240,7 @@ function test_Bar() { } } } - } + } as Highcharts.BarChartSeriesOptions }, series: [{ 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] @@ -1274,7 +1274,7 @@ function test_Bar() { // grouping example Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, (color: string) => { - return ( Highcharts.Color(color)) + return (Highcharts.Color(color) as Highcharts.Gradient) .setOpacity(0.5) .get('rgba'); }); @@ -1309,19 +1309,19 @@ function test_Bar() { shadow: false } }, - series: [ { + series: [{ 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 - }, { + } as 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 - }, { + }, { 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 - }, { + }, { 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 @@ -1407,7 +1407,7 @@ function test_Bubble() { maxSize: 50 } }, - series: [ { + series: [{ data: [ [9, 81, 13], [98, 5, 39], @@ -1430,7 +1430,7 @@ function test_Bubble() { zMin: 0, zMax: 100, zThreshold: 0 - }] + } as Highcharts.BubbleChartSeriesOptions] }); // size by absolute value example @@ -1444,7 +1444,7 @@ function test_Bubble() { subtitle: { text: 'Size is computed by absolute value on negative bubbles' }, - series: [ { + series: [{ data: [ [-5, 0, -5], [-4, 0, -4], @@ -1460,7 +1460,7 @@ function test_Bubble() { ], sizeByAbsoluteValues: true, negativeColor: '#FF0000' - }] + } as Highcharts.BubbleChartSeriesOptions] }); } @@ -1479,7 +1479,7 @@ function test_ColumnCrispFalse() { } return arr; }; - const chart = new Highcharts.Chart( { + const chart = new Highcharts.Chart({ title: { text: 'Crisp columns are disabled' }, @@ -1527,7 +1527,7 @@ function test_ErrorBar() { tooltip: { shared: true }, - series: [ { + series: [{ 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], @@ -1537,7 +1537,7 @@ function test_ErrorBar() { tooltip: { pointFormat: ' {series.name} : {point.y:.1f}°C
' } - }, { + } as Highcharts.SplineChartSeriesOptions, { color: '#FF0000', name: 'Temperature error', type: 'errorbar', @@ -1549,7 +1549,7 @@ function test_ErrorBar() { stemDashStyle: "Solid", stemWidth: 3, whiskerLength: 0 - }] + } as Highcharts.ErrorBarChartSeriesOptions] }); } @@ -1568,7 +1568,7 @@ function test_FindNearestPointBy() { } }, - series: [ { + series: [{ findNearestPointBy: 'x', // Hover at [3.5, 6] to demo x-dimension search // Compare to Series 2 behavior at [5.5, 3] @@ -1584,7 +1584,7 @@ function test_FindNearestPointBy() { [6, 6], [7, 6] ] - }, { + } as Highcharts.IndividualSeriesOptions, { findNearestPointBy: 'xy', // Hover at [1, 4] to demo xy-dimension search. // Useful when having multiple points on the same x-value. @@ -1600,7 +1600,7 @@ function test_FindNearestPointBy() { [6, 3], [7, 3] ] - }] + } as Highcharts.IndividualSeriesOptions] }); } @@ -1618,7 +1618,7 @@ function test_Funnel() { x: -50 }, plotOptions: { - series: { + series: { dataLabels: { enabled: true, format: ' {point.name} ({point.y:,.0f})', @@ -1630,7 +1630,7 @@ function test_Funnel() { reversed: false, height: "10%", width: 100 - } + } as Highcharts.FunnelChartSeriesOptions }, legend: { enabled: false @@ -1701,10 +1701,10 @@ function test_Gauge() { } } }, - series: [ { + series: [{ data: [80], overshoot: 5 - }] + } as Highcharts.GaugeChartSeriesOptions] }); } @@ -1757,14 +1757,14 @@ function test_HeatMap() { ], min: -5 }, - series: [ { + series: [{ borderWidth: 0, colsize: 24 * 36e5, // one day tooltip: { headerFormat: 'Temperature
', pointFormat: '{point.x:%e %b, %Y} {point.y}:00: {point.value} ℃ ' } - }] + } as Highcharts.HeatMapSeriesOptions] }); } @@ -1779,17 +1779,17 @@ function test_Line() { xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, - series: [ { + series: [{ data: [1, 2, 3, 4, null, 6, 7, null, 9], step: 'right', name: 'Right', linecap: 'round' - }, { + } as Highcharts.LineChartSeriesOptions, { data: [5, 6, 7, 8, null, 10, 11, null, 13], step: 'center', name: 'Center', linecap: 'round' - }, { + }, { data: [9, 10, 11, 12, null, 14, 15, null, 17], step: 'left', name: 'Left', @@ -1829,7 +1829,7 @@ function test_Pie() { } } }, - series: [ { + series: [{ name: "Brands", colorByPoint: true, data: [{ @@ -1853,7 +1853,7 @@ function test_Pie() { name: "Proprietary or Undetectable", y: 0.2 }] - }] + } as Highcharts.PieChartSeriesOptions] }); // semi circle @@ -1888,7 +1888,7 @@ function test_Pie() { center: ['50%', '75%'] } }, - series: [ { + series: [{ type: 'pie', name: 'Browser share', innerSize: '50%', @@ -2161,10 +2161,10 @@ function test_Waterfall() { } function test_AccessibilityOptions() { - const accessibilityOptions: Highcharts.AccessibilityOptions = { + const accessibilityOptions: Highcharts.AccessibilityOptions = { describeSingleSeries: true, enabled: true, - keyboardNavigation: { + keyboardNavigation: { enabled: true, skipNullPoints: true }, @@ -2177,7 +2177,7 @@ function test_AccessibilityOptions() { seriesDescriptionFormatter: () => { } }; - const chart = new Highcharts.Chart( { + const chart = new Highcharts.Chart({ accessibility: accessibilityOptions }); } @@ -2435,31 +2435,31 @@ function test_AxisObject() { axis.toPixels(10, true); axis.toValue(10); axis.toValue(10, true); - axis.update( {}); - axis.update( {}, true); + axis.update({}); + axis.update({}, true); } function test_ChartObject() { const chart = $("#container").highcharts(); - chart.addAxis( {}); - chart.addAxis( {}, true); - chart.addAxis( {}, true, false); - chart.addAxis( {}, true, true, false); - chart.addAxis( {}, true, true, { duration: 50 }); - chart.addSeries( {}); - chart.addSeries( {}, false); - chart.addSeries( {}, false, false); - chart.addSeries( {}, false, { duration: 50 }); - chart.addSeriesAsDrilldown( {}, {}); + chart.addAxis({}); + chart.addAxis({}, true); + chart.addAxis({}, true, false); + chart.addAxis({}, true, true, false); + chart.addAxis({}, true, true, { duration: 50 }); + chart.addSeries({}); + chart.addSeries({}, false); + chart.addSeries({}, false, false); + chart.addSeries({}, false, { duration: 50 }); + chart.addSeriesAsDrilldown({}, {}); const container = chart.container; console.log(container.id); chart.destroy(); chart.drillUp(); - chart.exportChart( {}, {}); - chart.exportChartLocal( {}, {}); + chart.exportChart({}, {}); + chart.exportChartLocal({}, {}); const object = chart.get('axisIdOrSeriesIdOrPointId'); const svg1 = chart.getSVG(); - const svg2 = chart.getSVG( {}); + const svg2 = chart.getSVG({}); const selectedPoints = chart.getSelectedPoints(); const selectedSeries = chart.getSelectedSeries(); chart.hideLoading(); @@ -2480,11 +2480,11 @@ function test_ChartObject() { const firstXAxis = chart.xAxis[0]; const firstYAxis = chart.yAxis[0]; const legend = chart.legend; - chart.update( {}); - chart.update( {}, true); - chart.update( {}, true, true); - chart.update( {}, true, true, true); - chart.update( {}, true, true, { + chart.update({}); + chart.update({}, true); + chart.update({}, true, true); + chart.update({}, true, true, true); + chart.update({}, true, true, { duration: 3000, }); } @@ -2564,7 +2564,7 @@ function test_NumericSymbolMagnitude() { } function test_PaneBackground() { - const pane = { + const pane = { backgroundColor: 'blue', borderColor: 'white', borderWidth: 5, @@ -2576,7 +2576,7 @@ function test_PaneBackground() { } function test_PointObject() { - const point = $('#container').highcharts().get('point1'); + const point = $('#container').highcharts().get('point1') as Highcharts.PointObject; const category = point.category; const percentage = point.percentage; point.index; @@ -2608,7 +2608,7 @@ function test_RendererObject() { const renderer = $('#container').highcharts().renderer; renderer.arc(0, 0, 20, 10, 0, Math.PI); renderer.circle(0, 0, 100); - renderer.definition( {}); + renderer.definition({}); renderer.g('groupName'); renderer.image('http://source', 20, 20, 100, 100); renderer.label('Label', 200, 100, 'rect', 0, 0, false, false, 'class'); @@ -2618,15 +2618,15 @@ function test_RendererObject() { } function test_ResponsiveOptions() { - const responsiveOptions: Highcharts.ResponsiveOptions = { + const responsiveOptions: Highcharts.ResponsiveOptions = { rules: [ - { - chartOptions: { + { + chartOptions: { chart: { description: 'just a test' } }, - condition: { + condition: { callback: () => { }, maxHeight: 420, maxWidth: 420, @@ -2643,7 +2643,7 @@ function test_ResponsiveOptions() { } function test_SeriesObject() { - const series = $('#container').highcharts().get('series1'); + const series = $('#container').highcharts().get('series1') as Highcharts.SeriesObject; series.addPoint(0); series.addPoint([0, 0]); series.addPoint({});