diff --git a/packages/core/package.json b/packages/core/package.json index dd756b1f..6aa85a50 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,7 +2,6 @@ "name": "@devinit-charts/core", "version": "1.0.0", "description": "Core package for devinit charts", - "main": "lib/index.js", "scripts": { "test": "jest", "test:dev": "jest -w", @@ -19,10 +18,8 @@ "plottable": "3.8.1" }, "directories": { - "dist": "./dist", "lib": "./lib", - "src": "./src", - "test": "./test" + "src": "./src" }, "repository": { "type": "git", diff --git a/packages/core/src/axes/grid.ts b/packages/core/src/axes/grid.ts index 29bae81c..0ab492a3 100644 --- a/packages/core/src/axes/grid.ts +++ b/packages/core/src/axes/grid.ts @@ -1,12 +1,13 @@ -import { Components } from 'plottable'; +import { Components, Scale } from 'plottable'; import { configureGridTicking } from './ticking'; export interface Config { orientation: string; - scale: any; - showGridlines: boolean; - ticking: string; + scale: Scale; + showGridlines?: boolean; + ticking?: string; } + export const createLinearAxisGridLines = (config: Config) => { const { orientation, scale, showGridlines = false, ticking = 'odd' diff --git a/packages/core/src/axes/index.ts b/packages/core/src/axes/index.ts index 8352df4b..9130a806 100644 --- a/packages/core/src/axes/index.ts +++ b/packages/core/src/axes/index.ts @@ -1,4 +1,4 @@ -import { AxisOrientation, Axes, Components, Scales, Component, XAlignment } from 'plottable'; +import { AxisOrientation, Axes, Components, Scales, Component} from 'plottable'; import {approximate} from '@devinit/prelude/lib/numbers'; import {configureAxisTicking, configureTimeAxisTicking} from '../axes/ticking'; @@ -108,13 +108,13 @@ export const getAxisLabelRotation = alignment => { * @param {function} format * @returns {Plottable.Axes.Numeric} */ -export type NumericAxis = AxisConfig & { +export type NumericConfigAxis = AxisConfig & { axisScale: Scales.Linear; - axisOrientation?: XAlignment; + axisOrientation?: string; }; export const createNumericAxis = - (axisConfig: NumericAxis, format?: (any) => any, axis?: Axes.Numeric): Components.Table + (axisConfig: NumericConfigAxis, format?: (any) => any, axis?: Axes.Numeric): Components.Table | undefined => { const { showAxis = true, @@ -167,11 +167,11 @@ export const createNumericAxis = * @param {Plottable.Axes.Time} axis * @returns {Plottable.Axes.Time} */ -export type TimeConfig = AxisConfig & { +export type TimeAxisConfig = AxisConfig & { axisScale: Scales.Time; }; -export const createTimeAxis = (config: TimeConfig, axis?: any): Component | undefined => { +export const createTimeAxis = (config: TimeAxisConfig, axis?: any): Component | undefined => { if (!config.showAxis) return undefined; if (!axis) axis = new Axes.Time(config.axisScale, 'bottom'); @@ -212,14 +212,15 @@ export const createTimeAxis = (config: TimeConfig, axis?: any): Component | unde * @param {Plottable.Axes.Category} axis * @returns {Plottable.Axes.Category} */ -export type CategoryConfig = AxisConfig & { +export type CategoryAxisConfig = AxisConfig & { axisScale: Scales.Category; axisOrientation?: string; innerPadding?: number; outerPadding?: number; axisDirection?: AxisOrientation; }; -export const createCategoryAxis = (config: CategoryConfig, axis?: Axes.Category) => { + +export const createCategoryAxis = (config: CategoryAxisConfig, axis?: Axes.Category) => { if (!config.showAxis) return null; const alignment = config.axisDirection || (config.axisOrientation === 'vertical' ? 'bottom' : 'left'); diff --git a/packages/line/categoric/index.ts b/packages/core/src/categoric/index.ts similarity index 59% rename from packages/line/categoric/index.ts rename to packages/core/src/categoric/index.ts index 73cdd5aa..7d68ad7d 100644 --- a/packages/line/categoric/index.ts +++ b/packages/core/src/categoric/index.ts @@ -2,27 +2,73 @@ import * as Plottable from 'plottable'; import {approximate} from '@devinit/prelude/lib/numbers'; import { createChartTable } from '../table'; import { createTitle } from '../title'; -import { createColorLegend } from '../legend'; +import { createColorLegend, LegendConfig } from '../legend'; import { makeUnique } from '../dataset'; -import { createCategoryScale, createLinearScale } from '../scale'; -import { createCategoryAxis, createNumericAxis } from '../axis'; -import { createLinearAxisGridLines } from '../grid'; +import { createCategoryScale, createLinearScale, LinearScale, CategoryScale } from '../scale'; +import { createCategoryAxis, CategoryAxisConfig, NumericConfigAxis, createNumericAxis } from '../axes'; +import { createLinearAxisGridLines } from '../axes/grid'; import createScaleAnimator from '../animator/scale'; +import { Labeling } from '../types'; +import { XAlignment } from 'plottable'; -export const createLinearPlot = ({ - plot, - orientation, - categoryScale, - linearScale, - labeling, -}) => { - const { showLabels = false, prefix = '', suffix = ''} = labeling as any; - - if (plot.labelsEnabled && !labeling.custom) { - plot.labelFormatter(d => `${prefix}${approximate(d)}${suffix}`).labelsEnabled(showLabels); +export interface CategoricChart { + linearScale: Plottable.Scales.Linear; + categoryScale: Plottable.Scales.Category; + colorScale: Plottable.Scales.Color; + table: Plottable.Components.Table; + update: (data: any) => void; + destroy: () => void; +} + +export interface CategoricConfig { + title?: string; + titleAlignment?: Plottable.XAlignment; + orientation: string; + groupBy: string; + colors: string[]; + coloring?: string; + labeling: Labeling; + linearScaleOpts?: LinearScale; + linearAxisOpts: NumericConfigAxis & {indicator: string}; + categoryAxisOpts: CategoryAxisConfig & {indicator: string}; + categoryScaleOpts?: CategoryScale; + legend: LegendConfig & {position: XAlignment}; +} + +export type BarPlot = Plottable.Plots.Bar; +export type LinePlot = Plottable.Plots.Line; + +export interface CreateCategoricChartArgs { + element: string | HTMLElement; + plot: BarPlot | LinePlot; + config: CategoricConfig; +} + +export interface LinearPlotArgs { + plot: BarPlot | LinePlot; + orientation: string; + categoryScale: Plottable.Scales.Category; + linearScale: Plottable.Scales.Linear; + labeling: Labeling; +} + +export const createLinearPlot = (args: LinearPlotArgs) => { + const { + plot, + orientation, + categoryScale, + linearScale, + labeling, + } = args; + + const {prefix, suffix, showLabels} = labeling; + + if ((plot as BarPlot).labelsEnabled && showLabels && !labeling.custom) { + (plot as BarPlot) + .labelFormatter(d => `${prefix}${approximate(d)}${suffix}`).labelsEnabled(true); } - return plot + return (plot as Plottable.Plots.Bar) .attr('stroke', d => d.color) .attr('fill', d => d.color) .attr('fill-opacity', d => d.opacity) @@ -49,53 +95,10 @@ const createPlotAreaWithAxes = (orientation, { linearAxis, plotArea, categoryAxi return new Plottable.Components.Table(plotAreaWithAxes); }; -/** - * @typedef {Object} LinearCategoryChart - * @private - * @property {string} type - Type - * @property {string} title - Title - * @property {'left'|'center'|'right'} titleAlignment=left - Title Alignment - * @property {('vertical'|'horizontal')} orientation=vertical - Orientation - * @property {indicator} groupBy - Groups - * @property {Labeling} labeling - Labeling - * @property {string[]} colors - Colors - * @property {indicator} coloring - Color Indicator - * @property {NumericAxis} linearAxis - Linear Axis - * @property {CategoryAxis} categoryAxis - Category Axis - * @property {Tooltip} tooltips - Tooltips - * @property {ColorLegend} legend - Legend - */ - -export interface CategoricChart { - linearScale: Plottable.Scales.Linear; - categoryScale: Plottable.Scales.Category; - colorScale: Plottable.Scales.Color; - table: Plottable.Components.Table; - update: (data: any) => void; - destroy: () => void; -} -export interface Config { - title?: string; - titleAlignment: string; - orientation: string; - groupBy: string; - colors: string[]; - coloring?: string; - Labeling: any; - linearAxis: any; - categoryAxis: any; - legend: any; -} -export interface CreateCategoricChartArgs { - element: string | HTMLElement; - plot: Plottable.Plot; - config: Config; -} - -export type CreateCategoricChart = (CreateCategoricChartArgs) => CategoricChart; -export const createCategoricChart: CreateCategoricChart = ({ element, plot, config }) => { +export const createCategoricChart = (args: CreateCategoricChartArgs): CategoricChart => { + const { element, plot, config } = args; const { - title = null, + title, titleAlignment = 'left', @@ -109,19 +112,25 @@ export const createCategoricChart: CreateCategoricChart = ({ element, plot, conf labeling, - linearAxis, + linearScaleOpts = {}, + + categoryScaleOpts = {}, - categoryAxis, + legend, - legend = {}, + linearAxisOpts, - // ... more config + categoryAxisOpts, } = config; - const categoryScale = createCategoryScale(categoryAxis); - const linearScale = createLinearScale(linearAxis); + const categoryScale = createCategoryScale(categoryScaleOpts); + const linearScale = createLinearScale(linearScaleOpts); const colorScale = new Plottable.Scales.Color(); - + const linearAxis = createNumericAxis({ + ...(linearAxisOpts as NumericConfigAxis), + axisScale: linearScale, + axisOrientation: orientation, + }); const table = createChartTable({ title: createTitle({ title, titleAlignment }), @@ -134,17 +143,12 @@ export const createCategoricChart: CreateCategoricChart = ({ element, plot, conf linearScale, labeling, }), - grid: createLinearAxisGridLines({ ...linearAxis, orientation, scale: linearScale }), - }), - - linearAxis: createNumericAxis({ - ...linearAxis, - axisScale: linearScale, - axisOrientation: orientation, + grid: createLinearAxisGridLines({orientation, scale: linearScale}), }), + linearAxis, categoryAxis: createCategoryAxis({ - ...categoryAxis, + ...(categoryAxisOpts as CategoryAxisConfig), axisScale: categoryScale, axisOrientation: orientation, }), @@ -182,9 +186,9 @@ export const createCategoricChart: CreateCategoricChart = ({ element, plot, conf data.filter(d => d[groupBy] === groupId).map(item => { return { group: groupId, - label: item[categoryAxis.indicator], - value: item[linearAxis.indicator], - color: item[coloring] || colors[index] || '#abc', + label: item[categoryAxisOpts.indicator], + value: item[linearAxisOpts.indicator], + color: coloring && item[coloring] || colors[index] || 'grey', opacity: 1, }; })); @@ -195,7 +199,7 @@ export const createCategoricChart: CreateCategoricChart = ({ element, plot, conf } const axisMaximum = Math.max.apply(null, sums); - animate([linearScale], [linearAxis.axisMinimum || 0, axisMaximum]); + animate([linearScale], [linearScaleOpts.axisMinimum || 0, axisMaximum]); } plot.datasets(datasets.map(d => new Plottable.Dataset(d))); diff --git a/packages/core/src/categoric/readme.md b/packages/core/src/categoric/readme.md new file mode 100644 index 00000000..8297c5a6 --- /dev/null +++ b/packages/core/src/categoric/readme.md @@ -0,0 +1 @@ +for creating categoric bar & line charts \ No newline at end of file diff --git a/packages/core/src/legend/index.ts b/packages/core/src/legend/index.ts index 1f098aaf..be1f3526 100644 --- a/packages/core/src/legend/index.ts +++ b/packages/core/src/legend/index.ts @@ -23,13 +23,13 @@ import {Components, Scales, XAlignment, SymbolFactories} from 'plottable'; * @param {ColorLegend} config * @returns {*} */ -export interface Config { - showLegend: boolean; +export interface LegendConfig { + showLegend?: boolean; symbol?: string; alignment?: XAlignment; rowSpan?: any; } -export const createColorLegend = (colorScale: Scales.Color, config: Config) => { +export const createColorLegend = (colorScale: Scales.Color, config: LegendConfig) => { const { showLegend = false, symbol = 'square', alignment = 'left', rowSpan = Infinity } = config; diff --git a/packages/core/src/scale/index.ts b/packages/core/src/scale/index.ts index c1d566d2..46df31a2 100644 --- a/packages/core/src/scale/index.ts +++ b/packages/core/src/scale/index.ts @@ -5,15 +5,16 @@ import { Scales } from 'plottable'; * @param {NumericAxis} config * @returns {Linear} */ -export const createLinearScale = (config: any) => { - const { axisMinimum = null, axisMaximum = null } = config; +export interface LinearScale { + axisMaximum?: number; + axisMinimum?: number; +} +export const createLinearScale = (config: LinearScale): Scales.Linear => { + const { axisMinimum, axisMaximum} = config; const scale = new Scales.Linear(); - scale.domainMin(axisMinimum); - scale.domainMax(axisMaximum); - - // ... - + if (axisMinimum) scale.domainMin(axisMinimum); + if (axisMaximum) scale.domainMax(axisMaximum); return scale; }; @@ -23,13 +24,14 @@ export const createLinearScale = (config: any) => { * @returns {Time} */ export interface TimeScale { - axisMaximum?: any; - axisMinimum?: any; + axisMaximum?: string | Date; + axisMinimum?: string | Date; } -export const createTimeScale = (config: TimeScale) => { +export const createTimeScale = (config: TimeScale): Scales.Time => { const scale = new Scales.Time(); - if (config.axisMaximum) scale.domainMin(new Date(config.axisMinimum.toString())); - if (config.axisMaximum) scale.domainMax(new Date(config.axisMaximum.toString())); + const { axisMinimum, axisMaximum} = config; + if (axisMinimum) scale.domainMin(new Date(axisMinimum.toString())); + if (axisMaximum) scale.domainMax(new Date(axisMaximum.toString())); return scale; }; @@ -39,11 +41,12 @@ export const createTimeScale = (config: TimeScale) => { * @param {CategoryAxis} config * @returns {Category} */ -export interface Config { +export interface CategoryScale { innerPadding?: number; outerPadding?: number; } -export const createCategoryScale = (config: Config) => { + +export const createCategoryScale = (config: CategoryScale): Scales.Category => { const { innerPadding = 0, outerPadding = 0 } = config; const scale = new Scales.Category(); scale.outerPadding(outerPadding); diff --git a/packages/core/src/title/index.ts b/packages/core/src/title/index.ts index 316da2a2..058cf9de 100644 --- a/packages/core/src/title/index.ts +++ b/packages/core/src/title/index.ts @@ -2,7 +2,7 @@ import * as Plottable from 'plottable'; export interface CreateTitleArgs { title?: string; - titleAlignment: Plottable.XAlignment; + titleAlignment?: Plottable.XAlignment; } export const createTitle = ({ title, titleAlignment = 'left' }: CreateTitleArgs): Plottable.Components.TitleLabel | undefined => { diff --git a/packages/core/src/tooltips/types.ts b/packages/core/src/types.ts similarity index 57% rename from packages/core/src/tooltips/types.ts rename to packages/core/src/types.ts index b18ac6b9..a5126080 100644 --- a/packages/core/src/tooltips/types.ts +++ b/packages/core/src/types.ts @@ -1,10 +1,12 @@ export interface Labeling { - prefix: string; + prefix?: string; + showLabels?: boolean; showValues?: boolean; - suffix: string; + custom?: boolean; + suffix?: string; } -export interface ITooltip { +export interface Tooltip { enable: boolean; titleIndicator: string; } diff --git a/packages/line/categoric/bar.ts b/packages/line/categoric/bar.ts deleted file mode 100644 index 4a133dd1..00000000 --- a/packages/line/categoric/bar.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as Plottable from 'plottable'; -import { color } from 'd3'; -import {approximate} from '@devinit/prelude/lib/numbers'; -import { createCategoricChart, CategoricChart } from '.'; -import { createBarTipper } from '../tooltips'; -import {createCustomLabels} from './helper'; - -export interface Labeling { - prefix: string; - suffix: string; -} -const createBarInteraction = (orientation = 'vertical', labeling: Labeling, highlight: string[] = []) => { - const { prefix = '', suffix = '' } = labeling; - - let currentId: string | null = null; - - const reset = plot => { - plot.entities().forEach(entity => { - if (!entity.selection.attr('initial-fill')) { - entity.selection.attr('initial-fill', entity.selection.attr('fill')); - } else { - entity.selection.attr('fill', entity.selection.attr('initial-fill')); - } - }); - - plot - .foreground() - .select('text') - .remove(); - }; - - return plot => { - // QUICKFIX: Highlight some bars in a bar chart - if (highlight.length) { - plot - .entities() - .filter((entity => highlight.indexOf(entity.datum.label) > -1)) - .forEach(entity => { - const { - x, y, width, height - } = entity.selection.node().getBBox(); - - plot - .background() - .append('text') - .attr('class', 'plot-label hover-label') - .attr('x', orientation === 'vertical' ? (x + width) / 2 : width + x + 5) - .attr('y', orientation === 'horizontal' ? (y + height) / 2 : y - 10) - .attr('text-anchor', orientation === 'vertical' ? 'middle' : 'start') - .attr('style', `fill: ${entity.selection.attr('fill')}`) - .text(`${prefix}${approximate(entity.datum.value)}${suffix}`); - }); - } - - const interaction = new Plottable.Interactions.Pointer() - .onPointerExit(() => { - reset(plot); - currentId = null; - }) - .onPointerMove(point => { - const [entity] = plot.entitiesAt(point); - const id = entity && `${entity.position.x.toFixed(3)}-${entity.position.y.toFixed(3)}`; - - if (id && id !== currentId) { - reset(plot); - - const { - x, y, width, height - } = entity.selection.node().getBBox(); - - plot - .foreground() - .append('text') - .attr('class', 'plot-label hover-label') - .attr('x', orientation === 'vertical' ? x + width / 2 : width + x + 5) - .attr('y', orientation === 'horizontal' ? y + height / 2 : y - 10) - .attr('text-anchor', orientation === 'vertical' ? 'middle' : 'start') - .attr('style', `fill: ${entity.selection.attr('fill')}`) - .text(`${prefix}${approximate(entity.datum.value)}${suffix}`); - - const fill = color(entity.selection.attr('initial-fill')).darker(0.7); - - entity.selection.attr('fill', fill); - - currentId = id; - } - }); - - interaction.attachTo(plot); - - plot.onDetach(_plot => { - interaction.detachFrom(_plot); - }); - }; -}; - -export default (element, plot, config) => { - const { interactions = { enable: false }, tooltips = { enable: true } } = config; - const chart: CategoricChart = createCategoricChart({ element, plot, config }); - - plot.onAnchor(_plot => { - setTimeout(() => { - if (interactions.enable) { - createBarInteraction(config.orientation, config.labeling, config.highlight)(_plot); - } - if (config.labeling.custom) { - createCustomLabels(config.labeling, _plot); - } - if (tooltips.enable) { - createBarTipper(element, config.labeling, config.orientation)(_plot); - } - }, 500); - }); - return chart; -}; diff --git a/packages/line/package.json b/packages/line/package.json index 263395a7..cdb560f3 100644 --- a/packages/line/package.json +++ b/packages/line/package.json @@ -6,21 +6,16 @@ "scripts": { "test": "jest", "test:dev": "jest -w", - "start": "WEBPACK_ENV=development wepack-serve --config ./webpack.config.js", - "compile": "tsc", - "lint": "tslint -c tslint.json 'src/**/*.ts' 'schema/**/*.ts' ", - "build": "webpack --profile --colors --mode=production", - "build:production": "WEBPACK_ENV=production webpack --profile --colors", + "build": "tsc", + "lint": "tslint -c ../../tslint.json 'src/**/*.ts' ", "patch": "release-it -i patch -n", "feature": "release-it -i minor -n", - "breaking": "release-it -i major -n", - "schema": "mkdir -p dist && jsdoc --template schema --destination dist/di-charts.schema.json lib/charts lib/factories", - "schema:dev": "npm run compile && npm run schema" + "breaking": "release-it -i major -n" }, "dependencies": { "@devinit/prelude": "^1.1.1", + "@devinit-charts/core": "1.0.0", "d3": "4.13.0", - "d3-drag": "^1.1.0", "lodash": "^4.17.5", "plottable": "3.8.1", "tooltip.js": "^1.2.0" diff --git a/packages/line/area.ts b/packages/line/src/area.ts similarity index 61% rename from packages/line/area.ts rename to packages/line/src/area.ts index ea323a80..7523aac0 100644 --- a/packages/line/area.ts +++ b/packages/line/src/area.ts @@ -1,6 +1,6 @@ import * as Plottable from 'plottable'; -import { CategoricChart} from '../factories/categoric'; -import { createLineChart} from '../factories/categoric/line'; +import { CategoricChart} from '@devinit-charts/core/lib/categoric'; +import { createLineChart} from './categoric/line'; /** * @typedef {LinearCategoryChart} Area @@ -8,18 +8,7 @@ import { createLineChart} from '../factories/categoric/line'; * @property {'area'} type * */ -export interface CategoryAxis { - showAxis: boolean; - showGridlines: boolean; - axisLabel: string; - indicator: string; -} -export interface LinearAxis { - showAxis: boolean; - showGridlines: boolean; - indicator: string; - axisLabel: string; -} + export interface Config { type: 'area'; title: string; diff --git a/packages/line/categoric/line.ts b/packages/line/src/categoric/line.ts similarity index 76% rename from packages/line/categoric/line.ts rename to packages/line/src/categoric/line.ts index b866a886..3540bd31 100644 --- a/packages/line/categoric/line.ts +++ b/packages/line/src/categoric/line.ts @@ -1,8 +1,8 @@ import {Plot} from 'plottable'; -import { createCategoricChart, CategoricChart} from '.'; -import { createLineTipper } from '../tooltips'; -import { Tooltips } from '../../charts/treemap'; -import {Config as Legend} from '../legend'; +import { createCategoricChart, CategoricChart} from '@devinit-charts/core/lib/categoric'; +import createLineTipper from '../tooltip'; +import { Tooltip, Labeling } from '@devinit-charts/core/lib/types'; +import {Config as Legend} from '@devinit-charts/core/lib/legend'; export interface LinearAxis { showAxis: boolean; @@ -16,8 +16,8 @@ export interface Config { type: string; colors: string[]; categoryAxis?: any; - tooltips?: Tooltips; - labeling?: string; + tooltips?: Tooltip; + labeling?: Labeling; linearAxis: any; legend?: Legend; groupBy?: string; @@ -51,7 +51,7 @@ export const createLineChart = (element: string | HTMLElement, plot: Plot, confi const { categoryScale } = chart; plot.onAnchor(_plot => { - if (tooltips.enable) { + if (tooltips.enable && config.labeling) { return createLineTipper(element as string, config.labeling, categoryScale)(_plot); } }); diff --git a/packages/line/full-stacked-area.ts b/packages/line/src/full-stacked-area.ts similarity index 100% rename from packages/line/full-stacked-area.ts rename to packages/line/src/full-stacked-area.ts diff --git a/packages/line/categoric/helper.ts b/packages/line/src/labeler.ts similarity index 99% rename from packages/line/categoric/helper.ts rename to packages/line/src/labeler.ts index b5f67225..d43e51f5 100644 --- a/packages/line/categoric/helper.ts +++ b/packages/line/src/labeler.ts @@ -16,6 +16,7 @@ interface Args { prefix: string; drawStackedBarSum?: boolean; } + const drawLabel = (opts: Args, foreground) => { // forExtend is for drawing sums of values in a stacked bar const {width, height, x, y, value, color, suffix, prefix, drawStackedBarSum = false} = opts; diff --git a/packages/line/line.ts b/packages/line/src/line.ts similarity index 100% rename from packages/line/line.ts rename to packages/line/src/line.ts diff --git a/packages/line/stacked-area.ts b/packages/line/src/stacked-area.ts similarity index 100% rename from packages/line/stacked-area.ts rename to packages/line/src/stacked-area.ts diff --git a/packages/line/stacked-timearea.ts b/packages/line/src/stacked-timearea.ts similarity index 100% rename from packages/line/stacked-timearea.ts rename to packages/line/src/stacked-timearea.ts diff --git a/packages/line/factories/time/anchor.ts b/packages/line/src/time/anchor.ts similarity index 82% rename from packages/line/factories/time/anchor.ts rename to packages/line/src/time/anchor.ts index c262ed4b..face30b1 100644 --- a/packages/line/factories/time/anchor.ts +++ b/packages/line/src/time/anchor.ts @@ -1,20 +1,22 @@ - import { drag, event } from 'd3'; +import { Table } from 'plottable/build/src/components'; +import { Component, Scales } from 'plottable'; -export default (table, timeScale, anchor = { start: 0 }, legend: any, listeners) => { +export default (table: Table, timeScale: Scales.Time, anchor = { start: 0 }, legend: any, listeners) => { const originDate = new Date(timeScale.domainMin()); const startDate = anchor.start ? new Date(anchor.start.toString()) : originDate; let currentYear = startDate.getFullYear().toString(); const minYear = new Date(timeScale.domainMin()).getFullYear(); const maxYear = new Date(timeScale.domainMax()).getFullYear(); - - const origin = timeScale.scaleTransformation(originDate); - const start = timeScale.scaleTransformation(startDate); - - const chartArea = table.componentAt(1, 0); - - const plotArea = legend.showLegend ? chartArea.componentAt(0, 0) : chartArea; + // TODO: these scale transformation function were taking in actual Dates, + // but the API seems to have changed such that they now take in numbers + const origin = timeScale.scaleTransformation(originDate.getTime()); + const start = timeScale.scaleTransformation(startDate.getTime()); + + const chartArea: Component = table.componentAt(1, 0); + // TODO: the api may have changed, thats why we have chartArea as any + const plotArea = legend.showLegend ? (chartArea as any).componentAt(0, 0) : chartArea; const timeAxis = plotArea.componentAt(2, 1); diff --git a/packages/line/factories/time/index.ts b/packages/line/src/time/index.ts similarity index 88% rename from packages/line/factories/time/index.ts rename to packages/line/src/time/index.ts index 21a0b98c..7662660c 100644 --- a/packages/line/factories/time/index.ts +++ b/packages/line/src/time/index.ts @@ -1,14 +1,14 @@ import * as Plottable from 'plottable'; import { groupBy as group, keys, values, mapValues } from 'lodash'; -import { createTitle } from '../title'; -import { createChartTable } from '../table'; -import { createColorLegend } from '../legend'; -import { createLinearAxisGridLines } from '../grid'; -import { createPlotWithGridlines } from '../categoric'; -import { createNumericAxis, createTimeAxis } from '../axis'; -import { createLinearScale, createTimeScale } from '../scale'; -import { createLineTipper } from '../tooltips'; -import createScaleAnimator from '../animator/scale'; +import { createTitle } from '@devinit-charts/core/lib/title'; +import { createChartTable } from '@devinit-charts/core/lib/table'; +import { createColorLegend } from '@devinit-charts/core/lib/legend'; +import { createLinearAxisGridLines } from '@devinit-charts/core/lib/axes/grid'; +import { createPlotWithGridlines } from '@devinit-charts/core/lib/categoric'; +import { createNumericAxis, createTimeAxis } from '@devinit-charts/core/lib/axes'; +import { createLinearScale, createTimeScale } from '@devinit-charts/core/lib/scale'; +import createLineTipper from '../tooltip'; +import createScaleAnimator from '@devinit-charts/core/lib/animator/scale'; import { createPlotAreaWithAxes, createTimePlot } from './utils'; import createTimeAnchor from './anchor'; diff --git a/packages/line/factories/time/utils.ts b/packages/line/src/time/utils.ts similarity index 100% rename from packages/line/factories/time/utils.ts rename to packages/line/src/time/utils.ts diff --git a/packages/line/timearea.ts b/packages/line/src/timearea.ts similarity index 100% rename from packages/line/timearea.ts rename to packages/line/src/timearea.ts diff --git a/packages/line/charts/timeline.ts b/packages/line/src/timeline.ts similarity index 100% rename from packages/line/charts/timeline.ts rename to packages/line/src/timeline.ts diff --git a/packages/line/tooltip.ts b/packages/line/src/tooltip/index.ts similarity index 98% rename from packages/line/tooltip.ts rename to packages/line/src/tooltip/index.ts index 25c4469b..958c4566 100644 --- a/packages/line/tooltip.ts +++ b/packages/line/src/tooltip/index.ts @@ -1,6 +1,6 @@ import {Scales, Interactions} from 'plottable'; import Tooltip from 'tooltip.js'; -import {Labeling} from './types'; +import {Labeling} from '@devinit-charts/core/lib/types'; import {approximate} from '@devinit/prelude/lib/numbers'; export type CreateLineTipper = ( diff --git a/packages/line/yarn.lock b/packages/line/yarn.lock new file mode 100644 index 00000000..80e59e53 --- /dev/null +++ b/packages/line/yarn.lock @@ -0,0 +1,671 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@devinit/prelude@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@devinit/prelude/-/prelude-1.1.1.tgz#1b03aaa6c23c1cff70268ec850530fa2ecadffb6" + dependencies: + "@types/node-fetch" "^1.6.7" + apollo-fetch "0.7.0" + fetch "^1.1.0" + fs-extra "5.0.0" + pg-promise "^8.2.1" + prettier "1.11.1" + ramda "0.25.0" + shortid "2.2.8" + +"@types/d3-array@*": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-1.2.1.tgz#e489605208d46a1c9d980d2e5772fa9c75d9ec65" + +"@types/d3-axis@*": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-1.0.9.tgz#62ce7bc8d04354298cda57f3f1d1f856ad69b89a" + dependencies: + "@types/d3-selection" "*" + +"@types/d3-brush@*": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-1.0.7.tgz#05c30440f4d537fd23f976b0e6c4ba223001ef45" + dependencies: + "@types/d3-selection" "*" + +"@types/d3-chord@*": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-1.0.6.tgz#0589eb97a3191f4edaf17b7bde498462890ce1ec" + +"@types/d3-collection@*": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-collection/-/d3-collection-1.0.6.tgz#0a5a87fe241fcbd253a637d024b4d8c55f84a369" + +"@types/d3-color@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-1.0.5.tgz#cad755f0fc6de7b70fa6e5e08afa81ef4c2248de" + +"@types/d3-dispatch@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-1.0.5.tgz#f1f9187b538ecb05157569d8dc2f70dfb04f1b52" + +"@types/d3-drag@*": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-1.2.0.tgz#5ee6279432c894f85cb72fcda911a959bae11952" + dependencies: + "@types/d3-selection" "*" + +"@types/d3-dsv@*": + version "1.0.31" + resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-1.0.31.tgz#468302f18ac44db2a3944086388d862503ab9c6c" + +"@types/d3-ease@*": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-1.0.7.tgz#93a301868be9e15061f3d44343b1ab3f8acb6f09" + +"@types/d3-force@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-1.1.0.tgz#40925ca3512b63bd424f7c9685e1781b5b0a1d7e" + +"@types/d3-format@*": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-1.2.1.tgz#9435fb1771d2fbf6a858c93218f4097c9aa396c1" + +"@types/d3-geo@*": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-1.10.0.tgz#d3a1825f940179074779819f49be14ec47424ab9" + dependencies: + "@types/geojson" "*" + +"@types/d3-hierarchy@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-1.1.0.tgz#50f1ee052840638035cbdd4acab1fc3470905907" + +"@types/d3-interpolate@*": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-1.1.6.tgz#64041b15c9c032c348da1b22baabc59fa4d16136" + dependencies: + "@types/d3-color" "*" + +"@types/d3-path@*": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-1.0.6.tgz#c1a7d2dc07b295fdd1c84dabe4404df991b48693" + +"@types/d3-polygon@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-1.0.5.tgz#35ad54ed84c39d7e9f1252b6535be600be6cace2" + +"@types/d3-quadtree@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-1.0.5.tgz#1ce1e659eae4530df0cb127f297f1741a367a82e" + +"@types/d3-queue@*": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@types/d3-queue/-/d3-queue-3.0.5.tgz#3e4cbe2aff61db6a0b2b8c4800299e4ec6acc850" + +"@types/d3-random@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-1.1.0.tgz#2dd08f1159c70719270e4a7c834af85c8b88d2c3" + +"@types/d3-request@*": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-request/-/d3-request-1.0.2.tgz#db9db8154f47816584706c6e6f702be66f22f4be" + dependencies: + "@types/d3-dsv" "*" + +"@types/d3-scale@^1": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-1.0.12.tgz#f6300e886ce38dc8834172a9ce4a2cbfad74d029" + dependencies: + "@types/d3-time" "*" + +"@types/d3-selection@*": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-1.3.0.tgz#acede3d22c18ec085cc401d4fdab9f040e1a73c7" + +"@types/d3-shape@*": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-1.2.2.tgz#f8dcdff7772a7ae37858bf04abd43848a78e590e" + dependencies: + "@types/d3-path" "*" + +"@types/d3-time-format@*": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-2.1.0.tgz#011e0fb7937be34a9a8f580ae1e2f2f1336a8a22" + +"@types/d3-time@*": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-1.0.7.tgz#4266d7c9be15fa81256a88d1d052d61cd8dc572c" + +"@types/d3-timer@*": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-1.0.6.tgz#786d4e20731adf03af2c5df6c86fe29667fe429b" + +"@types/d3-transition@*": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-1.1.1.tgz#c209fce6a966d6696356dd42b091a9c6cc79929f" + dependencies: + "@types/d3-selection" "*" + +"@types/d3-voronoi@*": + version "1.1.7" + resolved "https://registry.yarnpkg.com/@types/d3-voronoi/-/d3-voronoi-1.1.7.tgz#c0a145cf04395927e01706ff6c4ff835c97a8ece" + +"@types/d3-zoom@*": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-1.7.0.tgz#1221bbf6434820f044c80b551c5519b817008961" + dependencies: + "@types/d3-interpolate" "*" + "@types/d3-selection" "*" + +"@types/d3@^4.5.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@types/d3/-/d3-4.13.0.tgz#aae092b368266409cfbf19c611203145ec0d5f65" + dependencies: + "@types/d3-array" "*" + "@types/d3-axis" "*" + "@types/d3-brush" "*" + "@types/d3-chord" "*" + "@types/d3-collection" "*" + "@types/d3-color" "*" + "@types/d3-dispatch" "*" + "@types/d3-drag" "*" + "@types/d3-dsv" "*" + "@types/d3-ease" "*" + "@types/d3-force" "*" + "@types/d3-format" "*" + "@types/d3-geo" "*" + "@types/d3-hierarchy" "*" + "@types/d3-interpolate" "*" + "@types/d3-path" "*" + "@types/d3-polygon" "*" + "@types/d3-quadtree" "*" + "@types/d3-queue" "*" + "@types/d3-random" "*" + "@types/d3-request" "*" + "@types/d3-scale" "^1" + "@types/d3-selection" "*" + "@types/d3-shape" "*" + "@types/d3-time" "*" + "@types/d3-time-format" "*" + "@types/d3-timer" "*" + "@types/d3-transition" "*" + "@types/d3-voronoi" "*" + "@types/d3-zoom" "*" + +"@types/geojson@*": + version "7946.0.2" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.2.tgz#0bd0a01ef04e813c2b7580318da9e37c2eadea9c" + +"@types/is-plain-object@^0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@types/is-plain-object/-/is-plain-object-0.0.2.tgz#25bca7b656ba23fb03799a060dba201a7952103d" + +"@types/node-fetch@^1.6.7": + version "1.6.7" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-1.6.7.tgz#521078e8f0c69a158e5022005aca92d2620f6d57" + dependencies: + "@types/node" "*" + +"@types/node@*": + version "9.6.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.1.tgz#e2d374ef15b315b48e7efc308fa1a7cd51faa06c" + +apollo-fetch@0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/apollo-fetch/-/apollo-fetch-0.7.0.tgz#63c255a0ccb1b4c473524d8f9b536d72438bd3e7" + dependencies: + cross-fetch "^1.0.0" + +biskviit@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/biskviit/-/biskviit-1.0.1.tgz#037a0cd4b71b9e331fd90a1122de17dc49e420a7" + dependencies: + psl "^1.1.7" + +buffer-writer@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-1.0.1.tgz#22a936901e3029afcd7547eb4487ceb697a3bf08" + +commander@2: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + +cross-fetch@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-1.1.1.tgz#dede6865ae30f37eae62ac90ebb7bdac002b05a0" + dependencies: + node-fetch "1.7.3" + whatwg-fetch "2.0.3" + +d3-array@1, d3-array@1.2.1, d3-array@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.1.tgz#d1ca33de2f6ac31efadb8e050a021d7e2396d5dc" + +d3-axis@1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-1.0.8.tgz#31a705a0b535e65759de14173a31933137f18efa" + +d3-brush@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-1.0.4.tgz#00c2f238019f24f6c0a194a26d41a1530ffe7bc4" + dependencies: + d3-dispatch "1" + d3-drag "1" + d3-interpolate "1" + d3-selection "1" + d3-transition "1" + +d3-chord@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-1.0.4.tgz#7dec4f0ba886f713fe111c45f763414f6f74ca2c" + dependencies: + d3-array "1" + d3-path "1" + +d3-collection@1, d3-collection@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.4.tgz#342dfd12837c90974f33f1cc0a785aea570dcdc2" + +d3-color@1, d3-color@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.0.3.tgz#bc7643fca8e53a8347e2fbdaffa236796b58509b" + +d3-dispatch@1, d3-dispatch@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.3.tgz#46e1491eaa9b58c358fce5be4e8bed626e7871f8" + +d3-drag@1, d3-drag@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-1.2.1.tgz#df8dd4c502fb490fc7462046a8ad98a5c479282d" + dependencies: + d3-dispatch "1" + d3-selection "1" + +d3-dsv@1, d3-dsv@1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.8.tgz#907e240d57b386618dc56468bacfe76bf19764ae" + dependencies: + commander "2" + iconv-lite "0.4" + rw "1" + +d3-ease@1, d3-ease@1.0.3, d3-ease@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-1.0.3.tgz#68bfbc349338a380c44d8acc4fbc3304aa2d8c0e" + +d3-force@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-1.1.0.tgz#cebf3c694f1078fcc3d4daf8e567b2fbd70d4ea3" + dependencies: + d3-collection "1" + d3-dispatch "1" + d3-quadtree "1" + d3-timer "1" + +d3-format@1, d3-format@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.2.2.tgz#1a39c479c8a57fe5051b2e67a3bee27061a74e7a" + +d3-geo@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.9.1.tgz#157e3b0f917379d0f73bebfff3be537f49fa7356" + dependencies: + d3-array "1" + +d3-hierarchy@1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.5.tgz#a1c845c42f84a206bcf1c01c01098ea4ddaa7a26" + +d3-interpolate@1, d3-interpolate@1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.1.6.tgz#2cf395ae2381804df08aa1bf766b7f97b5f68fb6" + dependencies: + d3-color "1" + +d3-path@1, d3-path@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.5.tgz#241eb1849bd9e9e8021c0d0a799f8a0e8e441764" + +d3-polygon@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-1.0.3.tgz#16888e9026460933f2b179652ad378224d382c62" + +d3-quadtree@1, d3-quadtree@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.3.tgz#ac7987e3e23fe805a990f28e1b50d38fcb822438" + +d3-queue@3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618" + +d3-random@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.0.tgz#6642e506c6fa3a648595d2b2469788a8d12529d3" + +d3-request@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/d3-request/-/d3-request-1.0.6.tgz#a1044a9ef4ec28c824171c9379fae6d79474b19f" + dependencies: + d3-collection "1" + d3-dispatch "1" + d3-dsv "1" + xmlhttprequest "1" + +d3-scale@1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.7.tgz#fa90324b3ea8a776422bd0472afab0b252a0945d" + dependencies: + d3-array "^1.2.0" + d3-collection "1" + d3-color "1" + d3-format "1" + d3-interpolate "1" + d3-time "1" + d3-time-format "2" + +d3-selection@1, d3-selection@1.3.0, d3-selection@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.3.0.tgz#d53772382d3dc4f7507bfb28bcd2d6aed2a0ad6d" + +d3-shape@1.2.0, d3-shape@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.2.0.tgz#45d01538f064bafd05ea3d6d2cb748fd8c41f777" + dependencies: + d3-path "1" + +d3-time-format@2, d3-time-format@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.1.1.tgz#85b7cdfbc9ffca187f14d3c456ffda268081bb31" + dependencies: + d3-time "1" + +d3-time@1, d3-time@1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.8.tgz#dbd2d6007bf416fe67a76d17947b784bffea1e84" + +d3-timer@1, d3-timer@1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.7.tgz#df9650ca587f6c96607ff4e60cc38229e8dd8531" + +d3-transition@1, d3-transition@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-1.1.1.tgz#d8ef89c3b848735b060e54a39b32aaebaa421039" + dependencies: + d3-color "1" + d3-dispatch "1" + d3-ease "1" + d3-interpolate "1" + d3-selection "^1.1.0" + d3-timer "1" + +d3-voronoi@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.2.tgz#1687667e8f13a2d158c80c1480c5a29cb0d8973c" + +d3-zoom@1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-1.7.1.tgz#02f43b3c3e2db54f364582d7e4a236ccc5506b63" + dependencies: + d3-dispatch "1" + d3-drag "1" + d3-interpolate "1" + d3-selection "1" + d3-transition "1" + +d3@4.13.0, d3@^4.5.0: + version "4.13.0" + resolved "https://registry.yarnpkg.com/d3/-/d3-4.13.0.tgz#ab236ff8cf0cfc27a81e69bf2fb7518bc9b4f33d" + dependencies: + d3-array "1.2.1" + d3-axis "1.0.8" + d3-brush "1.0.4" + d3-chord "1.0.4" + d3-collection "1.0.4" + d3-color "1.0.3" + d3-dispatch "1.0.3" + d3-drag "1.2.1" + d3-dsv "1.0.8" + d3-ease "1.0.3" + d3-force "1.1.0" + d3-format "1.2.2" + d3-geo "1.9.1" + d3-hierarchy "1.1.5" + d3-interpolate "1.1.6" + d3-path "1.0.5" + d3-polygon "1.0.3" + d3-quadtree "1.0.3" + d3-queue "3.0.7" + d3-random "1.1.0" + d3-request "1.0.6" + d3-scale "1.0.7" + d3-selection "1.3.0" + d3-shape "1.2.0" + d3-time "1.0.8" + d3-time-format "2.1.1" + d3-timer "1.0.7" + d3-transition "1.1.1" + d3-voronoi "1.1.2" + d3-zoom "1.7.1" + +encoding@0.1.12, encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + dependencies: + iconv-lite "~0.4.13" + +fetch@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fetch/-/fetch-1.1.0.tgz#0a8279f06be37f9f0ebb567560a30a480da59a2e" + dependencies: + biskviit "1.0.1" + encoding "0.1.12" + +fs-extra@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +iconv-lite@0.4, iconv-lite@~0.4.13: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + +is-stream@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + +js-string-escape@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + optionalDependencies: + graceful-fs "^4.1.6" + +lodash@^4.17.5: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + +manakin@0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/manakin/-/manakin-0.5.1.tgz#c4a7116f6b00df3d5f1a37ad3ca515d22065a658" + +node-fetch@1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + +packet-reader@0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-0.3.1.tgz#cd62e60af8d7fea8a705ec4ff990871c46871f27" + +pg-connection-string@0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-0.1.3.tgz#da1847b20940e42ee1492beaf65d49d91b245df7" + +pg-minify@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/pg-minify/-/pg-minify-0.5.4.tgz#89d5261cacfd44dd7927fa052222a404e9b2a3c9" + +pg-pool@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-2.0.3.tgz#c022032c8949f312a4f91fb6409ce04076be3257" + +pg-promise@^8.2.1: + version "8.2.2" + resolved "https://registry.yarnpkg.com/pg-promise/-/pg-promise-8.2.2.tgz#079a71eb358ef7f27f78f4bc3653a1f4bb9266e6" + dependencies: + manakin "0.5.1" + pg "7.4.1" + pg-minify "0.5.4" + spex "2.0.2" + +pg-types@~1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-1.12.1.tgz#d64087e3903b58ffaad279e7595c52208a14c3d2" + dependencies: + postgres-array "~1.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.0" + postgres-interval "^1.1.0" + +pg@7.4.1: + version "7.4.1" + resolved "https://registry.yarnpkg.com/pg/-/pg-7.4.1.tgz#f3411c8ddf9f692322fe05e7017a1888e47f78f1" + dependencies: + buffer-writer "1.0.1" + js-string-escape "1.0.1" + packet-reader "0.3.1" + pg-connection-string "0.1.3" + pg-pool "~2.0.3" + pg-types "~1.12.1" + pgpass "1.x" + semver "4.3.2" + +pgpass@1.x: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.2.tgz#2a7bb41b6065b67907e91da1b07c1847c877b306" + dependencies: + split "^1.0.0" + +plottable@3.8.1: + version "3.8.1" + resolved "https://registry.yarnpkg.com/plottable/-/plottable-3.8.1.tgz#70617e1ca4a8377a7b93626dce43793c97030994" + dependencies: + "@types/d3" "^4.5.0" + "@types/is-plain-object" "^0.0.2" + d3 "^4.5.0" + d3-ease "^1.0.0" + d3-shape "^1.0.0" + is-plain-object "^2.0.4" + tslib "~1.8.0" + typesettable "4.1.0" + +popper.js@^1.0.2: + version "1.14.1" + resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.1.tgz#b8815e5cda6f62fc2042e47618649f75866e6753" + +postgres-array@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-1.0.2.tgz#8e0b32eb03bf77a5c0a7851e0441c169a256a238" + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + +postgres-date@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.3.tgz#e2d89702efdb258ff9d9cee0fe91bd06975257a8" + +postgres-interval@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.1.1.tgz#acdb0f897b4b1c6e496d9d4e0a853e1c428f06f0" + dependencies: + xtend "^4.0.0" + +prettier@1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75" + +psl@^1.1.7: + version "1.1.25" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.25.tgz#135edc9c7ba48cd8e4a6903fded8c7f348a5d2ee" + +ramda@0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.25.0.tgz#8fdf68231cffa90bc2f9460390a0cb74a29b29a9" + +rw@1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" + +semver@4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.2.tgz#c7a07158a80bedd052355b770d82d6640f803be7" + +shortid@2.2.8: + version "2.2.8" + resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.8.tgz#033b117d6a2e975804f6f0969dbe7d3d0b355131" + +spex@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/spex/-/spex-2.0.2.tgz#e8c8d633a4c67af642dded701ec2350c9de964a0" + +split@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" + dependencies: + through "2" + +through@2: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tooltip.js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/tooltip.js/-/tooltip.js-1.2.0.tgz#8b16482f04397f4f9d7387843dccf186890c8860" + dependencies: + popper.js "^1.0.2" + +tslib@~1.8.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.1.tgz#6946af2d1d651a7b1863b531d6e5afa41aa44eac" + +typesettable@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/typesettable/-/typesettable-4.1.0.tgz#9dc4f539fabad7db4de2c3b08e286ff72a60f038" + +universalify@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + +whatwg-fetch@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + +xmlhttprequest@1: + version "1.8.0" + resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" diff --git a/packages/core/src/labeler/autofit.ts b/packages/tree/labeler/autofit.ts similarity index 100% rename from packages/core/src/labeler/autofit.ts rename to packages/tree/labeler/autofit.ts diff --git a/packages/core/src/labeler/index.ts b/packages/tree/labeler/index.ts similarity index 100% rename from packages/core/src/labeler/index.ts rename to packages/tree/labeler/index.ts