Skip to content

Commit

Permalink
Tools: Extended DTS support.
Browse files Browse the repository at this point in the history
  • Loading branch information
bre1470 authored and TorsteinHonsi committed Nov 12, 2018
1 parent 3268cf0 commit 8383547
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/typescript/highcharts-more.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as Highcharts from 'highcharts';
import HighchartsMore from 'highcharts/highcharts-more';

HighchartsMore(Highcharts);
116 changes: 116 additions & 0 deletions test/typescript/modules/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import * as Highcharts from 'highcharts';
import DataModule from 'highcharts/modules/data';

DataModule(Highcharts);

function test_beforeParse() {
const series1: Highcharts.SeriesLineOptions = {
type: 'line',
name: 'All sessions',
lineWidth: 4,
marker: {
radius: 4
}
};
const series2: Highcharts.SeriesLineOptions = {
type: 'line',
name: 'New users'
};
Highcharts.chart('container', {
chart: {
scrollablePlotArea: {
minWidth: 700
}
},

data: {
csvURL: 'https://cdn.rawgit.com/highcharts/highcharts/' +
'057b672172ccc6c08fe7dbb27fc17ebca3f5b770/samples/data/analytics.csv',
beforeParse: (csv: string) => {
return csv.replace(/\n\n/g, '\n');
}
},

title: {
text: 'Daily sessions at www.highcharts.com'
},

subtitle: {
text: 'Source: Google Analytics'
},

xAxis: {
tickInterval: 7 * 24 * 3600 * 1000, // one week
tickWidth: 0,
gridLineWidth: 1,
labels: {
align: 'left',
x: 3,
y: -3
}
},

yAxis: [{ // left y axis
title: {
text: undefined
},
labels: {
align: 'left',
x: 3,
y: 16,
format: '{value:.,0f}'
},
showFirstLabel: false
}, { // right y axis
linkedTo: 0,
gridLineWidth: 0,
opposite: true,
title: {
text: undefined
},
labels: {
align: 'right',
x: -3,
y: 16,
format: '{value:.,0f}'
},
showFirstLabel: false
}],

legend: {
align: 'left',
verticalAlign: 'top',
borderWidth: 0
},

tooltip: {
shared: true,
crosshairs: true
},

plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: (e) => {
console.log('click', e);
}
}
},
marker: {
lineWidth: 1
}
}
},

series: [{
type: 'line',
name: 'All sessions',
lineWidth: 4,
marker: {
radius: 4
}
}, series2]
});
}
8 changes: 8 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"code/highcharts.src.d.ts",
"test/typescript/highcharts.ts",

"code/highcharts-more.d.ts",
"code/highcharts-more.src.d.ts",
"test/typescript/highcharts-more.ts",

"code/modules/accessibility.d.ts",
"code/modules/accessibility.src.d.ts",
"test/typescript/modules/accessibility.ts",
Expand All @@ -37,6 +41,10 @@
"code/modules/boost.src.d.ts",
"test/typescript/modules/boost.ts",

"code/modules/data.d.ts",
"code/modules/data.src.d.ts",
"test/typescript/modules/data.ts",

"code/modules/export-data.d.ts",
"code/modules/export-data.src.d.ts",
"test/typescript/modules/export-data.ts",
Expand Down

0 comments on commit 8383547

Please sign in to comment.