highcharts: Provides its own types (#39599)

* highcharts: Provides its own types

* use @types/highcharts instead of highcharts
This commit is contained in:
Alexander T
2019-11-07 11:37:21 -08:00
committed by Nathan Shively-Sanders
parent 792e8dd0fe
commit f3a2beb1fd
34 changed files with 18 additions and 11073 deletions
+6
View File
@@ -1692,6 +1692,12 @@
"sourceRepoURL": "https://github.com/wKovacs64/hibp",
"asOfVersion": "7.3.0"
},
{
"libraryName": "highcharts",
"typingsPackageName": "highcharts",
"sourceRepoURL": "http://www.highcharts.com/",
"asOfVersion": "7.0.0"
},
{
"libraryName": "homeworks",
"typingsPackageName": "homeworks",
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"@types/highcharts": "^5.0.44"
}
}
-5
View File
@@ -1,5 +0,0 @@
import * as Highcharts from "highcharts";
declare function HighchartsMore(H: Highcharts.Static): Highcharts.Static;
export = HighchartsMore;
export as namespace HighchartsMore;
-152
View File
@@ -1,152 +0,0 @@
import * as Highcharts from "highcharts";
declare namespace Highstock {
interface ChartObject extends Highcharts.ChartObject {
options: Options;
}
interface NavigatorOptions {
adaptToUpdatedData?: boolean;
baseSeries?: string | number;
enabled?: boolean;
handles?: {
backgroundColor?: string;
borderColor?: string;
};
height?: number;
margin?: number;
maskFill?: string;
maskInside?: boolean;
outlineColor?: string;
outlineWidth?: number;
series?: Highcharts.IndividualSeriesOptions;
xAxis?: Highcharts.AxisOptions;
yAxis?: Highcharts.AxisOptions;
}
interface RangeSelectorButtonEvent {
click?(event: Event): void;
}
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
events?: RangeSelectorButtonEvent;
}
interface RangeSelectorOptions {
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?: Highcharts.CSSObject;
labelStyle?: Highcharts.CSSObject;
selected?: number;
}
interface ScrollbarOptions {
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 AxisOptions extends Highcharts.AxisOptions {
scrollbar?: ScrollbarOptions;
}
interface XAxisOptions extends AxisOptions {
ordinal?: boolean;
overscroll?: number;
}
interface YAxisOptions extends AxisOptions {
height?: number | string;
maxLength?: number | string;
minLength?: number | string;
resize?: {
controlledAxis?: {
next?: Array<number | string>;
prev?: Array<number | string>;
},
cursor?: string;
enabled?: boolean;
lineColor?: string;
lineDashStyle?: string;
lineWidth?: number;
x?: number;
y?: number;
};
reversedStacks?: boolean;
tooltipValueFormat?: string;
top?: number | string;
}
interface Options extends Highcharts.Options {
navigator?: NavigatorOptions;
rangeSelector?: RangeSelectorOptions;
scrollbar?: ScrollbarOptions;
xAxis?: XAxisOptions[] |XAxisOptions;
yAxis?: YAxisOptions[] | YAxisOptions;
}
interface Chart {
new (options: Options, callback?: (chart: ChartObject) => void): ChartObject;
}
interface Static extends Highcharts.Static {
StockChart: Chart;
stockChart(renderTo: string | HTMLElement, options: Options, callback?: (chart: ChartObject) => void): ChartObject;
}
}
declare global {
interface JQuery {
highcharts(type: "StockChart"): Highstock.ChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param options Options for this chart
* @param callback Callback function used to manipulate the constructed chart instance
* @return current 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, callback?: (chart: Highcharts.ChartObject) => void): JQuery;
}
}
declare const Highstock: Highstock.Static;
export = Highstock;
export as namespace Highstock;
-7679
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1,2 +0,0 @@
import Highcharts = require('../..');
export = Highcharts;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from "highcharts";
declare function HighchartsBoost(H: Static): Static;
export = HighchartsBoost;
export as namespace HighchartsBoost;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from 'highcharts';
declare function HighchartsBullet(H: Static): Static;
export = HighchartsBullet;
export as namespace HighchartsBullet;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from "highcharts";
declare function HighchartsDrilldown(H: Static): Static;
export = HighchartsDrilldown;
export as namespace HighchartsDrilldown;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from "highcharts";
declare function HighchartsExporting(H: Static): Static;
export = HighchartsExporting;
export as namespace HighchartsExporting;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from 'highcharts';
declare function HighchartsHeatMap(H: Static): Static;
export = HighchartsHeatMap;
export as namespace HighchartsHeatMap;
-47
View File
@@ -1,47 +0,0 @@
import * as highcharts from 'highcharts';
import * as geojson from 'geojson';
declare module 'highcharts' {
interface Static {
mapChart(renderTo: string | HTMLElement, options: MapOptions, callback?: (chart: ChartObject) => void): ChartObject;
}
interface MapOptions {
chart?: ChartOptions;
legend?: LegendOptions;
mapNavigation?: Navigation;
plotOptions?: PlotOptions;
series?: MapSeriesOptions[];
colorAxis?: ColorAxis;
title?: TitleOptions;
tooltip?: TooltipOptions;
}
interface MapSeriesOptions {
data?: number[] | Array<[number, number]> | Array<[string, number]> | DataPoint[];
dataLabels?: MapSeriesOptionsDataLabels;
joinBy?: string[];
mapData?: geojson.GeoJsonObject;
name?: string;
states?: MapSeriesOptionsStates;
tooltip?: MapSeriesOptionsTooltip;
type?: string;
}
interface Navigation {}
interface MapSeriesOptionsDataLabels {}
interface MapSeriesOptionsStates {}
interface MapSeriesOptionsTooltip {}
interface ColorAxis {}
}
-29
View File
@@ -1,29 +0,0 @@
import { Static } from "highcharts";
declare module "highcharts" {
interface ChartObject {
/**
* Returns true if there are data points within the plot area now
* @return If chart has any data.
* @since 3.0.8
*/
hasData(): boolean;
/**
* Hide the 'No data to display' message added by the no-data-to-display plugin.
* @since 3.0.8
*/
hideNoData(): void;
/**
* Display a no-data message.
* @param message An optional message to show in place of the default one
* @since 3.0.8
*/
showNoData(message?: string): void;
}
}
declare function HighchartsNoDataToDisplay(H: Static): Static;
export = HighchartsNoDataToDisplay;
export as namespace HighchartsNoDataToDisplay;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from "highcharts";
declare function HighchartsOfflineExporting(H: Static): Static;
export = HighchartsOfflineExporting;
export as namespace HighchartsOfflineExporting;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from 'highcharts';
declare function HighchartsSolidGauge(H: Static): Static;
export = HighchartsSolidGauge;
export as namespace HighchartsSolidGauge;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from 'highcharts';
declare function HighchartsTreeMap(H: Static): Static;
export = HighchartsTreeMap;
export as namespace HighchartsTreeMap;
-5
View File
@@ -1,5 +0,0 @@
import { Static } from 'highcharts';
declare function HighchartsWordcloud(H: Static): Static;
export = HighchartsWordcloud;
export as namespace HighchartsWordcloud;
-1
View File
@@ -1 +0,0 @@
HighchartsBoost(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsBullet(Highcharts);
-25
View File
@@ -1,25 +0,0 @@
import { IndividualSeriesOptions } from "highcharts";
const numbers: IndividualSeriesOptions = {
data: [1, 2, 3]
};
const numbersWithNulls: IndividualSeriesOptions = {
data: [1, null, 3]
};
const pairs: IndividualSeriesOptions = {
data: [[0, 1], [1, 3], [2, 9]]
};
const pairsWithNulls: IndividualSeriesOptions = {
data: [[0, 1], [1, null], [2, 9]]
};
const stringNumbers: IndividualSeriesOptions = {
data: [["a", 21], ["b", 4]]
};
const dataPoints: IndividualSeriesOptions = {
data: [{ x: 0, y: 1 }, { x: 1, y: null }]
};
-1
View File
@@ -1 +0,0 @@
HighchartsDrilldown(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsExporting(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsHeatMap(Highcharts);
-75
View File
@@ -1,75 +0,0 @@
/// <reference types="jquery" />
import * as Highcharts from "highcharts";
const someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
$(() => {
$('#container').highcharts('StockChart', {
chart: {
type: "arearange"
},
xAxis: {
scrollbar: { enabled: true }
},
navigator: {
height: 80,
maskFill: 'rgba(255, 198, 220, 0.75)',
handles: {
backgroundColor: 'yellow',
borderColor: 'red'
}
},
rangeSelector: {
allButtonsEnabled: true,
selected: 1,
buttons: [{
type: 'month',
count: 1,
text: '1m',
events: {
click: () => { }
}
}],
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: [{
name: 'USD to EUR',
data: someData,
lineColor: "blue"
} as Highcharts.AreaRangeChartSeriesOptions]
});
});
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
HighchartsMore(Highcharts);
@@ -1,8 +0,0 @@
function test_NoDataToDisplay() {
const chart = $("#container").highcharts();
const chartHasData = chart.hasData();
chart.hideNoData();
chart.showNoData("Custom no data message");
}
HighchartsNoDataToDisplay(Highcharts);
@@ -1 +0,0 @@
HighchartsExporting(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsSolidGauge(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsTreeMap(Highcharts);
-1
View File
@@ -1 +0,0 @@
HighchartsWordcloud(Highcharts);
-46
View File
@@ -1,46 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"highcharts-more.d.ts",
"highstock.d.ts",
"index.d.ts",
"js/highcharts/index.d.ts",
"modules/boost.d.ts",
"modules/bullet.d.ts",
"modules/drilldown.d.ts",
"modules/exporting.d.ts",
"modules/heatmap.d.ts",
"modules/map/index.d.ts",
"modules/no-data-to-display.d.ts",
"modules/offline-exporting.d.ts",
"modules/solid-gauge.d.ts",
"modules/treemap.d.ts",
"modules/wordcloud.d.ts",
"test/boost.ts",
"test/bullet.ts",
"test/drilldown.ts",
"test/exporting.ts",
"test/heatmap.ts",
"test/highstock.ts",
"test/index.ts",
"test/more.ts",
"test/no-data-to-display.ts",
"test/offline-exporting.ts",
"test/solid-gauge.ts",
"test/treemap.ts",
"test/wordcloud.ts",
"test/datapoint.ts"
]
}
-13
View File
@@ -1,13 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODOs
"ban-types": false,
"no-empty-interface": false,
"no-declare-current-package": false,
"no-object-literal-type-assertion": false,
"no-self-import": false,
"no-unnecessary-generics": false,
"no-angle-bracket-type-assertion": false
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"@types/highcharts": "^5.0.44"
}
}