diff --git a/src/Scatterplot.ts b/src/Scatterplot.ts index 2c51c6b..aa1aaf6 100644 --- a/src/Scatterplot.ts +++ b/src/Scatterplot.ts @@ -4,15 +4,13 @@ * created: 2016-10-28T11:19:52.797Z */ -import './style.scss'; import {axisLeft, axisBottom, AxisScale} from 'd3-axis'; -import * as d3scale from 'd3-scale'; +import {scaleLinear} from 'd3-scale'; import {select, mouse, event as d3event} from 'd3-selection'; import {zoom as d3zoom, ZoomScale, ZoomTransform, D3ZoomEvent, zoomIdentity, ZoomBehavior} from 'd3-zoom'; import {drag as d3drag} from 'd3-drag'; import {quadtree, Quadtree, QuadtreeInternalNode, QuadtreeLeaf} from 'd3-quadtree'; import {circleSymbol, ISymbol, ISymbolRenderer, ERenderMode} from './symbol'; -import * as _symbol from './symbol'; import merge from './merge'; import {forEachLeaf, ellipseTester, isLeafNode, hasOverlap, getTreeSize, findByTester, getFirstLeaf, ABORT_TRAVERSAL, CONTINUE_TRAVERSAL, IBoundsPredicate, ITester} from './quadtree'; import Lasso,{ILassoOptions} from './lasso'; @@ -240,8 +238,8 @@ export default class Scatterplot extends EventEmitter { xlabel: 'x', ylabel: 'y', - xscale: d3scale.scaleLinear().domain([0, 100]), - yscale: d3scale.scaleLinear().domain([0, 100]), + xscale: scaleLinear().domain([0, 100]), + yscale: scaleLinear().domain([0, 100]), symbol: >circleSymbol(), @@ -260,8 +258,8 @@ export default class Scatterplot extends EventEmitter { private readonly normalized2pixel = { - x: d3scale.scaleLinear().domain(NORMALIZED_RANGE), - y: d3scale.scaleLinear().domain(NORMALIZED_RANGE) + x: scaleLinear().domain(NORMALIZED_RANGE), + y: scaleLinear().domain(NORMALIZED_RANGE) }; private canvasDataLayer:HTMLCanvasElement; private canvasSelectionLayer:HTMLCanvasElement; @@ -905,13 +903,3 @@ export default class Scatterplot extends EventEmitter { ctx.restore(); } } - -/** - * reexport d3 scale - */ -export const scale = d3scale; -export const symbol = _symbol; - -export function create(data:T[], canvas:HTMLCanvasElement):Scatterplot { - return new Scatterplot(data, canvas); -} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..7311390 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,19 @@ +/** + * Created by sam on 19.12.2016. + */ + +import './style.scss'; +import Scatterplot from './Scatterplot'; +import * as _symbol from './symbol'; +import * as d3scale from 'd3-scale'; +export {default as Scatterplot, EScaleAxes, IAccessor, IScale, IScatterplotOptions, IWindow, IZoomOptions} from './Scatterplot'; + +/** + * reexport d3 scale + */ +export const scale = d3scale; +export const symbol = _symbol; + +export function create(data:T[], canvas:HTMLCanvasElement):Scatterplot { + return new Scatterplot(data, canvas); +}