Fix tests and broken references

This commit is contained in:
Alex Ford
2015-03-30 15:26:22 -04:00
parent 7600257d34
commit 39debc285e
4 changed files with 33 additions and 33 deletions
+6 -6
View File
@@ -48,33 +48,33 @@ function testPieChart() {
function testMapConstructor() {
//No arg constructor
var emptyMap: D3.Map<any> = d3.map();
var emptyMap: d3.Map<any> = d3.map();
//Object constructor
var object:{[key: string]: number } = {a: 1, b: 2, c: 3};
var objectMap: D3.Map<number> = d3.map<number>(object);
var objectMap: d3.Map<number> = d3.map<number>(object);
//Array constructor
var numberArray: number[] = [1, 2, 3]
var numberArrayMap: D3.Map<number> = d3.map<number>(numberArray);
var numberArrayMap: d3.Map<number> = d3.map<number>(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<number> = d3.map(numberArrayMap);
var duplicateMap: d3.Map<number> = d3.map(numberArrayMap);
}
//Example from http://bl.ocks.org/3887051
+1 -1
View File
@@ -24,7 +24,7 @@ declare module Dagre {
interface Render {
new (): Render;
(selection: D3.Selection, g: Dagre.Graph): void;
(selection: d3.Selection<any>, g: Dagre.Graph): void;
}
}
+4 -4
View File
@@ -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<any>) => d3.Selection<any>;
selectAll: (selector: d3.Selection<any>) => d3.Selection<any>;
}
export interface IEvents {
@@ -85,8 +85,8 @@ export interface ILegendwidget {
x: IGetSet<any, T>;
y: IGetSet<any, T>;
elasticY: IGetSet<boolean, T>;
xAxis: IGetSet<D3.Svg.Axis, T>;
yAxis: IGetSet<D3.Svg.Axis, T>;
xAxis: IGetSet<d3.svg.Axis, T>;
yAxis: IGetSet<d3.svg.Axis, T>;
yAxisPadding: IGetSet<number, T>;
xAxisPadding: IGetSet<number, T>;
renderHorizontalGridLines: IGetSet<boolean, T>;
+22 -22
View File
@@ -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<any>, selector: string, tag: any): d3.Selection<any>;
safeNumber(n: any): number;
}
@@ -112,11 +112,11 @@ declare module DC {
group: IGetSet<any, T>;
ordering: IGetSet<Accessor<any, any>, T>;
filterAll(): void;
select(selector: D3.Selection|string): D3.Selection;
selectAll(selector: D3.Selection|string): D3.Selection;
anchor(anchor: BaseMixin<any>|D3.Selection|string, chartGroup?: string): D3.Selection;
select(selector: d3.Selection<any>|string): d3.Selection<any>;
selectAll(selector: d3.Selection<any>|string): d3.Selection<any>;
anchor(anchor: BaseMixin<any>|d3.Selection<any>|string, chartGroup?: string): d3.Selection<any>;
anchorName(): string;
svg: IGetSet<D3.Selection, D3.Selection>;
svg: IGetSet<d3.Selection<any>, d3.Selection<any>>;
resetSvg(): void;
filterPrinter: IGetSet<(filters: Array<any>) => string, T>;
turnOnControls(): void;
@@ -160,7 +160,7 @@ declare module DC {
}
export interface ColorMixin<T> {
colors: IGetSet<D3.Scale.GenericScale<any>|Array<string>, T>;
colors: IGetSet<Array<string> | { (n: number): string; domain(colors: any[]): any }, T>;
ordinalColors(r: Array<string>): void;
linearColors(r: Array<number>): void;
colorAccessor: IGetSet<Accessor<any, string>, T>;
@@ -174,12 +174,12 @@ declare module DC {
rangeChart: IGetSet<BaseMixin<any>, T>;
zoomScale: IGetSet<Array<any>, T>;
zoomOutRestrict: IGetSet<boolean, T>;
g: IGetSet<D3.Selection, T>;
g: IGetSet<d3.Selection<any>, T>;
mouseZoomable: IGetSet<boolean, T>;
chartBodyG(): D3.Selection;
x: IGetSet<D3.Scale.GenericScale<any>, T>;
chartBodyG(): d3.Selection<any>;
x: IGetSet<(n: any) => any, T>;
xUnits: IGetSet<UnitFunction, T>;
xAxis: IGetSet<D3.Svg.Axis, T>;
xAxis: IGetSet<d3.svg.Axis, T>;
elasticX: IGetSet<boolean, T>;
xAxisPadding: IGetSet<number, T>;
xUnitCount(): number;
@@ -187,8 +187,8 @@ declare module DC {
isOrdinal(): boolean;
xAxisLabel: IBiGetSet<string, number, T>;
yAxisLabel: IBiGetSet<string, number, T>;
y: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
yAxis: IGetSet<D3.Svg.Axis, T>;
y: IGetSet<(n: any) => any, T>;
yAxis: IGetSet<d3.svg.Axis, T>;
elasticY: IGetSet<boolean, T>;
renderHorizontalGridLines: IGetSet<boolean, T>;
renderVerticalGridLines: IGetSet<boolean, T>;
@@ -209,7 +209,7 @@ declare module DC {
hideStack(name: string): void;
showStack(name: string): void;
// title(stackName: string, titleFn: Accessor<any, T>);
stackLayout: IGetSet<D3.Layout.StackLayout, T>;
stackLayout: IGetSet<d3.layout.Stack<any[], any>, T>;
}
export interface CapMixin<T> {
@@ -219,7 +219,7 @@ declare module DC {
}
export interface BubbleMixin<T> extends ColorMixin<T> {
r: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
r: IGetSet<(n: any) => any, T>;
radiusValueAccessor: IGetSet<Accessor<any, number>, T>;
minRadiusWithLabel: IGetSet<number, T>;
maxBubbleRelativeSize: IGetSet<number, T>;
@@ -295,8 +295,8 @@ declare module DC {
children(): Array<BaseMixin<any>>;
shareColors: IGetSet<boolean, CompositeChart>;
shareTitle: IGetSet<boolean, CompositeChart>;
rightY: IGetSet<D3.Scale.GenericQuantitativeScale<any>, CompositeChart>;
rightYAxis: IGetSet<D3.Svg.Axis, CompositeChart>;
rightY: IGetSet<(n: any) => any, CompositeChart>;
rightYAxis: IGetSet<d3.svg.Axis, CompositeChart>;
}
export interface SeriesChart extends CompositeChart {
@@ -314,9 +314,9 @@ declare module DC {
export interface GeoChoroplethChart extends ColorMixin<GeoChoroplethChart>, BaseMixin<GeoChoroplethChart> {
overlayGeoJson(json: any, name: string, keyAccessor: Accessor<any, any>): void;
projection: IGetSet<D3.Geo.Projection, GeoChoroplethChart>;
projection: IGetSet<d3.geo.Projection, GeoChoroplethChart>;
geoJsons(): Array<GeoChoroplethLayer>;
geoPath(): D3.Geo.Path;
geoPath(): d3.geo.Path;
removeGeoJson(name: string): void;
}
@@ -325,9 +325,9 @@ declare module DC {
}
export interface RowChart extends CapMixin<RowChart>, MarginMixin<RowChart>, ColorMixin<RowChart>, BaseMixin<RowChart> {
x: IGetSet<D3.Scale.GenericQuantitativeScale<any>, RowChart>;
x: IGetSet<(n: any) => any, RowChart>;
renderTitleLabel: IGetSet<boolean, RowChart>;
xAxis: IGetSet<D3.Svg.Axis, RowChart>;
xAxis: IGetSet<d3.svg.Axis, RowChart>;
fixedBarHeight: IGetSet<number, RowChart>;
gap: IGetSet<number, RowChart>;
elasticX: IGetSet<boolean, RowChart>;
@@ -338,7 +338,7 @@ declare module DC {
export interface ScatterPlot extends CoordinateGridMixin<ScatterPlot> {
existenceAccessor: IGetSet<Accessor<any, boolean>, ScatterPlot>;
symbol: IGetSet<D3.Svg.Symbol, ScatterPlot>;
symbol: IGetSet<d3.svg.Symbol<any>, ScatterPlot>;
symbolSize: IGetSet<number, ScatterPlot>;
highlightedSize: IGetSet<number, ScatterPlot>;
hiddenSize: IGetSet<number, ScatterPlot>;
@@ -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<any>, duration: number, callback: (s: d3.Selection<any>) => void): void;
units: Units;
events: Events;