From 5532887980800ceef4d93f7a6b43188662d709f9 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 19:44:31 -0400 Subject: [PATCH] require scale-like behavior of dc.js scales --- dcjs/dc.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 5382c9b76..62739e16a 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -20,6 +20,16 @@ declare module DC { (t: T, r?: R): V; } + export interface Scale { + (x: any): T; + + domain(values: any[]): Scale; + domain(): any[]; + + range(values: T[]): Scale; + range(): T[]; + } + export interface Accessor { (datum: T, index?: number): V; } @@ -160,9 +170,9 @@ declare module DC { } export interface ColorMixin { - colors: IGetSet | { (n: number): string; domain(colors: any[]): any }, T>; + colors: IGetSet | Scale, T>; ordinalColors(r: Array): void; - linearColors(r: Array): void; + linearColors(r: Array): void; colorAccessor: IGetSet, T>; colorDomain: IGetSet, T>; calculateColorDomain(): void; @@ -187,7 +197,7 @@ declare module DC { isOrdinal(): boolean; xAxisLabel: IBiGetSet; yAxisLabel: IBiGetSet; - y: IGetSet<(n: any) => any, T>; + y: IGetSet, T>; yAxis: IGetSet; elasticY: IGetSet; renderHorizontalGridLines: IGetSet; @@ -219,7 +229,7 @@ declare module DC { } export interface BubbleMixin extends ColorMixin { - r: IGetSet<(n: any) => any, T>; + r: IGetSet, T>; radiusValueAccessor: IGetSet, T>; minRadiusWithLabel: IGetSet; maxBubbleRelativeSize: IGetSet; @@ -325,7 +335,7 @@ declare module DC { } export interface RowChart extends CapMixin, MarginMixin, ColorMixin, BaseMixin { - x: IGetSet<(n: any) => any, RowChart>; + x: IGetSet, RowChart>; renderTitleLabel: IGetSet; xAxis: IGetSet; fixedBarHeight: IGetSet;