diff --git a/plottable/plottable-tests.ts b/plottable/plottable-tests.ts
new file mode 100644
index 000000000..d1b3589fd
--- /dev/null
+++ b/plottable/plottable-tests.ts
@@ -0,0 +1,51 @@
+///
+
+var data = [
+ { x: 1, y: 1, x2: 2, y2: 2 },
+ { x: 4, y: 4, x2: 3, y2: 3 },
+ { x: 2, y: 2, x2: 3, y2: 3 }
+];
+
+// Create a dataset
+var dataset = new Plottable.Dataset(data);
+
+// Generate a bunch of scales
+var linearScale = new Plottable.Scales.Linear();
+var modifiedLogScale = new Plottable.Scales.ModifiedLog();
+var categoryScale = new Plottable.Scales.Category();
+var categorySecondaryScale = new Plottable.Scales.Category();
+
+// Generate a bunch of axes
+var numericAxis = new Plottable.Axes.Numeric(linearScale, "bottom");
+var numericSecondaryAxis = new Plottable.Axes.Numeric(modifiedLogScale, "left");
+var categoryAxis = new Plottable.Axes.Category(categoryScale, "bottom");
+var categorySecondaryAxis = new Plottable.Axes.Category(categorySecondaryScale, "left");
+
+// Scatter plot
+var scatter = new Plottable.Plots.Scatter()
+ .x((d) => d.x, linearScale)
+ .y((d) => d.y, categoryScale)
+ .addDataset(dataset);
+
+// Line plot
+var line = new Plottable.Plots.Line()
+ .x((d) => d.x, linearScale)
+ .y((d) => d.y, modifiedLogScale)
+ .addDataset(dataset);
+
+// Rectangle plot
+var rectangle = new Plottable.Plots.Rectangle()
+ .x((d) => d.x, linearScale)
+ .y((d) => d.y, modifiedLogScale)
+ .x2((d) => d.x2)
+ .y2((d) => d.y2)
+ .addDataset(dataset);
+
+// Create a group of plots
+var group = new Plottable.Components.Group([line, scatter]);
+
+// Make a chart
+new Plottable.Components.Table([
+ [numericSecondaryAxis, group],
+ [null, numericAxis]
+]);
\ No newline at end of file
diff --git a/plottable/plottable.d.ts b/plottable/plottable.d.ts
new file mode 100644
index 000000000..683f8397a
--- /dev/null
+++ b/plottable/plottable.d.ts
@@ -0,0 +1,4034 @@
+// Type definitions for Plottable v1.2.0
+// Project: http://plottablejs.org/
+// Definitions by: Plottable Team
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+///
+
+declare module Plottable {
+ module Utils {
+ module Math {
+ /**
+ * Checks if x is between a and b.
+ *
+ * @param {number} x The value to test if in range
+ * @param {number} a The beginning of the (inclusive) range
+ * @param {number} b The ending of the (inclusive) range
+ * @return {boolean} Whether x is in [a, b]
+ */
+ function inRange(x: number, a: number, b: number): boolean;
+ /**
+ * Clamps x to the range [min, max].
+ *
+ * @param {number} x The value to be clamped.
+ * @param {number} min The minimum value.
+ * @param {number} max The maximum value.
+ * @return {number} A clamped value in the range [min, max].
+ */
+ function clamp(x: number, min: number, max: number): number;
+ /**
+ * Applies the accessor, if provided, to each element of `array` and returns the maximum value.
+ * If no maximum value can be computed, returns defaultValue.
+ */
+ function max(array: C[], defaultValue: C): C;
+ function max(array: T[], accessor: (t?: T, i?: number) => C, defaultValue: C): C;
+ /**
+ * Applies the accessor, if provided, to each element of `array` and returns the minimum value.
+ * If no minimum value can be computed, returns defaultValue.
+ */
+ function min(array: C[], defaultValue: C): C;
+ function min(array: T[], accessor: (t?: T, i?: number) => C, defaultValue: C): C;
+ /**
+ * Returns true **only** if x is NaN
+ */
+ function isNaN(n: any): boolean;
+ /**
+ * Returns true if the argument is a number, which is not NaN
+ * Numbers represented as strings do not pass this function
+ */
+ function isValidNumber(n: any): boolean;
+ /**
+ * Generates an array of consecutive, strictly increasing numbers
+ * in the range [start, stop) separeted by step
+ */
+ function range(start: number, stop: number, step?: number): number[];
+ /**
+ * Returns the square of the distance between two points
+ *
+ * @param {Point} p1
+ * @param {Point} p2
+ * @return {number} dist(p1, p2)^2
+ */
+ function distanceSquared(p1: Point, p2: Point): number;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ /**
+ * Shim for ES6 map.
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
+ */
+ class Map {
+ constructor();
+ set(key: K, value: V): Map;
+ get(key: K): V;
+ has(key: K): boolean;
+ forEach(callbackFn: (value: V, key: K, map: Map) => void, thisArg?: any): void;
+ delete(key: K): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ /**
+ * Shim for ES6 set.
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
+ */
+ class Set {
+ size: number;
+ constructor();
+ add(value: T): Set;
+ delete(value: T): boolean;
+ has(value: T): boolean;
+ forEach(callback: (value: T, value2: T, set: Set) => void, thisArg?: any): void;
+ }
+ }
+}
+
+declare module Plottable {
+ module Utils {
+ module DOM {
+ /**
+ * Gets the bounding box of an element.
+ * @param {d3.Selection} element
+ * @returns {SVGRed} The bounding box.
+ */
+ function elementBBox(element: d3.Selection): SVGRect;
+ /**
+ * Screen refresh rate which is assumed to be 60fps
+ */
+ var SCREEN_REFRESH_RATE_MILLISECONDS: number;
+ /**
+ * Polyfill for `window.requestAnimationFrame`.
+ * If the function exists, then we use the function directly.
+ * Otherwise, we set a timeout on `SCREEN_REFRESH_RATE_MILLISECONDS` and then perform the function.
+ *
+ * @param {() => void} callback The callback to call in the next animation frame
+ */
+ function requestAnimationFramePolyfill(callback: () => void): void;
+ /**
+ * Calculates the width of the element.
+ * The width includes the padding and the border on the element's left and right sides.
+ *
+ * @param {Element} element The element to query
+ * @returns {number} The width of the element.
+ */
+ function elementWidth(element: Element): number;
+ /**
+ * Calculates the height of the element.
+ * The height includes the padding the and the border on the element's top and bottom sides.
+ *
+ * @param {Element} element The element to query
+ * @returns {number} The height of the element
+ */
+ function elementHeight(element: Element): number;
+ /**
+ * Retrieves the number array representing the translation for the selection
+ *
+ * @param {d3.Selection} selection The selection to query
+ * @returns {[number, number]} The number array representing the translation
+ */
+ function translate(selection: d3.Selection): [number, number];
+ /**
+ * Translates the given selection by the input x / y pixel amounts.
+ *
+ * @param {d3.Selection} selection The selection to translate
+ * @param {number} x The amount to translate in the x direction
+ * @param {number} y The amount to translate in the y direction
+ * @returns {d3.Selection} The input selection
+ */
+ function translate(selection: d3.Selection, x: number, y: number): d3.Selection;
+ /**
+ * Checks if the first ClientRect overlaps the second.
+ *
+ * @param {ClientRect} clientRectA The first ClientRect
+ * @param {ClientRect} clientRectB The second ClientRect
+ * @returns {boolean} If the ClientRects overlap each other.
+ */
+ function clientRectsOverlap(clientRectA: ClientRect, clientRectB: ClientRect): boolean;
+ /**
+ * Returns true if and only if innerClientRect is inside outerClientRect.
+ *
+ * @param {ClientRect} innerClientRect The first ClientRect
+ * @param {ClientRect} outerClientRect The second ClientRect
+ * @returns {boolean} If and only if the innerClientRect is inside outerClientRect.
+ */
+ function clientRectInside(innerClientRect: ClientRect, outerClientRect: ClientRect): boolean;
+ /**
+ * Retrieves the bounding svg of the input element
+ *
+ * @param {SVGElement} element The element to query
+ * @returns {SVGElement} The bounding svg
+ */
+ function boundingSVG(element: SVGElement): SVGElement;
+ /**
+ * Generates a ClipPath ID that is unique for this instance of Plottable
+ */
+ function generateUniqueClipPathId(): string;
+ /**
+ * Returns true if the supplied coordinates or Ranges intersect or are contained by bbox.
+ *
+ * @param {number | Range} xValOrRange The x coordinate or Range to test
+ * @param {number | Range} yValOrRange The y coordinate or Range to test
+ * @param {SVGRect} bbox The bbox
+ * @param {number} tolerance Amount by which to expand bbox, in each dimension, before
+ * testing intersection
+ *
+ * @returns {boolean} True if the supplied coordinates or Ranges intersect or are
+ * contained by bbox, false otherwise.
+ */
+ function intersectsBBox(xValOrRange: number | Range, yValOrRange: number | Range, bbox: SVGRect, tolerance?: number): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ module Color {
+ /**
+ * Return contrast ratio between two colors
+ * Based on implementation from chroma.js by Gregor Aisch (gka) (licensed under BSD)
+ * chroma.js may be found here: https://github.com/gka/chroma.js
+ * License may be found here: https://github.com/gka/chroma.js/blob/master/LICENSE
+ * see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
+ */
+ function contrast(a: string, b: string): number;
+ /**
+ * Returns a brighter copy of this color. Each channel is multiplied by 0.7 ^ -factor.
+ * Channel values are capped at the maximum value of 255, and the minimum value of 30.
+ */
+ function lightenColor(color: string, factor: number): string;
+ /**
+ * Gets the Hex Code of the color resulting by applying the className CSS class to the
+ * colorTester selection. Returns null if the tester is transparent.
+ *
+ * @param {d3.Selection} colorTester The d3 selection to apply the CSS class to
+ * @param {string} className The name of the class to be applied
+ * @return {string} The hex code of the computed color
+ */
+ function colorTest(colorTester: d3.Selection, className: string): string;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ module Array {
+ /**
+ * Takes two arrays of numbers and adds them together
+ *
+ * @param {number[]} aList The first array of numbers
+ * @param {number[]} bList The second array of numbers
+ * @return {number[]} An array of numbers where x[i] = aList[i] + bList[i]
+ */
+ function add(aList: number[], bList: number[]): number[];
+ /**
+ * Take an array of values, and return the unique values.
+ * Will work iff ∀ a, b, a.toString() == b.toString() => a == b; will break on Object inputs
+ *
+ * @param {T[]} values The values to find uniqueness for
+ * @return {T[]} The unique values
+ */
+ function uniq(arr: T[]): T[];
+ /**
+ * @param {T[][]} a The 2D array that will have its elements joined together.
+ * @return {T[]} Every array in a, concatenated together in the order they appear.
+ */
+ function flatten(a: T[][]): T[];
+ /**
+ * Creates an array of length `count`, filled with value or (if value is a function), value()
+ *
+ * @param {T | ((index?: number) => T)} value The value to fill the array with or a value generator (called with index as arg)
+ * @param {number} count The length of the array to generate
+ * @return {any[]}
+ */
+ function createFilledArray(value: T | ((index?: number) => T), count: number): T[];
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ /**
+ * A set of callbacks which can be all invoked at once.
+ * Each callback exists at most once in the set (based on reference equality).
+ * All callbacks should have the same signature.
+ */
+ class CallbackSet extends Set {
+ callCallbacks(...args: any[]): CallbackSet;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ module Stacking {
+ type StackedDatum = {
+ value: number;
+ offset: number;
+ };
+ type StackingResult = Utils.Map>;
+ /**
+ * Computes the StackingResult (value and offset) for each data point in each Dataset.
+ *
+ * @param {Dataset[]} datasets The Datasets to be stacked on top of each other in the order of stacking
+ * @param {Accessor} keyAccessor Accessor for the key of the data
+ * @param {Accessor} valueAccessor Accessor for the value of the data
+ * @return {StackingResult} value and offset for each datapoint in each Dataset
+ */
+ function stack(datasets: Dataset[], keyAccessor: Accessor, valueAccessor: Accessor): StackingResult;
+ /**
+ * Computes the total extent over all data points in all Datasets, taking stacking into consideration.
+ *
+ * @param {StackingResult} stackingResult The value and offset information for each datapoint in each dataset
+ * @oaram {Accessor} keyAccessor Accessor for the key of the data existent in the stackingResult
+ * @param {Accessor} filter A filter for data to be considered when computing the total extent
+ * @return {[number, number]} The total extent
+ */
+ function stackedExtent(stackingResult: StackingResult, keyAccessor: Accessor, filter: Accessor): number[];
+ /**
+ * Normalizes a key used for stacking
+ *
+ * @param {any} key The key to be normalized
+ * @return {string} The stringified key
+ */
+ function normalizeKey(key: any): string;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ module Window {
+ /**
+ * Print a warning message to the console, if it is available.
+ *
+ * @param {string} The warnings to print
+ */
+ function warn(warning: string): void;
+ /**
+ * Is like setTimeout, but activates synchronously if time=0
+ * We special case 0 because of an observed issue where calling setTimeout causes visible flickering.
+ * We believe this is because when requestAnimationFrame calls into the paint function, as soon as that function finishes
+ * evaluating, the results are painted to the screen. As a result, if we want something to occur immediately but call setTimeout
+ * with time=0, then it is pushed to the call stack and rendered in the next frame, so the component that was rendered via
+ * setTimeout appears out-of-sync with the rest of the plot.
+ */
+ function setTimeout(f: Function, time: number, ...args: any[]): number;
+ /**
+ * Sends a deprecation warning to the console. The warning includes the name of the deprecated method,
+ * version number of the deprecation, and an optional message.
+ *
+ * To be used in the first line of a deprecated method.
+ *
+ * @param {string} callingMethod The name of the method being deprecated
+ * @param {string} version The version when the tagged method became obsolete
+ * @param {string?} message Optional message to be shown with the warning
+ */
+ function deprecated(callingMethod: string, version: string, message?: string): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Utils {
+ class ClientToSVGTranslator {
+ /**
+ * Returns the ClientToSVGTranslator for the containing elem.
+ * If one already exists on that , it will be returned; otherwise, a new one will be created.
+ */
+ static getTranslator(elem: SVGElement): ClientToSVGTranslator;
+ constructor(svg: SVGElement);
+ /**
+ * Computes the position relative to the in svg-coordinate-space.
+ */
+ computePosition(clientX: number, clientY: number): Point;
+ /**
+ * Checks whether event happened inside element.
+ */
+ insideSVG(e: Event): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Configs {
+ /**
+ * Specifies if Plottable should show warnings.
+ */
+ var SHOW_WARNINGS: boolean;
+ }
+}
+
+
+declare module Plottable {
+ var version: string;
+}
+
+
+declare module Plottable {
+ type DatasetCallback = (dataset: Dataset) => void;
+ class Dataset {
+ /**
+ * A Dataset contains an array of data and some metadata.
+ * Changes to the data or metadata will cause anything subscribed to the Dataset to update.
+ *
+ * @constructor
+ * @param {any[]} [data=[]] The data for this Dataset.
+ * @param {any} [metadata={}] An object containing additional information.
+ */
+ constructor(data?: any[], metadata?: any);
+ /**
+ * Adds a callback to be called when the Dataset updates.
+ *
+ * @param {DatasetCallback} callback.
+ * @returns {Dataset} The calling Dataset.
+ */
+ onUpdate(callback: DatasetCallback): Dataset;
+ /**
+ * Removes a callback that would be called when the Dataset updates.
+ *
+ * @param {DatasetCallback} callback
+ * @returns {Dataset} The calling Dataset.
+ */
+ offUpdate(callback: DatasetCallback): Dataset;
+ /**
+ * Gets the data.
+ *
+ * @returns {any[]}
+ */
+ data(): any[];
+ /**
+ * Sets the data.
+ *
+ * @param {any[]} data
+ * @returns {Dataset} The calling Dataset.
+ */
+ data(data: any[]): Dataset;
+ /**
+ * Gets the metadata.
+ *
+ * @returns {any}
+ */
+ metadata(): any;
+ /**
+ * Sets the metadata.
+ *
+ * @param {any} metadata
+ * @returns {Dataset} The calling Dataset.
+ */
+ metadata(metadata: any): Dataset;
+ }
+}
+
+
+declare module Plottable {
+ module RenderPolicies {
+ /**
+ * A policy for rendering Components.
+ */
+ interface RenderPolicy {
+ render(): any;
+ }
+ /**
+ * Renders Components immediately after they are enqueued.
+ * Useful for debugging, horrible for performance.
+ */
+ class Immediate implements RenderPolicy {
+ render(): void;
+ }
+ /**
+ * The default way to render, which only tries to render every frame
+ * (usually, 1/60th of a second).
+ */
+ class AnimationFrame implements RenderPolicy {
+ render(): void;
+ }
+ /**
+ * Renders with `setTimeout()`.
+ * Generally an inferior way to render compared to `requestAnimationFrame`,
+ * but useful for browsers that don't suppoort `requestAnimationFrame`.
+ */
+ class Timeout implements RenderPolicy {
+ render(): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ /**
+ * The RenderController is responsible for enqueueing and synchronizing
+ * layout and render calls for Components.
+ *
+ * Layout and render calls occur inside an animation callback
+ * (window.requestAnimationFrame if available).
+ *
+ * RenderController.flush() immediately lays out and renders all Components currently enqueued.
+ *
+ * To always have immediate rendering (useful for debugging), call
+ * ```typescript
+ * Plottable.RenderController.setRenderPolicy(
+ * new Plottable.RenderPolicies.Immediate()
+ * );
+ * ```
+ */
+ module RenderController {
+ module Policy {
+ var IMMEDIATE: string;
+ var ANIMATION_FRAME: string;
+ var TIMEOUT: string;
+ }
+ function renderPolicy(): RenderPolicies.RenderPolicy;
+ function renderPolicy(renderPolicy: string): void;
+ /**
+ * Enqueues the Component for rendering.
+ *
+ * @param {Component} component
+ */
+ function registerToRender(component: Component): void;
+ /**
+ * Enqueues the Component for layout and rendering.
+ *
+ * @param {Component} component
+ */
+ function registerToComputeLayout(component: Component): void;
+ /**
+ * Renders all Components waiting to be rendered immediately
+ * instead of waiting until the next frame.
+ *
+ * Useful to call when debugging.
+ */
+ function flush(): void;
+ }
+}
+
+declare module Plottable {
+ /**
+ * Accesses a specific datum property.
+ */
+ interface Accessor {
+ (datum: any, index: number, dataset: Dataset): T;
+ }
+ /**
+ * Retrieves a scaled datum property.
+ * Essentially passes the result of an Accessor through a Scale.
+ */
+ type Projector = (datum: any, index: number, dataset: Dataset) => any;
+ /**
+ * A mapping from attributes ("x", "fill", etc.) to the functions that get
+ * that information out of the data.
+ */
+ type AttributeToProjector = {
+ [attr: string]: Projector;
+ };
+ /**
+ * A function that generates attribute values from the datum and index.
+ * Essentially a Projector with a particular Dataset rolled in.
+ */
+ type AppliedProjector = (datum: any, index: number) => any;
+ /**
+ * A mapping from attributes to the AppliedProjectors used to generate them.
+ */
+ type AttributeToAppliedProjector = {
+ [attr: string]: AppliedProjector;
+ };
+ /**
+ * Space request used during layout negotiation.
+ *
+ * @member {number} minWidth The minimum acceptable width given the offered space.
+ * @member {number} minHeight the minimum acceptable height given the offered space.
+ */
+ type SpaceRequest = {
+ minWidth: number;
+ minHeight: number;
+ };
+ /**
+ * Min and max values for a particular property.
+ */
+ type Range = {
+ min: number;
+ max: number;
+ };
+ /**
+ * A location in pixel-space.
+ */
+ type Point = {
+ x: number;
+ y: number;
+ };
+ /**
+ * The corners of a box.
+ */
+ type Bounds = {
+ topLeft: Point;
+ bottomRight: Point;
+ };
+ /**
+ * An object representing a data-backed visual entity inside a Component.
+ */
+ interface Entity {
+ datum: any;
+ position: Point;
+ selection: d3.Selection;
+ component: C;
+ }
+}
+
+
+declare module Plottable {
+ type Formatter = (d: any) => string;
+ var MILLISECONDS_IN_ONE_DAY: number;
+ module Formatters {
+ /**
+ * Creates a formatter for currency values.
+ *
+ * @param {number} [precision] The number of decimal places to show (default 2).
+ * @param {string} [symbol] The currency symbol to use (default "$").
+ * @param {boolean} [prefix] Whether to prepend or append the currency symbol (default true).
+ * @param {boolean} [onlyShowUnchanged] Whether to return a value if value changes after formatting (default true).
+ *
+ * @returns {Formatter} A formatter for currency values.
+ */
+ function currency(precision?: number, symbol?: string, prefix?: boolean): (d: any) => string;
+ /**
+ * Creates a formatter that displays exactly [precision] decimal places.
+ *
+ * @param {number} [precision] The number of decimal places to show (default 3).
+ * @param {boolean} [onlyShowUnchanged] Whether to return a value if value changes after formatting (default true).
+ *
+ * @returns {Formatter} A formatter that displays exactly [precision] decimal places.
+ */
+ function fixed(precision?: number): (d: any) => string;
+ /**
+ * Creates a formatter that formats numbers to show no more than
+ * [precision] decimal places. All other values are stringified.
+ *
+ * @param {number} [precision] The number of decimal places to show (default 3).
+ * @param {boolean} [onlyShowUnchanged] Whether to return a value if value changes after formatting (default true).
+ *
+ * @returns {Formatter} A formatter for general values.
+ */
+ function general(precision?: number): (d: any) => string;
+ /**
+ * Creates a formatter that stringifies its input.
+ *
+ * @returns {Formatter} A formatter that stringifies its input.
+ */
+ function identity(): (d: any) => string;
+ /**
+ * Creates a formatter for percentage values.
+ * Multiplies the input by 100 and appends "%".
+ *
+ * @param {number} [precision] The number of decimal places to show (default 0).
+ * @param {boolean} [onlyShowUnchanged] Whether to return a value if value changes after formatting (default true).
+ *
+ * @returns {Formatter} A formatter for percentage values.
+ */
+ function percentage(precision?: number): (d: any) => string;
+ /**
+ * Creates a formatter for values that displays [precision] significant figures
+ * and puts SI notation.
+ *
+ * @param {number} [precision] The number of significant figures to show (default 3).
+ *
+ * @returns {Formatter} A formatter for SI values.
+ */
+ function siSuffix(precision?: number): (d: any) => string;
+ /**
+ * Creates a multi time formatter that displays dates.
+ *
+ * @returns {Formatter} A formatter for time/date values.
+ */
+ function multiTime(): (d: any) => string;
+ /**
+ * Creates a time formatter that displays time/date using given specifier.
+ *
+ * List of directives can be found on: https://github.com/mbostock/d3/wiki/Time-Formatting#format
+ *
+ * @param {string} [specifier] The specifier for the formatter.
+ *
+ * @returns {Formatter} A formatter for time/date values.
+ */
+ function time(specifier: string): Formatter;
+ /**
+ * Creates a formatter for relative dates.
+ *
+ * @param {number} baseValue The start date (as epoch time) used in computing relative dates (default 0)
+ * @param {number} increment The unit used in calculating relative date values (default MILLISECONDS_IN_ONE_DAY)
+ * @param {string} label The label to append to the formatted string (default "")
+ *
+ * @returns {Formatter} A formatter for time/date values.
+ */
+ function relativeDate(baseValue?: number, increment?: number, label?: string): (d: any) => string;
+ }
+}
+
+
+declare module Plottable {
+ /**
+ * A SymbolFactory is a function that takes in a symbolSize which is the edge length of the render area
+ * and returns a string representing the 'd' attribute of the resultant 'path' element
+ */
+ type SymbolFactory = (symbolSize: number) => string;
+ module SymbolFactories {
+ function circle(): SymbolFactory;
+ function square(): SymbolFactory;
+ function cross(): SymbolFactory;
+ function diamond(): SymbolFactory;
+ function triangleUp(): SymbolFactory;
+ function triangleDown(): SymbolFactory;
+ }
+}
+
+
+declare module Plottable {
+ interface ScaleCallback> {
+ (scale: S): any;
+ }
+ module Scales {
+ /**
+ * A function that supplies domain values to be included into a Scale.
+ *
+ * @param {Scale} scale
+ * @returns {D[]} An array of values that should be included in the Scale.
+ */
+ interface IncludedValuesProvider {
+ (scale: Scale): D[];
+ }
+ /**
+ * A function that supplies padding exception values for the Scale.
+ * If one end of the domain is set to an excepted value as a result of autoDomain()-ing,
+ * that end of the domain will not be padded.
+ *
+ * @param {QuantitativeScale} scale
+ * @returns {D[]} An array of values that should not be padded.
+ */
+ interface PaddingExceptionsProvider {
+ (scale: QuantitativeScale): D[];
+ }
+ }
+ class Scale {
+ /**
+ * A Scale is a function (in the mathematical sense) that maps values from a domain to a range.
+ *
+ * @constructor
+ */
+ constructor();
+ /**
+ * Given an array of potential domain values, computes the extent of those values.
+ *
+ * @param {D[]} values
+ * @returns {D[]} The extent of the input values.
+ */
+ extentOfValues(values: D[]): D[];
+ protected _getAllIncludedValues(): D[];
+ protected _getExtent(): D[];
+ /**
+ * Adds a callback to be called when the Scale updates.
+ *
+ * @param {ScaleCallback} callback.
+ * @returns {Scale} The calling Scale.
+ */
+ onUpdate(callback: ScaleCallback>): Scale;
+ /**
+ * Removes a callback that would be called when the Scale updates.
+ *
+ * @param {ScaleCallback} callback.
+ * @returns {Scale} The calling Scale.
+ */
+ offUpdate(callback: ScaleCallback>): Scale;
+ protected _dispatchUpdate(): void;
+ /**
+ * Sets the Scale's domain so that it spans the Extents of all its ExtentsProviders.
+ *
+ * @returns {Scale} The calling Scale.
+ */
+ autoDomain(): Scale;
+ protected _autoDomainIfAutomaticMode(): void;
+ /**
+ * Computes the range value corresponding to a given domain value.
+ *
+ * @param {D} value
+ * @returns {R} The range value corresponding to the supplied domain value.
+ */
+ scale(value: D): R;
+ /**
+ * Gets the domain.
+ *
+ * @returns {D[]} The current domain.
+ */
+ domain(): D[];
+ /**
+ * Sets the domain.
+ *
+ * @param {D[]} values
+ * @returns {Scale} The calling Scale.
+ */
+ domain(values: D[]): Scale;
+ protected _getDomain(): void;
+ protected _setDomain(values: D[]): void;
+ protected _setBackingScaleDomain(values: D[]): void;
+ /**
+ * Gets the range.
+ *
+ * @returns {R[]} The current range.
+ */
+ range(): R[];
+ /**
+ * Sets the range.
+ *
+ * @param {R[]} values
+ * @returns {Scale} The calling Scale.
+ */
+ range(values: R[]): Scale;
+ protected _getRange(): void;
+ protected _setRange(values: R[]): void;
+ /**
+ * Adds an IncludedValuesProvider to the Scale.
+ *
+ * @param {Scales.IncludedValuesProvider} provider
+ * @returns {Scale} The calling Scale.
+ */
+ addIncludedValuesProvider(provider: Scales.IncludedValuesProvider): Scale;
+ /**
+ * Removes the IncludedValuesProvider from the Scale.
+ *
+ * @param {Scales.IncludedValuesProvider} provider
+ * @returns {Scale} The calling Scale.
+ */
+ removeIncludedValuesProvider(provider: Scales.IncludedValuesProvider): Scale;
+ }
+}
+
+
+declare module Plottable {
+ class QuantitativeScale extends Scale {
+ protected static _DEFAULT_NUM_TICKS: number;
+ /**
+ * A QuantitativeScale is a Scale that maps number-like values to numbers.
+ * It is invertible and continuous.
+ *
+ * @constructor
+ */
+ constructor();
+ autoDomain(): QuantitativeScale;
+ protected _autoDomainIfAutomaticMode(): void;
+ protected _getExtent(): D[];
+ /**
+ * Adds a padding exception provider.
+ * If one end of the domain is set to an excepted value as a result of autoDomain()-ing,
+ * that end of the domain will not be padded.
+ *
+ * @param {Scales.PaddingExceptionProvider} provider The provider function.
+ * @returns {QuantitativeScale} The calling QuantitativeScale.
+ */
+ addPaddingExceptionsProvider(provider: Scales.PaddingExceptionsProvider): QuantitativeScale;
+ /**
+ * Removes the padding exception provider.
+ *
+ * @param {Scales.PaddingExceptionProvider} provider The provider function.
+ * @returns {QuantitativeScale} The calling QuantitativeScale.
+ */
+ removePaddingExceptionsProvider(provider: Scales.PaddingExceptionsProvider): QuantitativeScale;
+ /**
+ * Gets the padding proportion.
+ */
+ padProportion(): number;
+ /**
+ * Sets the padding porportion.
+ * When autoDomain()-ing, the computed domain will be expanded by this proportion,
+ * then rounded to human-readable values.
+ *
+ * @param {number} padProportion The padding proportion. Passing 0 disables padding.
+ * @returns {QuantitativeScale} The calling QuantitativeScale.
+ */
+ padProportion(padProportion: number): QuantitativeScale;
+ protected _expandSingleValueDomain(singleValueDomain: D[]): D[];
+ /**
+ * Computes the domain value corresponding to a supplied range value.
+ *
+ * @param {number} value: A value from the Scale's range.
+ * @returns {D} The domain value corresponding to the supplied range value.
+ */
+ invert(value: number): D;
+ domain(): D[];
+ domain(values: D[]): QuantitativeScale;
+ /**
+ * Gets the lower end of the domain.
+ *
+ * @return {D}
+ */
+ domainMin(): D;
+ /**
+ * Sets the lower end of the domain.
+ *
+ * @return {QuantitativeScale} The calling QuantitativeScale.
+ */
+ domainMin(domainMin: D): QuantitativeScale;
+ /**
+ * Gets the upper end of the domain.
+ *
+ * @return {D}
+ */
+ domainMax(): D;
+ /**
+ * Sets the upper end of the domain.
+ *
+ * @return {QuantitativeScale} The calling QuantitativeScale.
+ */
+ domainMax(domainMax: D): QuantitativeScale;
+ extentOfValues(values: D[]): D[];
+ protected _setDomain(values: D[]): void;
+ /**
+ * Gets the array of tick values generated by the default algorithm.
+ */
+ defaultTicks(): D[];
+ /**
+ * Gets an array of tick values spanning the domain.
+ *
+ * @returns {D[]}
+ */
+ ticks(): D[];
+ /**
+ * Given a domain, expands its domain onto "nice" values, e.g. whole
+ * numbers.
+ */
+ protected _niceDomain(domain: D[], count?: number): D[];
+ protected _defaultExtent(): D[];
+ /**
+ * Gets the TickGenerator.
+ */
+ tickGenerator(): Scales.TickGenerators.TickGenerator;
+ /**
+ * Sets the TickGenerator
+ *
+ * @param {TickGenerator} generator
+ * @return {QuantitativeScale} The calling QuantitativeScale.
+ */
+ tickGenerator(generator: Scales.TickGenerators.TickGenerator): QuantitativeScale;
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class Linear extends QuantitativeScale {
+ /**
+ * @constructor
+ */
+ constructor();
+ protected _defaultExtent(): number[];
+ protected _expandSingleValueDomain(singleValueDomain: number[]): number[];
+ scale(value: number): number;
+ protected _getDomain(): number[];
+ protected _setBackingScaleDomain(values: number[]): void;
+ protected _getRange(): number[];
+ protected _setRange(values: number[]): void;
+ invert(value: number): number;
+ defaultTicks(): number[];
+ protected _niceDomain(domain: number[], count?: number): number[];
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class ModifiedLog extends QuantitativeScale {
+ /**
+ * A ModifiedLog Scale acts as a regular log scale for large numbers.
+ * As it approaches 0, it gradually becomes linear.
+ * Consequently, a ModifiedLog Scale can process 0 and negative numbers.
+ *
+ * @constructor
+ * @param {number} [base=10]
+ * The base of the log. Must be > 1.
+ *
+ * For x <= base, scale(x) = log(x).
+ *
+ * For 0 < x < base, scale(x) will become more and more
+ * linear as it approaches 0.
+ *
+ * At x == 0, scale(x) == 0.
+ *
+ * For negative values, scale(-x) = -scale(x).
+ */
+ constructor(base?: number);
+ scale(x: number): number;
+ invert(x: number): number;
+ protected _getDomain(): number[];
+ protected _setDomain(values: number[]): void;
+ protected _setBackingScaleDomain(values: number[]): void;
+ ticks(): number[];
+ protected _niceDomain(domain: number[], count?: number): number[];
+ protected _defaultExtent(): number[];
+ protected _expandSingleValueDomain(singleValueDomain: number[]): number[];
+ protected _getRange(): number[];
+ protected _setRange(values: number[]): void;
+ defaultTicks(): number[];
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class Category extends Scale {
+ /**
+ * A Category Scale maps strings to numbers.
+ *
+ * @constructor
+ */
+ constructor();
+ extentOfValues(values: string[]): string[];
+ protected _getExtent(): string[];
+ domain(): string[];
+ domain(values: string[]): Category;
+ protected _setDomain(values: string[]): void;
+ range(): [number, number];
+ range(values: [number, number]): Category;
+ /**
+ * Returns the width of the range band.
+ *
+ * @returns {number} The range band width
+ */
+ rangeBand(): number;
+ /**
+ * Returns the step width of the scale.
+ *
+ * The step width is the pixel distance between adjacent values in the domain.
+ *
+ * @returns {number}
+ */
+ stepWidth(): number;
+ /**
+ * Gets the inner padding.
+ *
+ * The inner padding is defined as the padding in between bands on the scale,
+ * expressed as a multiple of the rangeBand().
+ *
+ * @returns {number}
+ */
+ innerPadding(): number;
+ /**
+ * Sets the inner padding.
+ *
+ * The inner padding is defined as the padding in between bands on the scale,
+ * expressed as a multiple of the rangeBand().
+ *
+ * @returns {Category} The calling Category Scale.
+ */
+ innerPadding(innerPadding: number): Category;
+ /**
+ * Gets the outer padding.
+ *
+ * The outer padding is the padding in between the outer bands and the edges of the range,
+ * expressed as a multiple of the rangeBand().
+ *
+ * @returns {number}
+ */
+ outerPadding(): number;
+ /**
+ * Sets the outer padding.
+ *
+ * The outer padding is the padding in between the outer bands and the edges of the range,
+ * expressed as a multiple of the rangeBand().
+ *
+ * @returns {Category} The calling Category Scale.
+ */
+ outerPadding(outerPadding: number): Category;
+ scale(value: string): number;
+ protected _getDomain(): string[];
+ protected _setBackingScaleDomain(values: string[]): void;
+ protected _getRange(): number[];
+ protected _setRange(values: number[]): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class Color extends Scale {
+ /**
+ * A Color Scale maps string values to color hex values expressed as a string.
+ *
+ * @constructor
+ * @param {string} [scaleType] One of "Category10"/"Category20"/"Category20b"/"Category20c".
+ * (see https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors)
+ * If not supplied, reads the colors defined using CSS -- see plottable.css.
+ */
+ constructor(scaleType?: string);
+ extentOfValues(values: string[]): string[];
+ protected _getExtent(): string[];
+ /**
+ * Returns the color-string corresponding to a given string.
+ * If there are not enough colors in the range(), a lightened version of an existing color will be used.
+ *
+ * @param {string} value
+ * @returns {string}
+ */
+ scale(value: string): string;
+ protected _getDomain(): string[];
+ protected _setBackingScaleDomain(values: string[]): void;
+ protected _getRange(): string[];
+ protected _setRange(values: string[]): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class Time extends QuantitativeScale {
+ /**
+ * A Time Scale maps Date objects to numbers.
+ *
+ * @constructor
+ */
+ constructor();
+ /**
+ * Returns an array of ticks values separated by the specified interval.
+ *
+ * @param {string} interval A string specifying the interval unit.
+ * @param {number?} [step] The number of multiples of the interval between consecutive ticks.
+ * @return {Date[]}
+ */
+ tickInterval(interval: string, step?: number): Date[];
+ protected _setDomain(values: Date[]): void;
+ protected _defaultExtent(): Date[];
+ protected _expandSingleValueDomain(singleValueDomain: Date[]): Date[];
+ scale(value: Date): number;
+ protected _getDomain(): Date[];
+ protected _setBackingScaleDomain(values: Date[]): void;
+ protected _getRange(): number[];
+ protected _setRange(values: number[]): void;
+ invert(value: number): Date;
+ defaultTicks(): Date[];
+ protected _niceDomain(domain: Date[]): Date[];
+ /**
+ * Transforms the Plottable TimeInterval string into a d3 time interval equivalent.
+ * If the provided TimeInterval is incorrect, the default is d3.time.year
+ */
+ static timeIntervalToD3Time(timeInterval: string): d3.time.Interval;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ class InterpolatedColor extends Scale {
+ static REDS: string[];
+ static BLUES: string[];
+ static POSNEG: string[];
+ /**
+ * An InterpolatedColor Scale maps numbers to color hex values, expressed as strings.
+ *
+ * @param {string} [scaleType="linear"] One of "linear"/"log"/"sqrt"/"pow".
+ */
+ constructor(scaleType?: string);
+ extentOfValues(values: number[]): number[];
+ autoDomain(): InterpolatedColor;
+ scale(value: number): string;
+ protected _getDomain(): number[];
+ protected _setBackingScaleDomain(values: number[]): void;
+ protected _getRange(): string[];
+ protected _setRange(range: string[]): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Scales {
+ module TickGenerators {
+ /**
+ * Generates an array of tick values for the specified scale.
+ *
+ * @param {QuantitativeScale} scale
+ * @returns {D[]}
+ */
+ interface TickGenerator {
+ (scale: Plottable.QuantitativeScale): D[];
+ }
+ /**
+ * Creates a TickGenerator using the specified interval.
+ *
+ * Generates ticks at multiples of the interval while also including the domain boundaries.
+ *
+ * @param {number} interval
+ * @returns {TickGenerator}
+ */
+ function intervalTickGenerator(interval: number): TickGenerator;
+ /**
+ * Creates a TickGenerator returns only integer tick values.
+ *
+ * @returns {TickGenerator}
+ */
+ function integerTickGenerator(): TickGenerator;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ /**
+ * A step for the drawer to draw.
+ *
+ * Specifies how AttributeToProjector needs to be animated.
+ */
+ type DrawStep = {
+ attrToProjector: AttributeToProjector;
+ animator: Animator;
+ };
+ /**
+ * A DrawStep that carries an AttributeToAppliedProjector map.
+ */
+ type AppliedDrawStep = {
+ attrToAppliedProjector: AttributeToAppliedProjector;
+ animator: Animator;
+ };
+ }
+ class Drawer {
+ protected _svgElementName: string;
+ protected _className: string;
+ /**
+ * A Drawer draws svg elements based on the input Dataset.
+ *
+ * @constructor
+ * @param {Dataset} dataset The dataset associated with this Drawer
+ */
+ constructor(dataset: Dataset);
+ /**
+ * Retrieves the renderArea selection for the Drawer.
+ */
+ renderArea(): d3.Selection;
+ /**
+ * Sets the renderArea selection for the Drawer.
+ *
+ * @param {d3.Selection} Selection containing the to render to.
+ * @returns {Drawer} The calling Drawer.
+ */
+ renderArea(area: d3.Selection): Drawer;
+ /**
+ * Removes the Drawer and its renderArea
+ */
+ remove(): void;
+ protected _applyDefaultAttributes(selection: d3.Selection): void;
+ /**
+ * Calculates the total time it takes to use the input drawSteps to draw the input data
+ *
+ * @param {any[]} data The data that would have been drawn
+ * @param {Drawers.DrawStep[]} drawSteps The DrawSteps to use
+ * @returns {number} The total time it takes to draw
+ */
+ totalDrawTime(data: any[], drawSteps: Drawers.DrawStep[]): number;
+ /**
+ * Draws the data into the renderArea using the spefic steps and metadata
+ *
+ * @param{any[]} data The data to be drawn
+ * @param{DrawStep[]} drawSteps The list of steps, which needs to be drawn
+ */
+ draw(data: any[], drawSteps: Drawers.DrawStep[]): Drawer;
+ selection(): d3.Selection;
+ /**
+ * Returns the CSS selector for this Drawer's visual elements.
+ */
+ selector(): string;
+ /**
+ * Returns the D3 selection corresponding to the datum with the specified index.
+ */
+ selectionForIndex(index: number): d3.Selection;
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Line extends Drawer {
+ constructor(dataset: Dataset);
+ protected _applyDefaultAttributes(selection: d3.Selection): void;
+ selectionForIndex(index: number): d3.Selection;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Area extends Drawer {
+ constructor(dataset: Dataset);
+ protected _applyDefaultAttributes(selection: d3.Selection): void;
+ selectionForIndex(index: number): d3.Selection;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Rectangle extends Drawer {
+ constructor(dataset: Dataset);
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Arc extends Drawer {
+ constructor(dataset: Dataset);
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Symbol extends Drawer {
+ constructor(dataset: Dataset);
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Drawers {
+ class Segment extends Drawer {
+ constructor(dataset: Dataset);
+ }
+ }
+}
+
+
+declare module Plottable {
+ type ComponentCallback = (component: Component) => void;
+ module Components {
+ class Alignment {
+ static TOP: string;
+ static BOTTOM: string;
+ static LEFT: string;
+ static RIGHT: string;
+ static CENTER: string;
+ }
+ }
+ class Component {
+ protected _boundingBox: d3.Selection;
+ protected _clipPathEnabled: boolean;
+ protected _isSetup: boolean;
+ protected _isAnchored: boolean;
+ constructor();
+ /**
+ * Attaches the Component as a child of a given d3 Selection.
+ *
+ * @param {d3.Selection} selection.
+ * @returns {Component} The calling Component.
+ */
+ anchor(selection: d3.Selection): Component;
+ /**
+ * Adds a callback to be called on anchoring the Component to the DOM.
+ * If the Component is already anchored, the callback is called immediately.
+ *
+ * @param {ComponentCallback} callback
+ * @return {Component}
+ */
+ onAnchor(callback: ComponentCallback): Component;
+ /**
+ * Removes a callback that would be called on anchoring the Component to the DOM.
+ * The callback is identified by reference equality.
+ *
+ * @param {ComponentCallback} callback
+ * @return {Component}
+ */
+ offAnchor(callback: ComponentCallback): Component;
+ /**
+ * Creates additional elements as necessary for the Component to function.
+ * Called during anchor() if the Component's element has not been created yet.
+ * Override in subclasses to provide additional functionality.
+ */
+ protected _setup(): void;
+ /**
+ * Given available space in pixels, returns the minimum width and height this Component will need.
+ *
+ * @param {number} availableWidth
+ * @param {number} availableHeight
+ * @returns {SpaceRequest}
+ */
+ requestedSpace(availableWidth: number, availableHeight: number): SpaceRequest;
+ /**
+ * Computes and sets the size, position, and alignment of the Component from the specified values.
+ * If no parameters are supplied and the Component is a root node,
+ * they are inferred from the size of the Component's element.
+ *
+ * @param {Point} [origin] Origin of the space offered to the Component.
+ * @param {number} [availableWidth] Available width in pixels.
+ * @param {number} [availableHeight] Available height in pixels.
+ * @returns {Component} The calling Component.
+ */
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Component;
+ protected _sizeFromOffer(availableWidth: number, availableHeight: number): {
+ width: number;
+ height: number;
+ };
+ /**
+ * Queues the Component for rendering.
+ *
+ * @returns {Component} The calling Component.
+ */
+ render(): Component;
+ /**
+ * Renders the Component without waiting for the next frame.
+ */
+ renderImmediately(): Component;
+ /**
+ * Causes the Component to re-layout and render.
+ *
+ * This function should be called when a CSS change has occured that could
+ * influence the layout of the Component, such as changing the font size.
+ *
+ * @returns {Component} The calling Component.
+ */
+ redraw(): Component;
+ /**
+ * Renders the Component to a given .
+ *
+ * @param {String|d3.Selection} element A selector-string for the , or a d3 selection containing an .
+ * @returns {Component} The calling Component.
+ */
+ renderTo(element: String | d3.Selection): Component;
+ /**
+ * Gets the x alignment of the Component.
+ */
+ xAlignment(): string;
+ /**
+ * Sets the x alignment of the Component.
+ *
+ * @param {string} xAlignment The x alignment of the Component ("left"/"center"/"right").
+ * @returns {Component} The calling Component.
+ */
+ xAlignment(xAlignment: string): Component;
+ /**
+ * Gets the y alignment of the Component.
+ */
+ yAlignment(): string;
+ /**
+ * Sets the y alignment of the Component.
+ *
+ * @param {string} yAlignment The y alignment of the Component ("top"/"center"/"bottom").
+ * @returns {Component} The calling Component.
+ */
+ yAlignment(yAlignment: string): Component;
+ /**
+ * Checks if the Component has a given CSS class.
+ *
+ * @param {string} cssClass The CSS class to check for.
+ */
+ hasClass(cssClass: string): boolean;
+ /**
+ * Adds a given CSS class to the Component.
+ *
+ * @param {string} cssClass The CSS class to add.
+ * @returns {Component} The calling Component.
+ */
+ addClass(cssClass: string): Component;
+ /**
+ * Removes a given CSS class from the Component.
+ *
+ * @param {string} cssClass The CSS class to remove.
+ * @returns {Component} The calling Component.
+ */
+ removeClass(cssClass: string): Component;
+ /**
+ * Checks if the Component has a fixed width or if it grows to fill available space.
+ * Returns false by default on the base Component class.
+ */
+ fixedWidth(): boolean;
+ /**
+ * Checks if the Component has a fixed height or if it grows to fill available space.
+ * Returns false by default on the base Component class.
+ */
+ fixedHeight(): boolean;
+ /**
+ * Detaches a Component from the DOM. The Component can be reused.
+ *
+ * This should only be used if you plan on reusing the calling Component. Otherwise, use destroy().
+ *
+ * @returns The calling Component.
+ */
+ detach(): Component;
+ /**
+ * Adds a callback to be called when the Component is detach()-ed.
+ *
+ * @param {ComponentCallback} callback
+ * @return {Component} The calling Component.
+ */
+ onDetach(callback: ComponentCallback): Component;
+ /**
+ * Removes a callback to be called when the Component is detach()-ed.
+ * The callback is identified by reference equality.
+ *
+ * @param {ComponentCallback} callback
+ * @return {Component} The calling Component.
+ */
+ offDetach(callback: ComponentCallback): Component;
+ /**
+ * Gets the parent ComponentContainer for this Component.
+ */
+ parent(): ComponentContainer;
+ /**
+ * Sets the parent ComponentContainer for this Component.
+ * An error will be thrown if the parent does not contain this Component.
+ * Adding a Component to a ComponentContainer should be done
+ * using the appropriate method on the ComponentContainer.
+ */
+ parent(parent: ComponentContainer): Component;
+ /**
+ * Removes a Component from the DOM and disconnects all listeners.
+ */
+ destroy(): void;
+ /**
+ * Gets the width of the Component in pixels.
+ */
+ width(): number;
+ /**
+ * Gets the height of the Component in pixels.
+ */
+ height(): number;
+ /**
+ * Gets the origin of the Component relative to its parent.
+ *
+ * @return {Point}
+ */
+ origin(): Point;
+ /**
+ * Gets the origin of the Component relative to the root .
+ *
+ * @return {Point}
+ */
+ originToSVG(): Point;
+ /**
+ * Gets the Selection containing the in front of the visual elements of the Component.
+ *
+ * Will return undefined if the Component has not been anchored.
+ *
+ * @return {d3.Selection}
+ */
+ foreground(): d3.Selection;
+ /**
+ * Gets a Selection containing a that holds the visual elements of the Component.
+ *
+ * Will return undefined if the Component has not been anchored.
+ *
+ * @return {d3.Selection} content selection for the Component
+ */
+ content(): d3.Selection;
+ /**
+ * Gets the Selection containing the behind the visual elements of the Component.
+ *
+ * Will return undefined if the Component has not been anchored.
+ *
+ * @return {d3.Selection} background selection for the Component
+ */
+ background(): d3.Selection;
+ }
+}
+
+
+declare module Plottable {
+ class ComponentContainer extends Component {
+ constructor();
+ anchor(selection: d3.Selection): ComponentContainer;
+ render(): ComponentContainer;
+ /**
+ * Checks whether the specified Component is in the ComponentContainer.
+ */
+ has(component: Component): boolean;
+ protected _adoptAndAnchor(component: Component): void;
+ /**
+ * Removes the specified Component from the ComponentContainer.
+ */
+ remove(component: Component): ComponentContainer;
+ /**
+ * Carry out the actual removal of a Component.
+ * Implementation dependent on the type of container.
+ *
+ * @return {boolean} true if the Component was successfully removed, false otherwise.
+ */
+ protected _remove(component: Component): boolean;
+ /**
+ * Invokes a callback on each Component in the ComponentContainer.
+ */
+ protected _forEach(callback: (component: Component) => void): void;
+ /**
+ * Destroys the ComponentContainer and all Components within it.
+ */
+ destroy(): void;
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class Group extends ComponentContainer {
+ /**
+ * Constructs a Group.
+ *
+ * A Group contains Components that will be rendered on top of each other.
+ * Components added later will be rendered above Components already in the Group.
+ *
+ * @constructor
+ * @param {Component[]} [components=[]] Components to be added to the Group.
+ */
+ constructor(components?: Component[]);
+ protected _forEach(callback: (component: Component) => any): void;
+ /**
+ * Checks whether the specified Component is in the Group.
+ */
+ has(component: Component): boolean;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Group;
+ protected _sizeFromOffer(availableWidth: number, availableHeight: number): {
+ width: number;
+ height: number;
+ };
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ /**
+ * @return {Component[]} The Components in this Group.
+ */
+ components(): Component[];
+ /**
+ * Adds a Component to this Group.
+ * The added Component will be rendered above Components already in the Group.
+ */
+ append(component: Component): Group;
+ protected _remove(component: Component): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ class Axis extends Component {
+ /**
+ * The css class applied to each end tick mark (the line on the end tick).
+ */
+ static END_TICK_MARK_CLASS: string;
+ /**
+ * The css class applied to each tick mark (the line on the tick).
+ */
+ static TICK_MARK_CLASS: string;
+ /**
+ * The css class applied to each tick label (the text associated with the tick).
+ */
+ static TICK_LABEL_CLASS: string;
+ protected _tickMarkContainer: d3.Selection;
+ protected _tickLabelContainer: d3.Selection;
+ protected _baseline: d3.Selection;
+ protected _scale: Scale;
+ protected _computedWidth: number;
+ protected _computedHeight: number;
+ /**
+ * Constructs an Axis.
+ * An Axis is a visual representation of a Scale.
+ *
+ * @constructor
+ * @param {Scale} scale
+ * @param {string} orientation One of "top"/"bottom"/"left"/"right".
+ */
+ constructor(scale: Scale, orientation: string);
+ destroy(): void;
+ protected _isHorizontal(): boolean;
+ protected _computeWidth(): number;
+ protected _computeHeight(): number;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ fixedHeight(): boolean;
+ fixedWidth(): boolean;
+ protected _rescale(): void;
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Axis;
+ protected _setup(): void;
+ protected _getTickValues(): D[];
+ renderImmediately(): Axis;
+ protected _generateBaselineAttrHash(): {
+ [key: string]: number;
+ };
+ protected _generateTickMarkAttrHash(isEndTickMark?: boolean): {
+ [key: string]: number | ((d: any) => number);
+ };
+ redraw(): Component;
+ protected _setDefaultAlignment(): void;
+ /**
+ * Gets the Formatter on the Axis. Tick values are passed through the
+ * Formatter before being displayed.
+ */
+ formatter(): Formatter;
+ /**
+ * Sets the Formatter on the Axis. Tick values are passed through the
+ * Formatter before being displayed.
+ *
+ * @param {Formatter} formatter
+ * @returns {Axis} The calling Axis.
+ */
+ formatter(formatter: Formatter): Axis;
+ /**
+ * Gets the tick mark length in pixels.
+ */
+ tickLength(): number;
+ /**
+ * Sets the tick mark length in pixels.
+ *
+ * @param {number} length
+ * @returns {Axis} The calling Axis.
+ */
+ tickLength(length: number): Axis;
+ /**
+ * Gets the end tick mark length in pixels.
+ */
+ endTickLength(): number;
+ /**
+ * Sets the end tick mark length in pixels.
+ *
+ * @param {number} length
+ * @returns {Axis} The calling Axis.
+ */
+ endTickLength(length: number): Axis;
+ protected _maxLabelTickLength(): number;
+ /**
+ * Gets the padding between each tick mark and its associated label in pixels.
+ */
+ tickLabelPadding(): number;
+ /**
+ * Sets the padding between each tick mark and its associated label in pixels.
+ *
+ * @param {number} padding
+ * @returns {Axis} The calling Axis.
+ */
+ tickLabelPadding(padding: number): Axis;
+ /**
+ * Gets the margin in pixels.
+ * The margin is the amount of space between the tick labels and the outer edge of the Axis.
+ */
+ margin(): number;
+ /**
+ * Sets the margin in pixels.
+ * The margin is the amount of space between the tick labels and the outer edge of the Axis.
+ *
+ * @param {number} size
+ * @returns {Axis} The calling Axis.
+ */
+ margin(size: number): Axis;
+ /**
+ * Gets the orientation of the Axis.
+ */
+ orientation(): string;
+ /**
+ * Sets the orientation of the Axis.
+ *
+ * @param {number} orientation One of "top"/"bottom"/"left"/"right".
+ * @returns {Axis} The calling Axis.
+ */
+ orientation(orientation: string): Axis;
+ /**
+ * Gets whether the Axis shows the end tick labels.
+ */
+ showEndTickLabels(): boolean;
+ /**
+ * Sets whether the Axis shows the end tick labels.
+ *
+ * @param {boolean} show
+ * @returns {Axis} The calling Axis.
+ */
+ showEndTickLabels(show: boolean): Axis;
+ }
+}
+
+
+declare module Plottable {
+ module TimeInterval {
+ var second: string;
+ var minute: string;
+ var hour: string;
+ var day: string;
+ var week: string;
+ var month: string;
+ var year: string;
+ }
+ module Axes {
+ /**
+ * Defines a configuration for a Time Axis tier.
+ * For details on how ticks are generated see: https://github.com/mbostock/d3/wiki/Time-Scales#ticks
+ * interval - A time unit associated with this configuration (seconds, minutes, hours, etc).
+ * step - number of intervals between each tick.
+ * formatter - formatter used to format tick labels.
+ */
+ type TimeAxisTierConfiguration = {
+ interval: string;
+ step: number;
+ formatter: Formatter;
+ };
+ /**
+ * An array of linked TimeAxisTierConfigurations.
+ * Each configuration will be shown on a different tier.
+ * Currently, up to two tiers are supported.
+ */
+ type TimeAxisConfiguration = TimeAxisTierConfiguration[];
+ class Time extends Axis {
+ /**
+ * The CSS class applied to each Time Axis tier
+ */
+ static TIME_AXIS_TIER_CLASS: string;
+ /**
+ * Constructs a Time Axis.
+ *
+ * A Time Axis is a visual representation of a Time Scale.
+ *
+ * @constructor
+ * @param {Scales.Time} scale
+ * @param {string} orientation One of "top"/"bottom".
+ */
+ constructor(scale: Scales.Time, orientation: string);
+ /**
+ * Gets the label positions for each tier.
+ */
+ tierLabelPositions(): string[];
+ /**
+ * Sets the label positions for each tier.
+ *
+ * @param {string[]} newPositions The positions for each tier. "bottom" and "center" are the only supported values.
+ * @returns {Axes.Time} The calling Time Axis.
+ */
+ tierLabelPositions(newPositions: string[]): Time;
+ /**
+ * Gets the possible TimeAxisConfigurations.
+ */
+ axisConfigurations(): TimeAxisConfiguration[];
+ /**
+ * Sets the possible TimeAxisConfigurations.
+ * The Time Axis will choose the most precise configuration that will display in the available space.
+ *
+ * @param {TimeAxisConfiguration[]} configurations
+ * @returns {Axes.Time} The calling Time Axis.
+ */
+ axisConfigurations(configurations: TimeAxisConfiguration[]): Time;
+ orientation(): string;
+ orientation(orientation: string): Time;
+ protected _computeHeight(): number;
+ protected _sizeFromOffer(availableWidth: number, availableHeight: number): {
+ width: number;
+ height: number;
+ };
+ protected _setup(): void;
+ protected _getTickValues(): any[];
+ renderImmediately(): Time;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Axes {
+ class Numeric extends Axis {
+ /**
+ * Constructs a Numeric Axis.
+ *
+ * A Numeric Axis is a visual representation of a QuantitativeScale.
+ *
+ * @constructor
+ * @param {QuantitativeScale} scale
+ * @param {string} orientation One of "top"/"bottom"/"left"/"right".
+ */
+ constructor(scale: QuantitativeScale, orientation: string);
+ protected _setup(): void;
+ protected _computeWidth(): number;
+ protected _computeHeight(): number;
+ protected _getTickValues(): number[];
+ protected _rescale(): void;
+ renderImmediately(): Numeric;
+ /**
+ * Gets the tick label position relative to the tick marks.
+ *
+ * @returns {string} The current tick label position.
+ */
+ tickLabelPosition(): string;
+ /**
+ * Sets the tick label position relative to the tick marks.
+ *
+ * @param {string} position "top"/"center"/"bottom" for a vertical Numeric Axis,
+ * "left"/"center"/"right" for a horizontal Numeric Axis.
+ * @returns {Numeric} The calling Numeric Axis.
+ */
+ tickLabelPosition(position: string): Numeric;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Axes {
+ class Category extends Axis {
+ /**
+ * Constructs a Category Axis.
+ *
+ * A Category Axis is a visual representation of a Category Scale.
+ *
+ * @constructor
+ * @param {Scales.Category} scale
+ * @param {string} [orientation="bottom"] One of "top"/"bottom"/"left"/"right".
+ */
+ constructor(scale: Scales.Category, orientation: string);
+ protected _setup(): void;
+ protected _rescale(): Component;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ protected _getTickValues(): string[];
+ /**
+ * Gets the tick label angle in degrees.
+ */
+ tickLabelAngle(): number;
+ /**
+ * Sets the tick label angle in degrees.
+ * Right now only -90/0/90 are supported. 0 is horizontal.
+ *
+ * @param {number} angle
+ * @returns {Category} The calling Category Axis.
+ */
+ tickLabelAngle(angle: number): Category;
+ renderImmediately(): Category;
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Axis;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class Label extends Component {
+ /**
+ * A Label is a Component that displays a single line of text.
+ *
+ * @constructor
+ * @param {string} [displayText=""] The text of the Label.
+ * @param {number} [angle=0] The angle of the Label in degrees (-90/0/90). 0 is horizontal.
+ */
+ constructor(displayText?: string, angle?: number);
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ protected _setup(): void;
+ /**
+ * Gets the Label's text.
+ */
+ text(): string;
+ /**
+ * Sets the Label's text.
+ *
+ * @param {string} displayText
+ * @returns {Label} The calling Label.
+ */
+ text(displayText: string): Label;
+ /**
+ * Gets the angle of the Label in degrees.
+ */
+ angle(): number;
+ /**
+ * Sets the angle of the Label in degrees.
+ *
+ * @param {number} angle One of -90/0/90. 0 is horizontal.
+ * @returns {Label} The calling Label.
+ */
+ angle(angle: number): Label;
+ /**
+ * Gets the amount of padding around the Label in pixels.
+ */
+ padding(): number;
+ /**
+ * Sets the amount of padding around the Label in pixels.
+ *
+ * @param {number} padAmount
+ * @returns {Label} The calling Label.
+ */
+ padding(padAmount: number): Label;
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ renderImmediately(): Label;
+ }
+ class TitleLabel extends Label {
+ static TITLE_LABEL_CLASS: string;
+ /**
+ * @constructor
+ * @param {string} [text]
+ * @param {number} [angle] One of -90/0/90. 0 is horizontal.
+ */
+ constructor(text?: string, angle?: number);
+ }
+ class AxisLabel extends Label {
+ static AXIS_LABEL_CLASS: string;
+ /**
+ * @constructor
+ * @param {string} [text]
+ * @param {number} [angle] One of -90/0/90. 0 is horizontal.
+ */
+ constructor(text?: string, angle?: number);
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class Legend extends Component {
+ /**
+ * The css class applied to each legend row
+ */
+ static LEGEND_ROW_CLASS: string;
+ /**
+ * The css class applied to each legend entry
+ */
+ static LEGEND_ENTRY_CLASS: string;
+ /**
+ * The css class applied to each legend symbol
+ */
+ static LEGEND_SYMBOL_CLASS: string;
+ /**
+ * The Legend consists of a series of entries, each with a color and label taken from the Color Scale.
+ *
+ * @constructor
+ * @param {Scale.Color} scale
+ */
+ constructor(colorScale: Scales.Color);
+ protected _setup(): void;
+ /**
+ * Gets the maximum number of entries per row.
+ *
+ * @returns {number}
+ */
+ maxEntriesPerRow(): number;
+ /**
+ * Sets the maximum number of entries perrow.
+ *
+ * @param {number} maxEntriesPerRow
+ * @returns {Legend} The calling Legend.
+ */
+ maxEntriesPerRow(maxEntriesPerRow: number): Legend;
+ /**
+ * Gets the current comparator for the Legend's entries.
+ *
+ * @returns {(a: string, b: string) => number}
+ */
+ comparator(): (a: string, b: string) => number;
+ /**
+ * Sets a new comparator for the Legend's entries.
+ * The comparator is used to set the display order of the entries.
+ *
+ * @param {(a: string, b: string) => number} comparator
+ * @returns {Legend} The calling Legend.
+ */
+ comparator(comparator: (a: string, b: string) => number): Legend;
+ /**
+ * Gets the Color Scale.
+ *
+ * @returns {Scales.Color}
+ */
+ colorScale(): Scales.Color;
+ /**
+ * Sets the Color Scale.
+ *
+ * @param {Scales.Color} scale
+ * @returns {Legend} The calling Legend.
+ */
+ colorScale(colorScale: Scales.Color): Legend;
+ destroy(): void;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ /**
+ * Gets the Entities (representing Legend entries) at a particular point.
+ * Returns an empty array if no Entities are present at that location.
+ *
+ * @param {Point} p
+ * @returns {Entity[]}
+ */
+ entitiesAt(p: Point): Entity[];
+ renderImmediately(): Legend;
+ /**
+ * Gets the function determining the symbols of the Legend.
+ *
+ * @returns {(datum: any, index: number) => symbolFactory}
+ */
+ symbol(): (datum: any, index: number) => SymbolFactory;
+ /**
+ * Sets the function determining the symbols of the Legend.
+ *
+ * @param {(datum: any, index: number) => SymbolFactory} symbol
+ * @returns {Legend} The calling Legend
+ */
+ symbol(symbol: (datum: any, index: number) => SymbolFactory): Legend;
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class InterpolatedColorLegend extends Component {
+ /**
+ * The css class applied to the legend labels.
+ */
+ static LEGEND_LABEL_CLASS: string;
+ /**
+ * Creates an InterpolatedColorLegend.
+ *
+ * The InterpolatedColorLegend consists of a sequence of swatches that show the
+ * associated InterpolatedColor Scale sampled at various points.
+ * Two labels show the maximum and minimum values of the InterpolatedColor Scale.
+ *
+ * @constructor
+ * @param {Scales.InterpolatedColor} interpolatedColorScale
+ */
+ constructor(interpolatedColorScale: Scales.InterpolatedColor);
+ destroy(): void;
+ /**
+ * Gets the Formatter for the labels.
+ */
+ formatter(): Formatter;
+ /**
+ * Sets the Formatter for the labels.
+ *
+ * @param {Formatter} formatter
+ * @returns {InterpolatedColorLegend} The calling InterpolatedColorLegend.
+ */
+ formatter(formatter: Formatter): InterpolatedColorLegend;
+ /**
+ * Gets the orientation.
+ */
+ orientation(): string;
+ /**
+ * Sets the orientation.
+ *
+ * @param {string} orientation One of "horizontal"/"left"/"right".
+ * @returns {InterpolatedColorLegend} The calling InterpolatedColorLegend.
+ */
+ orientation(orientation: string): InterpolatedColorLegend;
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ protected _setup(): void;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ renderImmediately(): InterpolatedColorLegend;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class Gridlines extends Component {
+ /**
+ * @constructor
+ * @param {QuantitativeScale} xScale The scale to base the x gridlines on. Pass null if no gridlines are desired.
+ * @param {QuantitativeScale} yScale The scale to base the y gridlines on. Pass null if no gridlines are desired.
+ */
+ constructor(xScale: QuantitativeScale, yScale: QuantitativeScale);
+ destroy(): Gridlines;
+ protected _setup(): void;
+ renderImmediately(): Gridlines;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class Table extends ComponentContainer {
+ /**
+ * A Table combines Components in the form of a grid. A
+ * common case is combining a y-axis, x-axis, and the plotted data via
+ * ```typescript
+ * new Table([[yAxis, plot],
+ * [null, xAxis]]);
+ * ```
+ *
+ * @constructor
+ * @param {Component[][]} [rows=[]] A 2-D array of Components to be added to the Table.
+ * null can be used if a cell is empty.
+ */
+ constructor(rows?: Component[][]);
+ protected _forEach(callback: (component: Component) => any): void;
+ /**
+ * Checks whether the specified Component is in the Table.
+ */
+ has(component: Component): boolean;
+ /**
+ * Adds a Component in the specified row and column position.
+ *
+ * For example, instead of calling `new Table([[a, b], [null, c]])`, you
+ * could call
+ * ```typescript
+ * var table = new Table();
+ * table.add(a, 0, 0);
+ * table.add(b, 0, 1);
+ * table.add(c, 1, 1);
+ * ```
+ *
+ * @param {Component} component The Component to be added.
+ * @param {number} row
+ * @param {number} col
+ * @returns {Table} The calling Table.
+ */
+ add(component: Component, row: number, col: number): Table;
+ protected _remove(component: Component): boolean;
+ requestedSpace(offeredWidth: number, offeredHeight: number): SpaceRequest;
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Table;
+ /**
+ * Gets the padding above and below each row in pixels.
+ */
+ rowPadding(): number;
+ /**
+ * Sets the padding above and below each row in pixels.
+ *
+ * @param {number} rowPadding
+ * @returns {Table} The calling Table.
+ */
+ rowPadding(rowPadding: number): Table;
+ /**
+ * Gets the padding to the left and right of each column in pixels.
+ */
+ columnPadding(): number;
+ /**
+ * Sets the padding to the left and right of each column in pixels.
+ *
+ * @param {number} columnPadding
+ * @returns {Table} The calling Table.
+ */
+ columnPadding(columnPadding: number): Table;
+ /**
+ * Gets the weight of the specified row.
+ *
+ * @param {number} index
+ */
+ rowWeight(index: number): number;
+ /**
+ * Sets the weight of the specified row.
+ * Space is allocated to rows based on their weight. Rows with higher weights receive proportionally more space.
+ *
+ * A common case would be to have one row take up 2/3rds of the space,
+ * and the other row take up 1/3rd.
+ *
+ * Example:
+ *
+ * ```JavaScript
+ * plot = new Plottable.Component.Table([
+ * [row1],
+ * [row2]
+ * ]);
+ *
+ * // assign twice as much space to the first row
+ * plot
+ * .rowWeight(0, 2)
+ * .rowWeight(1, 1)
+ * ```
+ *
+ * @param {number} index
+ * @param {number} weight
+ * @returns {Table} The calling Table.
+ */
+ rowWeight(index: number, weight: number): Table;
+ /**
+ * Gets the weight of the specified column.
+ *
+ * @param {number} index
+ */
+ columnWeight(index: number): number;
+ /**
+ * Sets the weight of the specified column.
+ * Space is allocated to columns based on their weight. Columns with higher weights receive proportionally more space.
+ *
+ * Please see `rowWeight` docs for an example.
+ *
+ * @param {number} index
+ * @param {number} weight
+ * @returns {Table} The calling Table.
+ */
+ columnWeight(index: number, weight: number): Table;
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Components {
+ class SelectionBoxLayer extends Component {
+ protected _box: d3.Selection;
+ constructor();
+ protected _setup(): void;
+ protected _sizeFromOffer(availableWidth: number, availableHeight: number): {
+ width: number;
+ height: number;
+ };
+ /**
+ * Gets the Bounds of the box.
+ */
+ bounds(): Bounds;
+ /**
+ * Sets the Bounds of the box.
+ *
+ * @param {Bounds} newBounds
+ * @return {SelectionBoxLayer} The calling SelectionBoxLayer.
+ */
+ bounds(newBounds: Bounds): SelectionBoxLayer;
+ protected _setBounds(newBounds: Bounds): void;
+ renderImmediately(): SelectionBoxLayer;
+ /**
+ * Gets whether the box is being shown.
+ */
+ boxVisible(): boolean;
+ /**
+ * Shows or hides the selection box.
+ *
+ * @param {boolean} show Whether or not to show the box.
+ * @return {SelectionBoxLayer} The calling SelectionBoxLayer.
+ */
+ boxVisible(show: boolean): SelectionBoxLayer;
+ fixedWidth(): boolean;
+ fixedHeight(): boolean;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Plots {
+ interface PlotEntity extends Entity {
+ dataset: Dataset;
+ index: number;
+ component: Plot;
+ }
+ interface AccessorScaleBinding {
+ accessor: Accessor;
+ scale?: Scale;
+ }
+ module Animator {
+ var MAIN: string;
+ var RESET: string;
+ }
+ }
+ class Plot extends Component {
+ protected static _ANIMATION_MAX_DURATION: number;
+ protected _renderArea: d3.Selection;
+ protected _renderCallback: ScaleCallback>;
+ protected _propertyExtents: d3.Map;
+ protected _propertyBindings: d3.Map>;
+ /**
+ * A Plot draws some visualization of the inputted Datasets.
+ *
+ * @constructor
+ */
+ constructor();
+ anchor(selection: d3.Selection): Plot;
+ protected _setup(): void;
+ destroy(): void;
+ /**
+ * Adds a Dataset to the Plot.
+ *
+ * @param {Dataset} dataset
+ * @returns {Plot} The calling Plot.
+ */
+ addDataset(dataset: Dataset): Plot;
+ protected _createNodesForDataset(dataset: Dataset): Drawer;
+ protected _createDrawer(dataset: Dataset): Drawer;
+ protected _getAnimator(key: string): Animator;
+ protected _onDatasetUpdate(): void;
+ /**
+ * Gets the AccessorScaleBinding for a particular attribute.
+ *
+ * @param {string} attr
+ */
+ attr(attr: string): Plots.AccessorScaleBinding ;
+ /**
+ * Sets a particular attribute to a constant value or the result of an Accessor.
+ *
+ * @param {string} attr
+ * @param {number|string|Accessor|Accessor} attrValue
+ * @returns {Plot} The calling Plot.
+ */
+ attr(attr: string, attrValue: number | string | Accessor | Accessor): Plot;
+ /**
+ * Sets a particular attribute to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the attribute values when autoDomain()-ing.
+ *
+ * @param {string} attr
+ * @param {A|Accessor} attrValue
+ * @param {Scale } scale The Scale used to scale the attrValue.
+ * @returns {Plot} The calling Plot.
+ */
+ attr (attr: string, attrValue: A | Accessor , scale: Scale ): Plot;
+ protected _bindProperty(property: string, value: any, scale: Scale): void;
+ protected _generateAttrToProjector(): AttributeToProjector;
+ renderImmediately(): Plot;
+ /**
+ * Returns whether the plot will be animated.
+ */
+ animated(): boolean;
+ /**
+ * Enables or disables animation.
+ */
+ animated(willAnimate: boolean): Plot;
+ detach(): Plot;
+ /**
+ * Updates the extents associated with each attribute, then autodomains all scales the Plot uses.
+ */
+ protected _updateExtents(): void;
+ protected _updateExtentsForProperty(property: string): void;
+ protected _filterForProperty(property: string): Accessor;
+ /**
+ * Override in subclass to add special extents, such as included values
+ */
+ protected _extentsForProperty(property: string): any[];
+ /**
+ * Get the Animator associated with the specified Animator key.
+ *
+ * @return {Animator}
+ */
+ animator(animatorKey: string): Animator;
+ /**
+ * Set the Animator associated with the specified Animator key.
+ *
+ * @param {string} animatorKey
+ * @param {Animator} animator
+ * @returns {Plot} The calling Plot.
+ */
+ animator(animatorKey: string, animator: Animator): Plot;
+ /**
+ * Removes a Dataset from the Plot.
+ *
+ * @param {Dataset} dataset
+ * @returns {Plot} The calling Plot.
+ */
+ removeDataset(dataset: Dataset): Plot;
+ protected _removeDatasetNodes(dataset: Dataset): void;
+ datasets(): Dataset[];
+ datasets(datasets: Dataset[]): Plot;
+ protected _getDrawersInOrder(): Drawer[];
+ protected _generateDrawSteps(): Drawers.DrawStep[];
+ protected _additionalPaint(time: number): void;
+ protected _getDataToDraw(): Utils.Map;
+ /**
+ * Retrieves Selections of this Plot for the specified Datasets.
+ *
+ * @param {Dataset[]} [datasets] The Datasets to retrieve the Selections for.
+ * If not provided, Selections will be retrieved for all Datasets on the Plot.
+ * @returns {d3.Selection}
+ */
+ selections(datasets?: Dataset[]): d3.Selection;
+ /**
+ * Gets the Entities associated with the specified Datasets.
+ *
+ * @param {dataset[]} datasets The Datasets to retrieve the Entities for.
+ * If not provided, returns defaults to all Datasets on the Plot.
+ * @return {Plots.PlotEntity[]}
+ */
+ entities(datasets?: Dataset[]): Plots.PlotEntity[];
+ /**
+ * Returns the PlotEntity nearest to the query point by the Euclidian norm, or undefined if no PlotEntity can be found.
+ *
+ * @param {Point} queryPoint
+ * @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no PlotEntity can be found.
+ */
+ entityNearest(queryPoint: Point): Plots.PlotEntity;
+ protected _visibleOnPlot(datum: any, pixelPoint: Point, selection: d3.Selection): boolean;
+ protected _entityVisibleOnPlot(pixelPoint: Point, datum: any, index: number, dataset: Dataset): boolean;
+ protected _uninstallScaleForKey(scale: Scale, key: string): void;
+ protected _installScaleForKey(scale: Scale, key: string): void;
+ protected _propertyProjectors(): AttributeToProjector;
+ protected static _scaledAccessor(binding: Plots.AccessorScaleBinding): Accessor;
+ protected _pixelPoint(datum: any, index: number, dataset: Dataset): Point;
+ protected _animateOnNextRender(): boolean;
+ }
+}
+
+
+declare module Plottable {
+ module Plots {
+ class Pie extends Plot {
+ /**
+ * @constructor
+ */
+ constructor();
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): Pie;
+ addDataset(dataset: Dataset): Pie;
+ removeDataset(dataset: Dataset): Pie;
+ protected _onDatasetUpdate(): void;
+ protected _createDrawer(dataset: Dataset): Drawers.Arc;
+ entities(datasets?: Dataset[]): PlotEntity[];
+ /**
+ * Gets the AccessorScaleBinding for the sector value.
+ */
+ sectorValue(): AccessorScaleBinding;
+ /**
+ * Sets the sector value to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} sectorValue
+ * @returns {Pie} The calling Pie Plot.
+ */
+ sectorValue(sectorValue: number | Accessor): Plots.Pie;
+ /**
+ * Sets the sector value to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {S|Accessor} sectorValue
+ * @param {Scale} scale
+ * @returns {Pie} The calling Pie Plot.
+ */
+ sectorValue(sectorValue: S | Accessor, scale: Scale): Plots.Pie;
+ /**
+ * Gets the AccessorScaleBinding for the inner radius.
+ */
+ innerRadius(): AccessorScaleBinding;
+ /**
+ * Sets the inner radius to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} innerRadius
+ * @returns {Pie} The calling Pie Plot.
+ */
+ innerRadius(innerRadius: number | Accessor): Plots.Pie;
+ /**
+ * Sets the inner radius to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {R|Accessor} innerRadius
+ * @param {Scale} scale
+ * @returns {Pie} The calling Pie Plot.
+ */
+ innerRadius(innerRadius: R | Accessor, scale: Scale): Plots.Pie;
+ /**
+ * Gets the AccessorScaleBinding for the outer radius.
+ */
+ outerRadius(): AccessorScaleBinding;
+ /**
+ * Sets the outer radius to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} outerRadius
+ * @returns {Pie} The calling Pie Plot.
+ */
+ outerRadius(outerRadius: number | Accessor): Plots.Pie;
+ /**
+ * Sets the outer radius to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {R|Accessor} outerRadius
+ * @param {Scale} scale
+ * @returns {Pie} The calling Pie Plot.
+ */
+ outerRadius(outerRadius: R | Accessor, scale: Scale): Plots.Pie;
+ /**
+ * Get whether slice labels are enabled.
+ *
+ * @returns {boolean} Whether slices should display labels or not.
+ */
+ labelsEnabled(): boolean;
+ /**
+ * Sets whether labels are enabled.
+ *
+ * @param {boolean} labelsEnabled
+ * @returns {Pie} The calling Pie Plot.
+ */
+ labelsEnabled(enabled: boolean): Pie;
+ entitiesAt(queryPoint: Point): PlotEntity[];
+ protected _propertyProjectors(): AttributeToProjector;
+ protected _getDataToDraw(): Utils.Map;
+ protected _pixelPoint(datum: any, index: number, dataset: Dataset): {
+ x: number;
+ y: number;
+ };
+ protected _additionalPaint(time: number): void;
+ }
+ }
+}
+
+
+declare module Plottable {
+ class XYPlot extends Plot {
+ protected static _X_KEY: string;
+ protected static _Y_KEY: string;
+ /**
+ * An XYPlot is a Plot that displays data along two primary directions, X and Y.
+ *
+ * @constructor
+ * @param {Scale} xScale The x scale to use.
+ * @param {Scale} yScale The y scale to use.
+ */
+ constructor();
+ /**
+ * Returns the whether or not the rendering is deferred for performance boost.
+ * @return {boolean} The deferred rendering option
+ */
+ deferredRendering(): boolean;
+ /**
+ * Sets / unsets the deferred rendering option
+ * Activating this option improves the performance of plot interaction (pan / zoom) by
+ * performing lazy renders, only after the interaction has stopped. Because re-rendering
+ * is no longer performed during the interaction, the zooming might experience a small
+ * resolution degradation, before the lazy re-render is performed.
+ *
+ * This option is intended for cases where performance is an issue.
+ */
+ deferredRendering(deferredRendering: boolean): XYPlot;
+ /**
+ * Gets the AccessorScaleBinding for X.
+ */
+ x(): Plots.AccessorScaleBinding;
+ /**
+ * Sets X to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} x
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ x(x: number | Accessor): XYPlot;
+ /**
+ * Sets X to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {X|Accessor} x
+ * @param {Scale} xScale
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ x(x: X | Accessor, xScale: Scale): XYPlot;
+ /**
+ * Gets the AccessorScaleBinding for Y.
+ */
+ y(): Plots.AccessorScaleBinding;
+ /**
+ * Sets Y to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} y
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ y(y: number | Accessor): XYPlot;
+ /**
+ * Sets Y to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {Y|Accessor} y
+ * @param {Scale} yScale
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ y(y: Y | Accessor, yScale: Scale): XYPlot;
+ protected _filterForProperty(property: string): (datum: any, index: number, dataset: Dataset) => boolean;
+ protected _uninstallScaleForKey(scale: Scale, key: string): void;
+ protected _installScaleForKey(scale: Scale, key: string): void;
+ destroy(): XYPlot;
+ /**
+ * Gets the automatic domain adjustment mode for visible points.
+ */
+ autorangeMode(): string;
+ /**
+ * Sets the automatic domain adjustment mode for visible points to operate against the X Scale, Y Scale, or neither.
+ * If "x" or "y" is specified the adjustment is immediately performed.
+ *
+ * @param {string} autorangeMode One of "x"/"y"/"none".
+ * "x" will adjust the x Scale in relation to changes in the y domain.
+ * "y" will adjust the y Scale in relation to changes in the x domain.
+ * "none" means neither Scale will change automatically.
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ autorangeMode(autorangeMode: string): XYPlot;
+ computeLayout(origin?: Point, availableWidth?: number, availableHeight?: number): XYPlot;
+ /**
+ * Adjusts the domains of both X and Y scales to show all data.
+ * This call does not override the autorange() behavior.
+ *
+ * @returns {XYPlot} The calling XYPlot.
+ */
+ showAllData(): XYPlot;
+ protected _projectorsReady(): boolean;
+ protected _pixelPoint(datum: any, index: number, dataset: Dataset): Point;
+ protected _getDataToDraw(): Utils.Map;
+ }
+}
+
+
+declare module Plottable {
+ module Plots {
+ class Rectangle extends XYPlot {
+ /**
+ * A Rectangle Plot displays rectangles based on the data.
+ * The left and right edges of each rectangle can be set with x() and x2().
+ * If only x() is set the Rectangle Plot will attempt to compute the correct left and right edge positions.
+ * The top and bottom edges of each rectangle can be set with y() and y2().
+ * If only y() is set the Rectangle Plot will attempt to compute the correct top and bottom edge positions.
+ *
+ * @constructor
+ * @param {Scale.Scale} xScale
+ * @param {Scale.Scale} yScale
+ */
+ constructor();
+ protected _createDrawer(dataset: Dataset): Drawers.Rectangle;
+ protected _generateAttrToProjector(): {
+ [attr: string]: (datum: any, index: number, dataset: Dataset) => any;
+ };
+ protected _generateDrawSteps(): Drawers.DrawStep[];
+ /**
+ * Gets the AccessorScaleBinding for X.
+ */
+ x(): AccessorScaleBinding;
+ /**
+ * Sets X to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} x
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ x(x: number | Accessor): Plots.Rectangle;
+ /**
+ * Sets X to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {X|Accessor} x
+ * @param {Scale} xScale
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ x(x: X | Accessor, xScale: Scale): Plots.Rectangle;
+ /**
+ * Gets the AccessorScaleBinding for X2.
+ */
+ x2(): AccessorScaleBinding;
+ /**
+ * Sets X2 to a constant number or the result of an Accessor.
+ * If a Scale has been set for X, it will also be used to scale X2.
+ *
+ * @param {number|Accessor|X|Accessor} x2
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ x2(x2: number | Accessor | X | Accessor): Plots.Rectangle;
+ /**
+ * Gets the AccessorScaleBinding for Y.
+ */
+ y(): AccessorScaleBinding;
+ /**
+ * Sets Y to a constant number or the result of an Accessor.
+ *
+ * @param {number|Accessor} y
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ y(y: number | Accessor): Plots.Rectangle;
+ /**
+ * Sets Y to a scaled constant value or scaled result of an Accessor.
+ * The provided Scale will account for the values when autoDomain()-ing.
+ *
+ * @param {Y|Accessor} y
+ * @param {Scale} yScale
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ y(y: Y | Accessor, yScale: Scale): Plots.Rectangle;
+ /**
+ * Gets the AccessorScaleBinding for Y2.
+ */
+ y2(): AccessorScaleBinding;
+ /**
+ * Sets Y2 to a constant number or the result of an Accessor.
+ * If a Scale has been set for Y, it will also be used to scale Y2.
+ *
+ * @param {number|Accessor|Y|Accessor} y2
+ * @returns {Plots.Rectangle} The calling Rectangle Plot.
+ */
+ y2(y2: number | Accessor | Y | Accessor): Plots.Rectangle;
+ protected _propertyProjectors(): AttributeToProjector;
+ protected _pixelPoint(datum: any, index: number, dataset: Dataset): {
+ x: any;
+ y: any;
+ };
+ protected _getDataToDraw(): Utils.Map;
+ }
+ }
+}
+
+
+declare module Plottable {
+ module Plots {
+ class Scatter