From f9b189a87343fb0e05f2d06d09f9cab11a44cf41 Mon Sep 17 00:00:00 2001 From: Matt Gibbs Date: Tue, 19 Jan 2016 15:32:11 -0500 Subject: [PATCH] Made 'type' optional to avoid problems with Chartist defaults When forced to define the type, Chartist won't default to all of the other options. So if you just want to do something like not show the grid, you'll end up having to define all of the axis options because of the strict typing that was there before. --- chartist/chartist-tests.ts | 20 ++++++++++++++++++++ chartist/chartist.d.ts | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts index f4ec32f2a..22b10e8b0 100644 --- a/chartist/chartist-tests.ts +++ b/chartist/chartist-tests.ts @@ -242,6 +242,26 @@ new Chartist.Line('.ct-chart', { } }); +new Chartist.Line('.ct-chart', { + labels: [1, 2, 3, 4, 5, 6, 7, 8], + series: [ + [5, 9, 7, 8, 5, 3, 5, 4] + ] +}, { + ticks: [0, 4], + low: 0, + showArea: true, + axisX: { + showGrid: false + }, + axisY: { + showLabel: true, + showGrid: false, + ticks: [1, 4], + type: Chartist.FixedScaleAxis + } + }); + var chart2 = new Chartist.Line('.ct-chart', { labels: [1, 2, 3, 4, 5], series: [ diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts index 8d63696f6..a38aa4ce7 100644 --- a/chartist/chartist.d.ts +++ b/chartist/chartist.d.ts @@ -305,13 +305,13 @@ declare module Chartist { } interface IChartistStepAxis extends ILineChartAxis { - type: IStepAxisStatic; + type?: IStepAxisStatic; ticks?: Array | Array; stretch?: boolean; } interface IChartistFixedScaleAxis extends ILineChartAxis { - type: IFixedScaleAxisStatic; + type?: IFixedScaleAxisStatic; high?: number; low?: number; divisor?: number; @@ -324,7 +324,7 @@ declare module Chartist { scaleMinSpace?: number; onlyInteger?: boolean; referenceValue?: number; - type: IAutoScaleAxisStatic; + type?: IAutoScaleAxisStatic; } interface ILineChartClasses {