smoothie: add definitions

This commit is contained in:
Mike H. Hawley
2014-01-04 19:38:45 +04:00
parent e55d67e741
commit f4aaf7a1a6
3 changed files with 99 additions and 0 deletions
+1
View File
@@ -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))
+32
View File
@@ -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);
+66
View File
@@ -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;
}
}