From 2a5f37c650bc0a99549bcc2505fd465780623615 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 21 Dec 2017 10:09:29 -0800 Subject: [PATCH] smoothie: Provides its own types --- notNeededPackages.json | 6 + types/smoothie/index.d.ts | 186 ------------------------------- types/smoothie/smoothie-tests.ts | 31 ------ types/smoothie/tsconfig.json | 24 ---- types/smoothie/tslint.json | 79 ------------- 5 files changed, 6 insertions(+), 320 deletions(-) delete mode 100644 types/smoothie/index.d.ts delete mode 100644 types/smoothie/smoothie-tests.ts delete mode 100644 types/smoothie/tsconfig.json delete mode 100644 types/smoothie/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0f92b3f3ac..14e0d8d710 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -804,6 +804,12 @@ "sourceRepoURL": "https://github.com/zeh/simplesignal", "asOfVersion": "1.0.0" }, + { + "libraryName": "Smoothie Charts", + "typingsPackageName": "smoothie", + "sourceRepoURL": "https://github.com/joewalnes/smoothie", + "asOfVersion": "1.29.1" + }, { "libraryName": "snake-case", "typingsPackageName": "snake-case", diff --git a/types/smoothie/index.d.ts b/types/smoothie/index.d.ts deleted file mode 100644 index 853b1fbc25..0000000000 --- a/types/smoothie/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -// Type definitions for Smoothie Charts 1.25 -// Project: https://github.com/joewalnes/smoothie -// Definitions by: Drew Noakes , Mike H. Hawley -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/smoothie - -// NOTE this reference is here to make the DefinitelyTyped `npm test` suite pass and -// may be removed if you are using this module declaration in isolation from the -// rest of DefinitelyTyped. -/// - - -export interface ITimeSeriesOptions { - resetBounds?: boolean; - resetBoundsInterval?: number; -} - -export interface ITimeSeriesPresentationOptions { - strokeStyle?: string; - fillStyle?: string; - lineWidth?: number; -} - -export declare class TimeSeries { - /** - * Initialises a new TimeSeries with optional data options. - * - * Options are of the form (defaults shown): - * - *
-     * {
-     *   resetBounds: true,        // enables/disables automatic scaling of the y-axis
-     *   resetBoundsInterval: 3000 // the period between scaling calculations, in millis
-     * }
-     * 
- * - * Presentation options for TimeSeries are specified as an argument to SmoothieChart.addTimeSeries. - */ - constructor(options?: ITimeSeriesOptions); - - /** - * Clears all data and state from this TimeSeries object. - */ - clear(): void; - - /** - * Recalculate the min/max values for this TimeSeries object. - * - * This causes the graph to scale itself in the y-axis. - */ - resetBounds(): void; - - /** - * Adds a new data point to the TimeSeries, preserving chronological order. - * - * @param timestamp the position, in time, of this data point - * @param value the value of this data point - * @param sumRepeatedTimeStampValues if timestamp has an exact match in the series, this flag controls - * whether it is replaced, or the values summed (defaults to false.) - */ - append(timestamp: number, value: number, sumRepeatedTimeStampValues?: boolean): void; - - dropOldData(oldestValidTime: number, maxDataSetLength: number): void; -} - -export interface IGridOptions { - /** The background colour of the chart. */ - fillStyle?: string; - /** The pixel width of grid lines. */ - lineWidth?: number; - /** Colour of grid lines. */ - strokeStyle?: string; - /** Distance between vertical grid lines. */ - millisPerLine?: number; - /** Controls whether grid lines are 1px sharp, or softened. */ - sharpLines?: boolean; - /** Number of vertical sections marked out by horizontal grid lines. */ - verticalSections?: number; - /** Whether the grid lines trace the border of the chart or not. */ - borderVisible?: boolean; -} - -export interface ILabelOptions { - /** Enables/disables labels showing the min/max values. */ - disabled?: boolean; - /** Colour for text of labels. */ - fillStyle?: string; - fontSize?: number; - fontFamily?: string; - precision?: number; -} - -export interface IRange { min: number; max: number } - -export interface IHorizontalLine { - value?: number; - color?: string; - lineWidth?: number; -} - -export interface IChartOptions { - /** Specify to clamp the lower y-axis to a given value. */ - minValue?: number; - /** Specify to clamp the upper y-axis to a given value. */ - maxValue?: number; - /** Allows proportional padding to be added above the chart. for 10% padding, specify 1.1. */ - maxValueScale?: number; - yRangeFunction?: (range: IRange) => IRange; - /** Controls the rate at which y-value zoom animation occurs. */ - scaleSmoothing?: number; - /** Sets the speed at which the chart pans by. */ - millisPerPixel?: number; - /** Whether to render at different DPI depending upon the device. Enabled by default. */ - enableDpiScaling?: boolean; - yMinFormatter?: (min: number, precision: number) => string; - yMaxFormatter?: (max: number, precision: number) => string; - maxDataSetLength?: number; - /** One of: 'bezier', 'linear', 'step' */ - interpolation?: string; - /** Optional function to format time stamps for bottom of chart. You may use SmoothieChart.timeFormatter, or your own/ */ - timestampFormatter?: (date: Date) => string; - horizontalLines?: IHorizontalLine[]; - - grid?: IGridOptions; - - labels?: ILabelOptions; -} - -/** - * Initialises a new SmoothieChart. - * - * Options are optional and may be sparsely populated. Just specify the values you - * need and the rest will be given sensible defaults. - */ -export declare class SmoothieChart { - options: IChartOptions; - - constructor(chartOptions?: IChartOptions); - - /** - * Adds a TimeSeries to this chart, with optional presentation options. - */ - addTimeSeries(series: TimeSeries, seriesOptions?: ITimeSeriesPresentationOptions): void; - - /** - * Removes the specified TimeSeries from the chart. - */ - removeTimeSeries(series: TimeSeries): void; - - /** - * Gets render options for the specified TimeSeries. - * - * As you may use a single TimeSeries in multiple charts with different formatting in each usage, - * these settings are stored in the chart. - */ - getTimeSeriesOptions(timeSeries: TimeSeries): ITimeSeriesPresentationOptions; - - /** - * Brings the specified TimeSeries to the top of the chart. It will be rendered last. - */ - bringToFront(timeSeries: TimeSeries): void; - - /** - * Instructs the SmoothieChart to start rendering to the provided canvas, with specified delay. - * - * @param canvas the target canvas element - * @param delayMillis an amount of time to wait before a data point is shown. This can prevent the end of the series - * from appearing on screen, with new values flashing into view, at the expense of some latency. - */ - streamTo(canvas: HTMLCanvasElement, delayMillis?: number): void; - - /** - * Starts the animation of this chart. Called by streamTo. - */ - start(): void; - - /** - * Stops the animation of this chart. - */ - stop(): void; - - updateValueRange(): void; - - render(canvas?: HTMLCanvasElement, time?: number): void; - - static timeFormatter(date: Date): string; -} diff --git a/types/smoothie/smoothie-tests.ts b/types/smoothie/smoothie-tests.ts deleted file mode 100644 index 5a89014192..0000000000 --- a/types/smoothie/smoothie-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ - -// Smoothie supports browserify -import smoothie = require('smoothie'); - -var canvas: HTMLCanvasElement = document.createElement('canvas'); - -document.body.appendChild(canvas); - -var series: smoothie.TimeSeries = new smoothie.TimeSeries(), - chart: smoothie.SmoothieChart = new smoothie.SmoothieChart({ - grid : { - strokeStyle : '#404040' - }, - maxValue : 1, - minValue : 0 -}); - -chart.addTimeSeries(series, { - strokeStyle : '#FFFFFF', - fillStyle : 'rgba(64, 64, 64, 0.25)', - lineWidth : 2 -}); - -var DELAY: number = 500; - -chart.streamTo(canvas, DELAY); -chart.addTimeSeries(series); - -setInterval(() => - series.append(Date.now(), Math.random()), - DELAY); diff --git a/types/smoothie/tsconfig.json b/types/smoothie/tsconfig.json deleted file mode 100644 index 7e9fd9b698..0000000000 --- a/types/smoothie/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "smoothie-tests.ts" - ] -} \ No newline at end of file diff --git a/types/smoothie/tslint.json b/types/smoothie/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/smoothie/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -}