From 39debc285e0827afc57b78c4f3d4fe1a345287f8 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 30 Mar 2015 15:26:22 -0400 Subject: [PATCH] Fix tests and broken references --- d3/d3-tests.ts | 12 ++++++------ dagre-d3/dagre-d3.d.ts | 2 +- dcjs/dc-1.6.0.d.ts | 8 ++++---- dcjs/dc.d.ts | 44 +++++++++++++++++++++--------------------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 70e4036dd..4750c2309 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -48,33 +48,33 @@ function testPieChart() { function testMapConstructor() { //No arg constructor - var emptyMap: D3.Map = d3.map(); + var emptyMap: d3.Map = d3.map(); //Object constructor var object:{[key: string]: number } = {a: 1, b: 2, c: 3}; - var objectMap: D3.Map = d3.map(object); + var objectMap: d3.Map = d3.map(object); //Array constructor var numberArray: number[] = [1, 2, 3] - var numberArrayMap: D3.Map = d3.map(numberArray); + var numberArrayMap: d3.Map = d3.map(numberArray); //Array with keyFn constructor var objectArray: {key: string}[] = [{key: "v1"}, {key: "v2"}, {key: "v3"}]; var indexes: number[] = []; //keyFn with index - var objectArrayMap1: D3.Map<{key: string}> + var objectArrayMap1: d3.Map<{key: string}> = d3.map<{key: string}>(objectArray, (o: {key: string}, index: number) => { indexes.push(index); return o.key; }); //keyFn without index - var objectArrayMap2: D3.Map<{key: string}> + var objectArrayMap2: d3.Map<{key: string}> = d3.map<{key: string}>(objectArray, (o: {key: string}) => { return o.key; }); //Map constructor - var duplicateMap: D3.Map = d3.map(numberArrayMap); + var duplicateMap: d3.Map = d3.map(numberArrayMap); } //Example from http://bl.ocks.org/3887051 diff --git a/dagre-d3/dagre-d3.d.ts b/dagre-d3/dagre-d3.d.ts index d088d1d82..d654fa0b4 100644 --- a/dagre-d3/dagre-d3.d.ts +++ b/dagre-d3/dagre-d3.d.ts @@ -24,7 +24,7 @@ declare module Dagre { interface Render { new (): Render; - (selection: D3.Selection, g: Dagre.Graph): void; + (selection: d3.Selection, g: Dagre.Graph): void; } } diff --git a/dcjs/dc-1.6.0.d.ts b/dcjs/dc-1.6.0.d.ts index 2b06c34dd..2feed9a8c 100644 --- a/dcjs/dc-1.6.0.d.ts +++ b/dcjs/dc-1.6.0.d.ts @@ -47,8 +47,8 @@ export interface ILegendwidget { legend: (l:ILegendwidget) => T; chartID: () => number; options: (o:Object)=>void ; - select: (selector: D3.Selection) => D3.Selection; - selectAll: (selector: D3.Selection) => D3.Selection; + select: (selector: d3.Selection) => d3.Selection; + selectAll: (selector: d3.Selection) => d3.Selection; } export interface IEvents { @@ -85,8 +85,8 @@ export interface ILegendwidget { x: IGetSet; y: IGetSet; elasticY: IGetSet; - xAxis: IGetSet; - yAxis: IGetSet; + xAxis: IGetSet; + yAxis: IGetSet; yAxisPadding: IGetSet; xAxisPadding: IGetSet; renderHorizontalGridLines: IGetSet; diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 5a83b5c7c..5382c9b76 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -86,7 +86,7 @@ declare module DC { clamp(n: number, min: number, max: number): number; uniqueId(): number; nameToId(name: string): string; - appendOrSelect(parent: D3.Selection, selector: string, tag: any): D3.Selection; + appendOrSelect(parent: d3.Selection, selector: string, tag: any): d3.Selection; safeNumber(n: any): number; } @@ -112,11 +112,11 @@ declare module DC { group: IGetSet; ordering: IGetSet, T>; filterAll(): void; - select(selector: D3.Selection|string): D3.Selection; - selectAll(selector: D3.Selection|string): D3.Selection; - anchor(anchor: BaseMixin|D3.Selection|string, chartGroup?: string): D3.Selection; + select(selector: d3.Selection|string): d3.Selection; + selectAll(selector: d3.Selection|string): d3.Selection; + anchor(anchor: BaseMixin|d3.Selection|string, chartGroup?: string): d3.Selection; anchorName(): string; - svg: IGetSet; + svg: IGetSet, d3.Selection>; resetSvg(): void; filterPrinter: IGetSet<(filters: Array) => string, T>; turnOnControls(): void; @@ -160,7 +160,7 @@ declare module DC { } export interface ColorMixin { - colors: IGetSet|Array, T>; + colors: IGetSet | { (n: number): string; domain(colors: any[]): any }, T>; ordinalColors(r: Array): void; linearColors(r: Array): void; colorAccessor: IGetSet, T>; @@ -174,12 +174,12 @@ declare module DC { rangeChart: IGetSet, T>; zoomScale: IGetSet, T>; zoomOutRestrict: IGetSet; - g: IGetSet; + g: IGetSet, T>; mouseZoomable: IGetSet; - chartBodyG(): D3.Selection; - x: IGetSet, T>; + chartBodyG(): d3.Selection; + x: IGetSet<(n: any) => any, T>; xUnits: IGetSet; - xAxis: IGetSet; + xAxis: IGetSet; elasticX: IGetSet; xAxisPadding: IGetSet; xUnitCount(): number; @@ -187,8 +187,8 @@ declare module DC { isOrdinal(): boolean; xAxisLabel: IBiGetSet; yAxisLabel: IBiGetSet; - y: IGetSet, T>; - yAxis: IGetSet; + y: IGetSet<(n: any) => any, T>; + yAxis: IGetSet; elasticY: IGetSet; renderHorizontalGridLines: IGetSet; renderVerticalGridLines: IGetSet; @@ -209,7 +209,7 @@ declare module DC { hideStack(name: string): void; showStack(name: string): void; // title(stackName: string, titleFn: Accessor); - stackLayout: IGetSet; + stackLayout: IGetSet, T>; } export interface CapMixin { @@ -219,7 +219,7 @@ declare module DC { } export interface BubbleMixin extends ColorMixin { - r: IGetSet, T>; + r: IGetSet<(n: any) => any, T>; radiusValueAccessor: IGetSet, T>; minRadiusWithLabel: IGetSet; maxBubbleRelativeSize: IGetSet; @@ -295,8 +295,8 @@ declare module DC { children(): Array>; shareColors: IGetSet; shareTitle: IGetSet; - rightY: IGetSet, CompositeChart>; - rightYAxis: IGetSet; + rightY: IGetSet<(n: any) => any, CompositeChart>; + rightYAxis: IGetSet; } export interface SeriesChart extends CompositeChart { @@ -314,9 +314,9 @@ declare module DC { export interface GeoChoroplethChart extends ColorMixin, BaseMixin { overlayGeoJson(json: any, name: string, keyAccessor: Accessor): void; - projection: IGetSet; + projection: IGetSet; geoJsons(): Array; - geoPath(): D3.Geo.Path; + geoPath(): d3.geo.Path; removeGeoJson(name: string): void; } @@ -325,9 +325,9 @@ declare module DC { } export interface RowChart extends CapMixin, MarginMixin, ColorMixin, BaseMixin { - x: IGetSet, RowChart>; + x: IGetSet<(n: any) => any, RowChart>; renderTitleLabel: IGetSet; - xAxis: IGetSet; + xAxis: IGetSet; fixedBarHeight: IGetSet; gap: IGetSet; elasticX: IGetSet; @@ -338,7 +338,7 @@ declare module DC { export interface ScatterPlot extends CoordinateGridMixin { existenceAccessor: IGetSet, ScatterPlot>; - symbol: IGetSet; + symbol: IGetSet, ScatterPlot>; symbolSize: IGetSet; highlightedSize: IGetSet; hiddenSize: IGetSet; @@ -392,7 +392,7 @@ declare module DC { renderAll(group?: string): void; redrawAll(group?: string): void; disableTransitions: boolean; - transition(selections: D3.Selection, duration: number, callback: (s: D3.Selection) => void): void; + transition(selections: d3.Selection, duration: number, callback: (s: d3.Selection) => void): void; units: Units; events: Events;