mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
smoothie: add definitions
This commit is contained in:
@@ -211,6 +211,7 @@ List of Definitions
|
||||
* [simple-cw-node](https://github.com/astronaughts/simple-cw-node) (by [vvakame](https://github.com/vvakame))
|
||||
* [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u))
|
||||
* [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley))
|
||||
* [socket.io](http://socket.io) (by [William Orr](https://github.com/worr))
|
||||
* [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev))
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path="smoothie.d.ts" />
|
||||
|
||||
// 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);
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for smoothie
|
||||
// Project: https://github.com/joewalnes/smoothie
|
||||
// Definitions by: Mike H. Hawley <https://github.com/mikehhawley>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "smoothie" {
|
||||
export class TimeSeries {
|
||||
constructor(options?: {
|
||||
resetBoundsInterval?: number;
|
||||
resetBounds?: boolean
|
||||
});
|
||||
|
||||
public resetBounds(): void;
|
||||
|
||||
public append(timestamp: number, value: number, sumRepeatedTimeStampValues?: boolean): void;
|
||||
|
||||
public dropOldData(oldestValidTime: number, maxDataSetLength: number): void;
|
||||
}
|
||||
|
||||
export class SmoothieChart {
|
||||
constructor(options?: {
|
||||
millisPerPixel?: number;
|
||||
maxValueScale?: number;
|
||||
interpolation?: string;
|
||||
scaleSmoothing?: number;
|
||||
maxDataSetLength?: number;
|
||||
|
||||
grid?: {
|
||||
fillStyle?: string;
|
||||
strokeStyle?: string;
|
||||
lineWidth?: number;
|
||||
sharpLines?: boolean;
|
||||
millisPerLine?: number;
|
||||
verticalSections?: number;
|
||||
borderVisible?: boolean
|
||||
};
|
||||
|
||||
labels?: {
|
||||
fillStyle?: string;
|
||||
disabled?: boolean;
|
||||
fontSize?: number;
|
||||
fontFamily?: string;
|
||||
precision?: number
|
||||
};
|
||||
|
||||
horizontalLines?: number[]
|
||||
});
|
||||
|
||||
public addTimeSeries(timeSeries: TimeSeries, options?: {
|
||||
lineWidth?: number;
|
||||
strokeStyle?: string
|
||||
}): void;
|
||||
|
||||
public removeTimeSeries(timeSeries: TimeSeries): void;
|
||||
|
||||
public streamTo(canvas: HTMLCanvasElement, delayMillis: number): void;
|
||||
|
||||
public start(): void;
|
||||
public stop(): void;
|
||||
|
||||
public updateValueRange(): void;
|
||||
public render(canvas?: HTMLCanvasElement, time?: number): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user