diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index cfacf8e79e..e60486cee0 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -1,4 +1,4 @@ -import { BorderWidth, Chart, ChartData, Point, ChartColor } from 'chart.js'; +import { BorderWidth, Chart, Point, ChartColor } from 'chart.js'; // alternative: // import chartjs = require('chart.js'); @@ -241,3 +241,41 @@ const chartWithScriptedOptions = new Chart(new CanvasRenderingContext2D(), { }], } }); + +// linear scale +const linearScaleChart: Chart = new Chart(ctx, { + type: 'bar', + data: { + datasets: [{ + backgroundColor: '#000', + borderColor: '#f00', + data: [], + type: 'line', + }] + }, + options: { + scales: { + displayFormats: { + month: 'MMM YYYY', + }, + xAxes: [{ + type: 'time', + distribution: 'series', + ticks: { + source: 'data', + autoSkip: true + } + }], + yAxes: [{ + scaleLabel: { + display: true, + labelString: 'Closing price ($)' + } + }] + }, + tooltips: { + intersect: false, + mode: 'index', + } + } +}); diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index d6e9634208..3c49e97e13 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -249,7 +249,7 @@ declare namespace Chart { elements?: ChartElementsOptions; layout?: ChartLayoutOptions; scale?: RadialLinearScale; - scales?: ChartScales; + scales?: ChartScales | LinearScale | LogarithmicScale | TimeScale; showLines?: boolean; spanGaps?: boolean; cutoutPercentage?: number;