From bd6b3cdaf3a14dd31f2031301a10ec187eb92397 Mon Sep 17 00:00:00 2001 From: microshine Date: Tue, 30 Aug 2016 20:46:29 +0300 Subject: [PATCH 01/31] Add ERROR_STATE flag --- graphene-pk11/graphene-pk11.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/graphene-pk11/graphene-pk11.d.ts b/graphene-pk11/graphene-pk11.d.ts index 0405b4c6df..2a4d8aad0c 100644 --- a/graphene-pk11/graphene-pk11.d.ts +++ b/graphene-pk11/graphene-pk11.d.ts @@ -2131,6 +2131,7 @@ declare module "graphene-pk11" { SO_PIN_FINAL_TRY, SO_PIN_LOCKED, SO_PIN_TO_BE_CHANGED, + ERROR_STATE, } class Token extends HandleObject { From 93c264dda2828f70c30897ddd87410f1027dffd1 Mon Sep 17 00:00:00 2001 From: James Bracy Date: Tue, 20 Sep 2016 12:32:04 -0700 Subject: [PATCH 02/31] Adding missing static methods to Bookshelf - Model.where --- bookshelf/bookshelf-tests.ts | 6 ++++++ bookshelf/bookshelf.d.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/bookshelf/bookshelf-tests.ts b/bookshelf/bookshelf-tests.ts index 5d6080b99a..818ea25f35 100644 --- a/bookshelf/bookshelf-tests.ts +++ b/bookshelf/bookshelf-tests.ts @@ -71,6 +71,12 @@ class Tag extends bookshelf.Model { get tableName() { return 'tags'; } } +User.where('id', 1).fetch({withRelated: ['posts.tags']}).then(function(user) { + console.log(user.related('posts').toJSON()); +}).catch(function(err) { + console.error(err); +}); + new User().where('id', 1).fetch({withRelated: ['posts.tags']}) .then(user => { const posts = user.related('posts'); diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 34f58d62ed..ec340679e7 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -93,6 +93,8 @@ declare module 'bookshelf' { static fetchAll>() : Promise>; /** @deprecated should use `new` objects instead. */ static forge(attributes? : any, options? : ModelOptions) : T; + static where(properties: { [key: string]: any }): T; + static where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T; belongsTo>(target : {new(...args : any[]) : R}, foreignKey? : string) : R; belongsToMany>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection; From 4bb4c29cad26ee049899b35da7d9502c3c73fde6 Mon Sep 17 00:00:00 2001 From: Umed Khudoiberdiev Date: Sat, 24 Sep 2016 17:03:26 +0500 Subject: [PATCH 03/31] fixes #11351 (#11453) --- sinon/sinon.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index 2596adf0ca..69647534de 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -3,6 +3,12 @@ // Definitions by: William Sears // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// sinon uses DOM dependencies which are absent in browserless envoronment like node.js +// to avoid compiler errors this monkey patch is used +// see more details in https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11351 +interface Event { } +interface Document { } + declare namespace Sinon { interface SinonSpyCallApi { // Properties From da1c32084c97d7aea0369a7f5dbe9cb954c8e3b6 Mon Sep 17 00:00:00 2001 From: Masahiro Wakame Date: Sat, 24 Sep 2016 21:05:22 +0900 Subject: [PATCH 04/31] add version number of power-assert libraries (#11468) --- empower/empower.d.ts | 2 +- power-assert-formatter/power-assert-formatter.d.ts | 2 +- power-assert/power-assert.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/empower/empower.d.ts b/empower/empower.d.ts index 56a9757be5..0aa669829d 100644 --- a/empower/empower.d.ts +++ b/empower/empower.d.ts @@ -1,4 +1,4 @@ -// Type definitions for empower +// Type definitions for empower 1.2.1 // Project: https://github.com/twada/empower // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/power-assert-formatter/power-assert-formatter.d.ts b/power-assert-formatter/power-assert-formatter.d.ts index cc66680f18..e920905aa4 100644 --- a/power-assert-formatter/power-assert-formatter.d.ts +++ b/power-assert-formatter/power-assert-formatter.d.ts @@ -1,4 +1,4 @@ -// Type definitions for power-assert-formatter +// Type definitions for power-assert-formatter 1.4.1 // Project: https://github.com/twada/power-assert-formatter // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/power-assert/power-assert.d.ts b/power-assert/power-assert.d.ts index 66c4740eae..a894ddf11d 100644 --- a/power-assert/power-assert.d.ts +++ b/power-assert/power-assert.d.ts @@ -1,4 +1,4 @@ -// Type definitions for power-assert +// Type definitions for power-assert 1.4.1 // Project: https://github.com/twada/power-assert // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 7e0c259d20844e102fd5aa1f213bfd56dc2a1540 Mon Sep 17 00:00:00 2001 From: Ben Chauvette Date: Sat, 24 Sep 2016 08:09:57 -0400 Subject: [PATCH 05/31] [vinyl] Add test for File.isVinyl --- vinyl/vinyl-tests.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index 1d39646b11..387bc0ce9a 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -121,6 +121,19 @@ describe('File', () => { }); + describe('File.isVinyl()', () => { + it('should return true when an object is a Vinyl file', done => { + var file = new File(); + File.isVinyl(file).should.equal(true); + done(); + }); + + it('should return false when an object is not a Vinyl file', done => { + File.isVinyl({}).should.equal(false); + done(); + }); + }); + describe('isBuffer()', () => { it('should return true when the contents are a Buffer', done => { var val = new Buffer("test"); From cf8926a24159e424664d7d61563904b7b63edf52 Mon Sep 17 00:00:00 2001 From: Tony Ngan Date: Sat, 24 Sep 2016 20:11:38 +0800 Subject: [PATCH 06/31] Return type of ttl should be Job instead of void (#11461) [Reference](https://github.com/Automattic/kue/blob/d675f287054f267fee6c6becae7582fb769ea009/lib/queue/job.js#L484-L490) --- kue/kue.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kue/kue.d.ts b/kue/kue.d.ts index 653f3992aa..baca094200 100644 --- a/kue/kue.d.ts +++ b/kue/kue.d.ts @@ -86,7 +86,7 @@ declare module "kue" { delay(ms:number|Date): Job; removeOnComplete(param: any): void; backoff(param: any): void; - ttl(param: any): void; + ttl(param: any): Job; private _getBackoffImpl(): void; priority(level: string|number): Job; attempt(fn: Function): Job; @@ -146,4 +146,4 @@ declare module "kue" { export var workers: Worker[]; export function createQueue(options?: Object): Queue; -} \ No newline at end of file +} From 98184692733f013d8c4af9360f8b6811dbcd26dc Mon Sep 17 00:00:00 2001 From: Roman Resh Date: Sat, 24 Sep 2016 15:11:54 +0300 Subject: [PATCH 07/31] DevExpress ASP.NET 16.1.6 (#11438) --- devexpress-web/devexpress-web.d.ts | 599 ++++++++++++++++++++--------- 1 file changed, 417 insertions(+), 182 deletions(-) diff --git a/devexpress-web/devexpress-web.d.ts b/devexpress-web/devexpress-web.d.ts index c2e0014f85..7c3eeda936 100644 --- a/devexpress-web/devexpress-web.d.ts +++ b/devexpress-web/devexpress-web.d.ts @@ -619,7 +619,7 @@ interface ASPxClientDashboardDesigner extends ASPxClientControl { */ DashboardStateChanged: ASPxClientEvent>; /** - * Occurs after a dashboard displayed in the ASPxClientDashboardDesigner is changed. + * Occurs after another dashboard is loaded to the ASPxClientDashboardDesigner. */ DashboardChanged: ASPxClientEvent>; /** @@ -1670,9 +1670,9 @@ interface ASPxClientBinaryImage extends ASPxClientEdit { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -3407,9 +3407,9 @@ interface ASPxClientGaugeControl extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -8023,9 +8023,9 @@ interface ASPxClientPivotGrid extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -8304,9 +8304,9 @@ interface ASPxClientRichEdit extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -9358,6 +9358,8 @@ interface AbstractNumberingList { * Exposes the settings providing the information about the essential document functionality. */ interface SubDocument { + id: number; + type: any; /** * Provides information about paragraphs contained in the document. * Value: An array of Paragraph objects storing information about document paragraphs. @@ -9645,6 +9647,12 @@ declare enum HeaderFooterType { Primary=1, Even=2 } +declare enum SubDocumentType { + Main=0, + Header=1, + Footer=2, + TextBox=3 +} /** * Contains a set of methods and properties to work with the document selection. */ @@ -9825,6 +9833,9 @@ interface RichEditSelection { * Selects the editor's entire content. */ selectAll(): void; + setMainSubDocumentAsActive(): void; + setFooterSubDocumentAsActiveByPageIndex(pageIndex: number): void; + setHeaderSubDocumentAsActiveByPageIndex(pageIndex: number): void; } /** * Defines a document's interval. @@ -10199,11 +10210,6 @@ interface FileSaveCommand extends CommandWithSimpleStateBase { * Executes the FileSaveCommand command by imitating the corresponding end-user action made in the RichEdit's UI. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. */ execute(): boolean; - /** - * Executes the FileSaveCommand command by applying the specified setting. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. - * @param path A string value specifying path to the saving file. - */ - execute(path: string): boolean; } /** * A command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. @@ -10657,7 +10663,7 @@ declare enum ListLevelFormat { DecimalEnclosedCircle=12, DecimalEnclosedCircleChinese=13, DecimalEnclosedFullstop=14, - DecimalEnclosedParenthses=15, + DecimalEnclosedParentheses=15, DecimalFullWidth=16, DecimalFullWidth2=17, DecimalHalfWidth=18, @@ -12125,6 +12131,170 @@ declare enum BorderLineStyle { ThreeDEngrave=23, Outset=24, Inset=25, + Apples=26, + ArchedScallops=27, + BabyPacifier=28, + BabyRattle=29, + Balloons3Colors=30, + BalloonsHotAir=31, + BasicBlackDashes=32, + BasicBlackDots=33, + BasicBlackSquares=34, + BasicThinLines=35, + BasicWhiteDashes=36, + BasicWhiteDots=37, + BasicWhiteSquares=38, + BasicWideInline=39, + BasicWideMidline=40, + BasicWideOutline=41, + Bats=42, + Birds=43, + BirdsFlight=44, + Cabins=45, + CakeSlice=46, + CandyCorn=47, + CelticKnotwork=48, + CertificateBanner=49, + ChainLink=50, + ChampagneBottle=51, + CheckedBarBlack=52, + CheckedBarColor=53, + Checkered=54, + ChristmasTree=55, + CirclesLines=56, + CirclesRectangles=57, + ClassicalWave=58, + Clocks=59, + Compass=60, + Confetti=61, + ConfettiGrays=62, + ConfettiOutline=63, + ConfettiStreamers=64, + ConfettiWhite=65, + CornerTriangles=66, + CouponCutoutDashes=67, + CouponCutoutDots=68, + CrazyMaze=69, + CreaturesButterfly=70, + CreaturesFish=71, + CreaturesInsects=72, + CreaturesLadyBug=73, + CrossStitch=74, + Cup=75, + DecoArch=76, + DecoArchColor=77, + DecoBlocks=78, + DiamondsGray=79, + DoubleD=80, + DoubleDiamonds=81, + Earth1=82, + Earth2=83, + EclipsingSquares1=84, + EclipsingSquares2=85, + EggsBlack=86, + Fans=87, + Film=88, + Firecrackers=89, + FlowersBlockPrint=90, + FlowersDaisies=91, + FlowersModern1=92, + FlowersModern2=93, + FlowersPansy=94, + FlowersRedRose=95, + FlowersRoses=96, + FlowersTeacup=97, + FlowersTiny=98, + Gems=99, + GingerbreadMan=100, + Gradient=101, + Handmade1=102, + Handmade2=103, + HeartBalloon=104, + HeartGray=105, + Hearts=106, + HeebieJeebies=107, + Holly=108, + HouseFunky=109, + Hypnotic=110, + IceCreamCones=111, + LightBulb=112, + Lightning1=113, + Lightning2=114, + MapleLeaf=115, + MapleMuffins=116, + MapPins=117, + Marquee=118, + MarqueeToothed=119, + Moons=120, + Mosaic=121, + MusicNotes=122, + Northwest=123, + Ovals=124, + Packages=125, + PalmsBlack=126, + PalmsColor=127, + PaperClips=128, + Papyrus=129, + PartyFavor=130, + PartyGlass=131, + Pencils=132, + People=133, + PeopleHats=134, + PeopleWaving=135, + Poinsettias=136, + PostageStamp=137, + Pumpkin1=138, + PushPinNote1=139, + PushPinNote2=140, + Pyramids=141, + PyramidsAbove=142, + Quadrants=143, + Rings=144, + Safari=145, + Sawtooth=146, + SawtoothGray=147, + ScaredCat=148, + Seattle=149, + ShadowedSquares=150, + SharksTeeth=151, + ShorebirdTracks=152, + Skyrocket=153, + SnowflakeFancy=154, + Snowflakes=155, + Sombrero=156, + Southwest=157, + Stars=158, + Stars3d=159, + StarsBlack=160, + StarsShadowed=161, + StarsTop=162, + Sun=163, + Swirligig=164, + TornPaper=165, + TornPaperBlack=166, + Trees=167, + TriangleParty=168, + Triangles=169, + Tribal1=170, + Tribal2=171, + Tribal3=172, + Tribal4=173, + Tribal5=174, + Tribal6=175, + TwistedLines1=176, + TwistedLines2=177, + Vine=178, + Waveline=179, + WeavingAngles=180, + WeavingBraid=181, + WeavingRibbon=182, + WeavingStrips=183, + WhiteFlowers=184, + Woodwork=185, + XIllusions=186, + ZanyTriangles=187, + ZigZag=188, + ZigZagStitch=189, Nil=-1 } /** @@ -14070,6 +14240,11 @@ interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. */ operation: ASPxClientAppointmentOperation; + /** + * Provides information about dragged appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; } interface AppointmentResizeEventHandler { /** @@ -14093,6 +14268,51 @@ interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. */ operation: ASPxClientAppointmentOperation; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} +/** + * Stores information about an appointment drag operation. + */ +interface ASPxClientAppointmentDragInfo { + /** + * Gets the dragged appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets resources that were associated with the appointment before the drag operation. + * Value: A array of strings containing resource identifiers. + */ + oldResources: string[]; + /** + * Gets the appointment's interval after the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; + /** + * Gets resources associated with the appointment after the drag operation. + * Value: An array of strings containing resource identifiers. + */ + newResources: string[]; } /** * Contains information about a client tooltip. @@ -14429,9 +14649,9 @@ interface ASPxClientSpreadsheet extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -14580,6 +14800,9 @@ interface ASPxClientTreeList extends ASPxClientControl { * Sets input focus to the ASPxTreeList. */ Focus(): void; + /** + * Gets the Popup Edit Form. + */ GetPopupEditForm(): ASPxClientPopupControl; /** * Returns the focused node's key value. @@ -14638,9 +14861,9 @@ interface ASPxClientTreeList extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -15219,9 +15442,9 @@ interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15230,9 +15453,9 @@ interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15250,9 +15473,9 @@ interface MVCxClientCardView extends ASPxClientCardView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15287,9 +15510,9 @@ interface MVCxClientChart extends ASPxClientWebChartControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15298,9 +15521,9 @@ interface MVCxClientChart extends ASPxClientWebChartControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15318,9 +15541,9 @@ interface MVCxClientComboBox extends ASPxClientComboBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15343,9 +15566,9 @@ interface MVCxClientDataView extends ASPxClientDataView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15354,9 +15577,9 @@ interface MVCxClientDataView extends ASPxClientDataView { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15375,9 +15598,9 @@ interface MVCxClientDockManager extends ASPxClientDockManager { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15386,9 +15609,9 @@ interface MVCxClientDockManager extends ASPxClientDockManager { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15406,9 +15629,9 @@ interface MVCxClientDockPanel extends ASPxClientDockPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15431,9 +15654,9 @@ interface MVCxClientFileManager extends ASPxClientFileManager { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param data A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15442,9 +15665,9 @@ interface MVCxClientFileManager extends ASPxClientFileManager { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15462,9 +15685,9 @@ interface MVCxClientGridView extends ASPxClientGridView { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15525,9 +15748,9 @@ interface MVCxClientImageGallery extends ASPxClientImageGallery { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15536,9 +15759,9 @@ interface MVCxClientImageGallery extends ASPxClientImageGallery { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15556,9 +15779,9 @@ interface MVCxClientListBox extends ASPxClientListBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15590,9 +15813,9 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15606,9 +15829,9 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -15626,9 +15849,9 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15644,10 +15867,10 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * - * @param window - * @param parameter - * @param onSuccess + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -15721,9 +15944,9 @@ interface MVCxClientReportDesigner extends ASPxClientReportDesigner { */ PerformCallback(arg: Object): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: Object, onSuccess: (arg1: string) => void): void; /** @@ -15732,9 +15955,9 @@ interface MVCxClientReportDesigner extends ASPxClientReportDesigner { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; } @@ -15773,9 +15996,9 @@ interface MVCxClientRichEdit extends ASPxClientRichEdit { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15784,9 +16007,9 @@ interface MVCxClientRichEdit extends ASPxClientRichEdit { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15804,9 +16027,9 @@ interface MVCxClientRoundPanel extends ASPxClientRoundPanel { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15815,9 +16038,9 @@ interface MVCxClientRoundPanel extends ASPxClientRoundPanel { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15836,9 +16059,9 @@ interface MVCxClientScheduler extends ASPxClientScheduler { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15890,9 +16113,9 @@ interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15901,9 +16124,9 @@ interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15921,9 +16144,9 @@ interface MVCxClientPageControl extends ASPxClientPageControl { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15932,9 +16155,9 @@ interface MVCxClientPageControl extends ASPxClientPageControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -15952,9 +16175,9 @@ interface MVCxClientTokenBox extends ASPxClientTokenBox { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15977,9 +16200,9 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -15993,9 +16216,9 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -16095,9 +16318,9 @@ interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { */ PerformCallback(data: Object): void; /** - * - * @param data - * @param onSuccess + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** @@ -16221,9 +16444,9 @@ interface ASPxClientCallback extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -16280,9 +16503,9 @@ interface ASPxClientCallbackPanel extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -16788,9 +17011,9 @@ interface ASPxClientDataView extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -16858,9 +17081,9 @@ interface ASPxClientDockManager extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -17604,9 +17827,9 @@ interface ASPxClientFileManager extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } @@ -18889,6 +19112,9 @@ interface ASPxClientMenuBase extends ASPxClientControl { * Represents a client collection that maintains client menu objects. */ interface ASPxClientMenuCollection extends ASPxClientControlCollection { + /** + * Recalculates the position of visible sub menus. + */ RecalculateAll(): void; /** * Hides all menus maitained by the collection. @@ -19589,10 +19815,10 @@ interface ASPxClientPopupControl extends ASPxClientPopupControlBase { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * - * @param window - * @param parameter - * @param onSuccess + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -20479,9 +20705,9 @@ interface ASPxClientRoundPanel extends ASPxClientPanelBase { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** @@ -20854,9 +21080,9 @@ interface ASPxClientPageControl extends ASPxClientTabControlBase { */ PerformCallback(parameter: string): void; /** - * - * @param parameter - * @param onSuccess + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } @@ -21712,9 +21938,9 @@ interface ASPxClientChartDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -21871,9 +22097,9 @@ interface ASPxClientWebChartControl extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * - * @param args - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** @@ -22103,7 +22329,7 @@ interface ASPxClientWebChartHitInfo { */ inChartTitle: boolean; /** - * Gets a value indicating whether the test point is within the axis. + * Gets a value indicating whether the test point is within the . * Value: true if the test point is within an axis; otherwise, false. */ inAxis: boolean; @@ -22333,17 +22559,17 @@ interface ASPxClientDiagramCoordinates { */ dateTimeValue: Date; /** - * Gets the X-axis of the diagram point. + * Gets the X- of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of arguments (X-axis). */ axisX: ASPxClientAxisBase; /** - * Gets the Y-axis of the diagram point. + * Gets the Y- of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of values (Y-axis). */ axisY: ASPxClientAxisBase; /** - * Gets the pane of the diagram point. + * Gets the of the diagram point. * Value: An ASPxClientXYDiagramPane descendant, representing the pane. */ pane: ASPxClientXYDiagramPane; @@ -22562,12 +22788,12 @@ interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { */ secondaryAxesY: ASPxClientAxis[]; /** - * Provides access to a default pane object. + * Provides access to a default object. * Value: An ASPxClientXYDiagramPane object which represents the default pane of a chart. */ defaultPane: ASPxClientXYDiagramPane; /** - * Provides access to an array of a diagram's panes. + * Provides access to an array of a diagram's . * Value: An array of ASPxClientXYDiagramPane objects. */ panes: ASPxClientXYDiagramPane[]; @@ -22699,7 +22925,7 @@ interface ASPxClientRadarAxis extends ASPxClientAxisBase { */ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { /** - * Gets the axis to which the axis title belongs. + * Gets the to which the axis title belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -22714,7 +22940,7 @@ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { */ interface ASPxClientAxisLabelItem extends ASPxClientWebChartRequiredElement { /** - * Gets the axis to which an axis label item belongs. + * Gets the to which an axis label item belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -23875,9 +24101,9 @@ interface ASPxClientQueryBuilder extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -24036,9 +24262,9 @@ interface ASPxClientReportDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * - * @param arg - * @param onSuccess + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. */ PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; /** @@ -25128,6 +25354,7 @@ interface ASPxClientButtonEditStatic extends ASPxClientButtonEditBaseStatic { Cast(obj: Object): ASPxClientButtonEdit; } interface ASPxClientTokenBoxStatic extends ASPxClientComboBoxStatic { + Cast(obj: Object): ASPxClientTokenBox; } interface ASPxClientTrackBarStatic extends ASPxClientEditStatic { /** @@ -25909,6 +26136,7 @@ interface ASPxClientPivotGridStatic extends ASPxClientControlStatic { interface ASPxClientPivotCustomizationStatic extends ASPxClientControlStatic { } interface ASPxClientRichEditStatic extends ASPxClientControlStatic { + Cast(obj: Object): ASPxClientRichEdit; } interface ASPxSchedulerDateTimeHelperStatic { /** @@ -25922,10 +26150,11 @@ interface ASPxSchedulerDateTimeHelperStatic { */ ToDayTime(date: Date): any; /** - * Adds the specified number of days to a DateTime object and returns the result. - * @param date A DateTime object to which to add days. + * + * @param date + * @param dayCount */ - AddDays(date: Date): Date; + AddDays(date: Date, dayCount: number): Date; /** * Adds the specified timespan to a DateTime object and returns the result. * @param date A DateTime object to which to add a timespan. @@ -25978,6 +26207,7 @@ interface ASPxClientSpellCheckerStatic extends ASPxClientControlStatic { Cast(obj: Object): ASPxClientSpellChecker; } interface ASPxClientSpreadsheetStatic extends ASPxClientControlStatic { + Cast(obj: Object): ASPxClientSpreadsheet; } interface ASPxClientTreeListStatic extends ASPxClientControlStatic { /** @@ -26393,6 +26623,11 @@ interface ASPxClientFileManagerErrorConstsStatic { AlreadyExists: number; } interface ASPxClientFormLayoutStatic extends ASPxClientControlStatic { + /** + * Converts the specified object to the current object's type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress. + * @param obj The client object to be type cast. Represents an instance of a DevExpress web control's client object. + */ + Cast(obj: Object): ASPxClientFormLayout; } interface ASPxClientHiddenFieldStatic extends ASPxClientControlStatic { /** From b9290cce1ad8da186aaa36da6154693ce132fce5 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 24 Sep 2016 15:12:12 +0300 Subject: [PATCH 08/31] Added missing config property (#11463) --- canvas-gauges/canvas-gauges.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/canvas-gauges/canvas-gauges.d.ts b/canvas-gauges/canvas-gauges.d.ts index 53858e566e..2b67c7f76f 100644 --- a/canvas-gauges/canvas-gauges.d.ts +++ b/canvas-gauges/canvas-gauges.d.ts @@ -30,6 +30,7 @@ declare namespace CanvasGauges { minorTicks?: number, strokeTicks?: boolean, animatedValue?: boolean, + animateOnInit?: boolean, title?: string|boolean, borders?: boolean, valueInt?: number, From 5f34eea83b427afc487968265dc6b5884aac5f33 Mon Sep 17 00:00:00 2001 From: Ben Chauvette Date: Sat, 24 Sep 2016 08:13:22 -0400 Subject: [PATCH 09/31] [vinyl] Add File.isCustomProp See gulpjs/vinyl@7b01e75 --- vinyl/vinyl-tests.ts | 12 ++++++++++++ vinyl/vinyl.d.ts | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index 387bc0ce9a..49de15b54d 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -134,6 +134,18 @@ describe('File', () => { }); }); + describe('File.isCustomProp()', () => { + it('should return true when a File property is not managed internally', done => { + File.isCustomProp('foobar').should.equal(true); + done(); + }); + + it('should return false when a File property is managed internally', done => { + File.isCustomProp('cwd').should.equal(false); + done(); + }); + }); + describe('isBuffer()', () => { it('should return true when the contents are a Buffer', done => { var val = new Buffer("test"); diff --git a/vinyl/vinyl.d.ts b/vinyl/vinyl.d.ts index bcee5c6614..9861cf1b3c 100644 --- a/vinyl/vinyl.d.ts +++ b/vinyl/vinyl.d.ts @@ -1,5 +1,5 @@ -// Type definitions for vinyl 1.1.0 -// Project: https://github.com/wearefractal/vinyl +// Type definitions for vinyl 1.2.0 +// Project: https://github.com/gulpjs/vinyl // Definitions by: vvakame , jedmao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -140,6 +140,11 @@ declare module "vinyl" { * Checks if a given object is a vinyl file. */ public static isVinyl(obj: any): boolean; + + /** + * Checks if a property is not managed internally. + */ + public static isCustomProp(name: string): boolean; } export = File; From dda378990181cd75523afaddaf8d453c18e74276 Mon Sep 17 00:00:00 2001 From: microshine Date: Sat, 24 Sep 2016 16:18:53 +0300 Subject: [PATCH 10/31] Fix type errors --- pkcs11js/pkcs11js.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkcs11js/pkcs11js.d.ts b/pkcs11js/pkcs11js.d.ts index dcbdb401cb..676dce6555 100644 --- a/pkcs11js/pkcs11js.d.ts +++ b/pkcs11js/pkcs11js.d.ts @@ -210,7 +210,7 @@ declare module "pkcs11js" { * @param {Handle} slot ID of token's slot * @returns {Handle[]} Gets mech. array */ - C_GetMechanismList(slot: Handle): number[]; + C_GetMechanismList(slot: Handle): Handle[]; /** * Obtains information about a particular mechanism possibly supported by a token * @@ -218,7 +218,7 @@ declare module "pkcs11js" { * @param {Handle} mech Type of mechanism * @returns {MechanismInfo} Receives mechanism info */ - C_GetMechanismInfo(slot: Handle, mech: number): MechanismInfo; + C_GetMechanismInfo(slot: Handle, mech: Handle): MechanismInfo; /* Session management */ @@ -1173,11 +1173,11 @@ declare module "pkcs11js" { const CKM_RSA_PKCS_TPM_1_1: number; const CKM_RSA_PKCS_OAEP_TPM_1_1: number; const CKM_VENDOR_DEFINED: number; - + // Session flags const CKF_RW_SESSION: number; const CKF_SERIAL_SESSION: number; - + // Follows const CKF_HW: number; const CKF_ENCRYPT: number; @@ -1192,6 +1192,7 @@ declare module "pkcs11js" { const CKF_WRAP: number; const CKF_UNWRAP: number; const CKF_DERIVE: number; + const CKF_CLOCK_ON_TOKEN: number; // Certificates const CKC_X_509: number; @@ -1223,4 +1224,4 @@ declare module "pkcs11js" { const CK_PARAMS_RSA_OAEP: number; const CK_PARAMS_RSA_PSS: number; const CK_PARAMS_EC_DH: number; -} \ No newline at end of file +} From 929c2e53c3d2a2a2955985fc2be8af6f37db6258 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 24 Sep 2016 11:15:31 -0400 Subject: [PATCH 11/31] Typings for the dygraphs charting library --- dygraphs/dygraphs-tests.ts | 599 +++++++++++++++++ dygraphs/dygraphs.d.ts | 1272 ++++++++++++++++++++++++++++++++++++ 2 files changed, 1871 insertions(+) create mode 100644 dygraphs/dygraphs-tests.ts create mode 100644 dygraphs/dygraphs.d.ts diff --git a/dygraphs/dygraphs-tests.ts b/dygraphs/dygraphs-tests.ts new file mode 100644 index 0000000000..8c7318b429 --- /dev/null +++ b/dygraphs/dygraphs-tests.ts @@ -0,0 +1,599 @@ +// These tests are copied more or less directly from http://dygraphs.com/tests/ + +/// + +function demo() { + const g14 = new Dygraph( + document.getElementById("div_g14"), + 'data', { + rollPeriod: 14, + errorBars: true, + labelsDivWidth: 100, + labelsDivStyles: { + 'boxShadow': '4px 4px 4px #888' + }, + labelsSeparateLines: true, + } + ); +} + +function twoAxes() { + var data = [] as number[][]; + + var g = new Dygraph( + document.getElementById("demodiv"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + series: { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + }, + }, + axes: { + y2: { + // set axis-related properties here + labelsKMB: true + }, + y: { + axisLabelWidth: 60 + } + }, + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + } + ); + + var g2 = new Dygraph( + document.getElementById("demodiv_y2_primary"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y: { + // set axis-related properties here + drawGrid: false, + independentTicks: false + }, + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true + } + } + } + ); + + var g3 = new Dygraph( + document.getElementById("demodiv_two_grids"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true, + gridLinePattern: [2,2] + } + } + } + ); + + var g4 = new Dygraph( + document.getElementById("demodiv_one"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + labelsKMB: true, + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + } + ); + + var g5 = new Dygraph( + document.getElementById("demodiv_one_right"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y1': { + axis: 'y2' + }, + 'Y2': { + axis: 'y2' + }, + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y: { + // set axis-related properties here + drawGrid: false, + independentTicks: false + }, + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true + } + } + } + ); + + function update(el: HTMLInputElement) { + g.updateOptions( { fillGraph: el.checked } ); + g2.updateOptions( { fillGraph: el.checked } ); + g3.updateOptions( { fillGraph: el.checked } ); + g4.updateOptions( { fillGraph: el.checked } ); + g5.updateOptions( { fillGraph: el.checked } ); + } +} + +function perSeries() { + var data = '1234'; + var g = new Dygraph( + document.getElementById("demodiv"), + data, + { + strokeWidth: 2, + series : { + 'parabola': { + strokeWidth: 0.0, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'sine wave': { + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: [10, 2, 5, 2], + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); + + var g2 = new Dygraph( + document.getElementById("demodiv2"), + data, + { + legend: 'always', + strokeWidth: 2, + series: { + 'parabola': { + strokePattern: null, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokePattern: Dygraph.DASHED_LINE, + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'another line': { + strokePattern: [25, 5] + }, + 'sine wave': { + strokePattern: Dygraph.DOTTED_LINE, + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: Dygraph.DOT_DASH_LINE, + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); + + var g3 = new Dygraph( + document.getElementById("demodiv3"), + data, + { + strokeWidth: 2, + series: { + 'parabola': { + strokeWidth: 0.0, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'sine wave': { + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: [10, 2, 5, 2], + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); +} + +function highlightedRegion() { + var highlight_start = 0, highlight_end = 0; + var g = new Dygraph( + document.getElementById("div_g"), + [], + { + labels: ['X', 'Est.', 'Actual'], + animatedZooms: true, + underlayCallback: function(canvas, area, g) { + var bottom_left = g.toDomCoords(highlight_start, -20); + var top_right = g.toDomCoords(highlight_end, +20); + + var left = bottom_left[0]; + var right = top_right[0]; + + canvas.fillStyle = "rgba(255, 255, 102, 1.0)"; + canvas.fillRect(left, area.y, right - left, area.h); + } + + } + ); +} + +function makeGraph(className: string, numSeries: number, numRows: number, isStacked: boolean) { + var div = document.createElement('div'); + div.className = className; + div.style.display = 'inline-block'; + document.body.appendChild(div); + + var labels = ['x']; + for (var i = 0; i < numSeries; ++i) { + var label = '' + i; + label = 's' + '000'.substr(label.length) + label; + labels[i + 1] = label; + } + var g = new Dygraph( + div, + 'data', + { + width: 480, + height: 320, + labels: labels.slice(), + stackedGraph: isStacked, + + highlightCircleSize: 2, + strokeWidth: 1, + strokeBorderWidth: isStacked ? null : 1, + + highlightSeriesOpts: { + strokeWidth: 3, + strokeBorderWidth: 1, + highlightCircleSize: 5, + }, + }); + g.setSelection(false, 's005'); +}; + +function linearRegressionAddSeries() { + var labels = ['X', 'Y1', 'Y2']; + var orig_colors = [] as string[]; + + var g = new Dygraph( + document.getElementById("demodiv"), + 'data', + { + labels: labels, + drawPoints: true, + strokeWidth: 0.0, + drawCallback: function(g, is_initial) { + if (!is_initial) return; + var c = g.getColors(); + for (var i = 0; i < c.length; i++) orig_colors.push(c[i]); + } + } + ); +} + +function callbacks() { + var s = document.getElementById("status"); + var g: Dygraph = null; + var pts_info = function(e: MouseEvent, x: number, pts: dygraphs.Point[], row?: number) { + var str = "(" + x + ") "; + for (var i = 0; i < pts.length; i++) { + var p = pts[i]; + if (i) str += ", "; + str += p.name + ": " + p.yval; + } + + var x = e.offsetX; + var y = e.offsetY; + var dataXY = g.toDataCoords(x, y); + str += ", (" + x + ", " + y + ")"; + str += " -> (" + dataXY[0] + ", " + dataXY[1] + ")"; + str += ", row #"+row; + + return str; + }; + + g = new Dygraph( + document.getElementById("div_g"), + 'NoisyData', { + rollPeriod: 7, + showRoller: true, + errorBars: true, + + highlightCallback: function(e, x, pts, row) { + s.innerHTML += "Highlight " + pts_info(e,x,pts,row) + "
"; + }, + + unhighlightCallback: function(e) { + s.innerHTML += "Unhighlight
"; + }, + + clickCallback: function(e, x, pts) { + s.innerHTML += "Click " + pts_info(e,x,pts) + "
"; + }, + + pointClickCallback: function(e, p) { + s.innerHTML += "Point Click " + p.name + ": " + p.x + "
"; + }, + + zoomCallback: function(minX, maxX, yRanges) { + s.innerHTML += "Zoom [" + minX + ", " + maxX + ", [" + yRanges + "]]
"; + }, + + drawCallback: function(g) { + s.innerHTML += "Draw [" + g.xAxisRange() + "]
"; + } + } + ); +} + +function valueAxisFormatters() { + function formatDate(d: Date) { + var yyyy = d.getFullYear(), + mm = d.getMonth() + 1, + dd = d.getDate(); + return yyyy + '-' + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd; + } + + var g = new Dygraph( + document.getElementById("demodiv"), + 'data', + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + width: 640, + height: 350, + series: { + 'Y3': { axis: 'y2' }, + 'Y4': { axis: 'y2' } + }, + axes: { + x: { + valueFormatter: function(ms) { + return 'xvf(' + formatDate(new Date(ms)) + ')'; + }, + axisLabelFormatter: function(d: Date) { + return 'xalf(' + formatDate(d) + ')'; + }, + pixelsPerLabel: 100, + axisLabelWidth: 100, + }, + y: { + valueFormatter: function(y) { + return 'yvf(' + y.toPrecision(2) + ')'; + }, + axisLabelFormatter: function(y: number) { + return 'yalf(' + y.toPrecision(2) + ')'; + }, + axisLabelWidth: 100, + }, + y2: { + valueFormatter: function(y2) { + return 'y2vf(' + y2.toPrecision(2) + ')'; + }, + axisLabelFormatter: function(y2: number) { + return 'y2alf(' + y2.toPrecision(2) + ')'; + } + } + } + }); +} + +function annotation() { +var eventDiv = document.getElementById("events"); + function nameAnnotation(ann: dygraphs.Annotation) { + return "(" + ann.series + ", " + ann.x + ")"; + } + + var annotations = [] as dygraphs.Annotation[]; + var graph_initialized = false; + + var g = new Dygraph( + document.getElementById("g_div"), + function() { + var zp = function(x: number) { if (x < 10) return "0"+x; else return ''+x; }; + var r = "date,parabola,line,another line,sine wave\n"; + for (var i=1; i<=31; i++) { + r += "200610" + zp(i); + r += "," + 10*(i*(31-i)); + r += "," + 10*(8*i); + r += "," + 10*(250 - 8*i); + r += "," + 10*(125 + 125 * Math.sin(0.3*i)); + r += "\n"; + } + return r; + }, + { + rollPeriod: 1, + showRoller: true, + width: 480, + height: 320, + drawCallback: function(g, is_initial) { + if (is_initial) { + graph_initialized = true; + if (annotations.length > 0) { + g.setAnnotations(annotations); + } + } + + var ann = g.annotations(); + var html = ""; + for (var i = 0; i < ann.length; i++) { + var name = nameAnnotation(ann[i]); + html += "" + html += name + ": " + (ann[i].shortText || '(icon)') + html += " -> " + ann[i].text + "
"; + } + document.getElementById("list").innerHTML = html; + } + } + ); + + var last_ann = 0; + for (var x = 10; x < 15; x += 2) { + annotations.push( { + series: 'sine wave', + x: "200610" + x, + shortText: '' + x, + text: 'Stock Market Crash ' + x + } ); + last_ann = x; + } + annotations.push( { + series: 'another line', + x: "20061013", + icon: 'dollar.png', + width: 18, + height: 23, + tickHeight: 4, + text: 'Another one', + cssClass: 'annotation', + clickHandler: function() { + document.getElementById("events").innerHTML += "special handler
"; + } + } ); + annotations.push( { + series: 'parabola', + x: '20061012', + shortText: 'P', + text: 'Parabola Annotation at same x-coord' + } ); + + if (graph_initialized) { + g.setAnnotations(annotations); + } + + function add() { + var x = last_ann + 2; + var annnotations = g.annotations(); + annotations.push({ + series: 'line', + x: "200610" + x, + shortText: ''+x, + text: 'Line ' + x, + tickHeight: 10 + } ); + last_ann = x; + g.setAnnotations(annotations); + } + + function bottom(el: HTMLInputElement) { + var to_bottom = true; + if (el.value != 'Shove to bottom') to_bottom = false; + + var anns = g.annotations(); + for (var i = 0; i < anns.length; i++) { + anns[i].attachAtBottom = to_bottom; + } + g.setAnnotations(anns); + + if (to_bottom) { + el.value = 'Lift back up'; + } else { + el.value = 'Shove to bottom'; + } + } + + var saveBg = ''; + var num = 0; + g.updateOptions( { + annotationClickHandler: function(ann, point, dg, event) { + eventDiv.innerHTML += "click: " + nameAnnotation(ann) + "
"; + }, + annotationDblClickHandler: function(ann, point, dg, event) { + eventDiv.innerHTML += "dblclick: " + nameAnnotation(ann) + "
"; + }, + annotationMouseOverHandler: function(ann, point, dg, event) { + document.getElementById(nameAnnotation(ann)).style.fontWeight = 'bold'; + saveBg = ann.div.style.backgroundColor; + ann.div.style.backgroundColor = '#ddd'; + }, + annotationMouseOutHandler: function(ann, point, dg, event) { + document.getElementById(nameAnnotation(ann)).style.fontWeight = 'normal'; + ann.div.style.backgroundColor = saveBg; + }, + + pointClickCallback: function(event, p) { + // Check if the point is already annotated. + if (p.annotation) return; + + // If not, add one. + var ann = { + series: p.name, + xval: p.xval, + shortText: '' + num, + text: "Annotation #" + num + }; + var anns = g.annotations(); + anns.push(ann); + g.setAnnotations(anns); + + num++; + } + }); +} diff --git a/dygraphs/dygraphs.d.ts b/dygraphs/dygraphs.d.ts new file mode 100644 index 0000000000..21d4b2acae --- /dev/null +++ b/dygraphs/dygraphs.d.ts @@ -0,0 +1,1272 @@ +// Type definitions for dygraphs +// Project: http://dygraphs.com +// Definitions by: Dan Vanderkam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace dygraphs { + type DataArray = number[][]; + + // TODO: check for another DT definition to use here. + interface GVizDataTable { + getNumberOfRows(): number; + getNumberOfColumns(): number; + getValue(rowIndex: number, columnIndex: number): number; + } + + interface PerSeriesOptions { + /** + * Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be + * set per-series. + */ + axis?: 'y1' | 'y2'; + + /** + * A per-series color definition. Used in conjunction with, and overrides, the colors option. + */ + color?: string; + + /** + * Draw a small dot at each point, in addition to a line going through the point. This makes + * the individual data points easier to see, but can increase visual clutter in the chart. + * The small dot can be replaced with a custom rendering by supplying a drawPointCallback. + */ + drawPoints?: boolean; + + /** + * Error bars (or custom bars) for each series are drawn in the same color as the series, but + * with partial transparency. This sets the transparency. A value of 0.0 means that the error + * bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark + * as the line for the series itself. This can be used to produce chart lines whose thickness + * varies at each point. + */ + fillAlpha?: number; + + /** + * Should the area underneath the graph be filled? This option is not compatible with error + * bars. This may be set on a per-series basis. + */ + fillGraph?: boolean; + + /** + * The size in pixels of the dot drawn over highlighted points. + */ + highlightCircleSize?: number; + + /** + * The size of the dot to draw on each point in pixels (see drawPoints). A dot is always + * drawn when a point is "isolated", i.e. there is a missing point on either side of it. This + * also controls the size of those dots. + */ + pointSize?: number; + + /** + * Mark this series for inclusion in the range selector. The mini plot curve will be an + * average of all such series. If this is not specified for any series, the default behavior + * is to average all the series. Setting it for one series will result in that series being + * charted alone in the range selector. + */ + showInRangeSelector?: boolean; + + /** + * When set, display the graph as a step plot instead of a line plot. This option may either + * be set for the whole graph or for single series. + */ + stepPlot?: boolean; + + /** + * Draw a border around graph lines to make crossing lines more easily distinguishable. + * Useful for graphs with many lines. + */ + strokeBorderWidth?: number; + + /** + * Color for the line border used if strokeBorderWidth is set. + */ + strokeBorderColor?: string; + + /** + * A custom pattern array where the even index is a draw and odd is a space in pixels. If + * null then it draws a solid line. The array should have a even length as any odd lengthed + * array could be expressed as a smaller even length array. This is used to create dashed + * lines. + */ + strokePattern?: number[]; + + /** + * The width of the lines connecting data points. This can be used to increase the contrast + * or some graphs. + */ + strokeWidth?: number; + } + + interface PerAxisOptions { + /** + * Color for x- and y-axis labels. This is a CSS color string. + */ + axisLabelColor?: string; + + /** + * Size of the font (in pixels) to use in the axis labels, both x- and y-axis. + */ + axisLabelFontSize?: number; + + /** + * Function to call to format the tick values that appear along an axis. This is usually set + * on a per-axis basis. + */ + axisLabelFormatter?: (v: number|Date, granularity: number, opts: (name: string) => any, dygraph: Dygraph) => any; + + /** + * Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this + * also controls the width of the y-axis. Note that for the x-axis, this is independent from + * pixelsPerLabel, which controls the spacing between labels. + */ + axisLabelWidth?: number; + + /** + * Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle + * attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'. + */ + axisLineColor?: string; + + /** + * Thickness (in pixels) of the x- and y-axis lines. + */ + axisLineWidth?: number; + + /** + * The size of the line to display next to each tick mark on x- or y-axes. + */ + axisTickSize?: number; + + /** + * Whether to draw the specified axis. This may be set on a per-axis basis to define the + * visibility of each axis separately. Setting this to false also prevents axis ticks from + * being drawn and reclaims the space for the chart grid/lines. + */ + drawAxis?: boolean; + + /** + * The color of the gridlines. This may be set on a per-axis basis to define each axis' grid + * separately. + */ + gridLineColor?: string; + + /** + * A custom pattern array where the even index is a draw and odd is a space in pixels. If + * null then it draws a solid line. The array should have a even length as any odd lengthed + * array could be expressed as a smaller even length array. This is used to create dashed + * gridlines. + */ + gridLinePattern?: number[]; + + /** + * Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal + * gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. This + * may be set on a per-axis basis to define each axis' grid separately. + */ + gridLineWidth?: number; + + /** + * Only valid for y and y2, has no effect on x: This option defines whether the y axes should + * align their ticks or if they should be independent. Possible combinations: 1.) y=true, + * y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of + * y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned + * to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and + * have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an + * error. + */ + independentTicks?: boolean; + + /** + * When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less + * than or equal to zero are not displayed. Showing log scale with ranges that go below zero + * will result in an unviewable graph. + * + * Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for + * date-based x-axes. + */ + logscale?: boolean; + + /** + * When displaying numbers in normal (not scientific) mode, large numbers will be displayed + * with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis + * labels. If there are more than maxNumberWidth digits to the left of the + * decimal in a number, dygraphs will switch to scientific notation, even when not operating + * in scientific mode. If you'd like to see all those digits, set this to something large, + * like 20 or 30. + */ + maxNumberWidth?: number; + + /** + * Number of pixels to require between each x- and y-label. Larger values will yield a + * sparser axis with fewer ticks. This is set on a per-axis + * basis. + */ + pixelsPerLabel?: number; + + /** + * By default, dygraphs displays numbers with a fixed number of digits after the decimal + * point. If you'd prefer to have a fixed number of significant figures, set this option to + * that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 + * and 1234 to be displayed as 1.23e+3. + */ + sigFigs?: number; + + /** + * This lets you specify an arbitrary function to generate tick marks on an axis. The tick + * marks are an array of (value, label) pairs. The built-in functions go to great lengths to + * choose good tick marks so, if you set this option, you'll most likely want to call one of + * them and modify the result. See dygraph-tickers.js for an extensive discussion. This is + * set on a per-axis basis. + */ + ticker?: ( + min: number, + max: number, + pixels: number, + opts: (name: string) => any, + dygraph: Dygraph, + vals: number[]) => Array<{v: number, label: string}>; + + + /** + * Function to provide a custom display format for the values displayed on mouseover. This + * does not affect the values that appear on tick marks next to the axes. To format those, + * see axisLabelFormatter. This is usually set on a per-axis + * basis. + */ + valueFormatter?: ( + v: number, + opts: (name: string) => any, + seriesName: string, + dygraph: Dygraph, + row: number, + col: number) => any; + + /** + * Explicitly set the vertical range of the graph to [low, high]. This may be set on a + * per-axis basis to define each y-axis separately. If either limit is unspecified, it will + * be calculated automatically (e.g. [null, 30] to automatically calculate just the lower + * bound) + */ + valueRange?: number[]; + + /** + * Whether to display gridlines in the chart. This may be set on a per-axis basis to define + * the visibility of each axis' grid separately. + */ + drawGrid?: boolean; + + /** + * Show K/M/B for thousands/millions/billions on y-axis. + */ + labelsKMB?: boolean; + + /** + * Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in + * that it uses base 2, not 10. + */ + labelsKMG2?: boolean; + } + + interface Options extends PerSeriesOptions, PerAxisOptions { + /** + * Set this option to animate the transition between zoom windows. Applies to programmatic + * and interactive zooms. Note that if you also set a drawCallback, it will be called several + * times on each zoom. If you set a zoomCallback, it will only be called after the animation + * is complete. + */ + animatedZooms?: boolean + + /** + * If provided, this function is called whenever the user clicks on an annotation. + */ + annotationClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user double-clicks on an annotation. + */ + annotationDblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user mouses out of an annotation. + */ + annotationMouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user mouses over an annotation. + */ + annotationMouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set + * on a per-axis basis. If an option may be set in this way, it will be noted on this page. + * See also documentation on per-series and + * per-axis options. + */ + axes?: {[axis: string]: PerAxisOptions}; + + /** + * A function to call when the canvas is clicked. + */ + clickCallback?: (e: MouseEvent, xval: number, points: Point[]) => any; + + /** + * If colors is not specified, saturation of the automatically-generated + * data series colors. (0.0-1.0). + */ + colorSaturation?: number; + + /** + * If colors is not specified, value of the data series colors, as in hue/saturation/value. + * (0.0-1.0, default 0.5) + */ + colorValue?: number; + + /** + * List of colors for the data series. These can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow", etc. If not specified, equally-spaced points around a + * color wheel are used. Overridden by the 'color' option. + */ + colors?: string[]; + + /** + * Usually, when Dygraphs encounters a missing value in a data series, it interprets this as + * a gap and draws it as such. If, instead, the missing values represents an x-value for + * which only a different series has data, then you'll want to connect the dots by setting + * this to true. To explicitly include a gap with this option set, use a value of NaN. + */ + connectSeparatedPoints?: boolean; + + /** + * When set, parse each CSV cell as "low;middle;high". Error bars will be drawn for each + * point between low and high, with the series itself going through middle. + */ + customBars?: boolean + + /** + * Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq. + */ + dataHandler?: any; + + /** + * Initially zoom in on a section of the graph. Is of the form [earliest, latest], where + * earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the + * values in dateWindow must also be numbers. + */ + dateWindow?: number[]; + + /** + * The delimiter to look for when separating fields of a CSV file. Setting this to a tab is + * not usually necessary, since tab-delimited data is auto-detected. + */ + delimiter?: string; + + /** + * Unless it's run in scientific mode (see the sigFigs option), dygraphs + * displays numbers with digitsAfterDecimal digits after the decimal point. + * Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', + * '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value + * less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be + * displayed in scientific notation. + */ + digitsAfterDecimal?: number; + + /** + * Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data + * series to be interpreted as annotations on points in that series. This is the same format + * used by Google's AnnotatedTimeLine chart. + */ + displayAnnotations?: boolean; + + /** + * When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those + * positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or + * left graph edge as usual. + */ + drawAxesAtZero?: boolean; + + /** + * When set, this callback gets called every time the dygraph is drawn. This includes the + * initial draw, after zooming and repeatedly while panning. + */ + drawCallback?: (dygraph: Dygraph, is_initial: boolean) => any; + + /** + * Draw points at the edges of gaps in the data. This improves visibility of small data + * segments or other data irregularities. + */ + drawGapEdgePoints?: boolean; + + /** + * Draw a custom item when a point is highlighted. Default is a small dot matching the + * series color. This method should constrain drawing to within pointSize pixels from (cx, + * cy) Also see drawPointCallback + */ + drawHighlightPointCallback?: ( + g: Dygraph, + seriesName: string, + canvasContext: CanvasRenderingContext2D, + cx: number, + cy: number, + color: string, + pointSize: number) => any; + + /** + * Draw a custom item when drawPoints is enabled. Default is a small dot matching the series + * color. This method should constrain drawing to within pointSize pixels from (cx, cy). + * Also see drawHighlightPointCallback + */ + drawPointCallback?: ( + g: Dygraph, + seriesName: string, + canvasContext: CanvasRenderingContext2D, + cx: number, + cy: number, + color: string, + pointSize: number) => any; + + /** + * Does the data contain standard deviations? Setting this to true alters the input format. + */ + errorBars?: boolean; + + /** + * Sets the data being displayed in the chart. This can only be set when calling + * updateOptions; it cannot be set from the constructor. For a full description of valid data + * formats, see the Data Formats page. + */ + file?: DataArray|GVizDataTable|string; + + /** + * When set, attempt to parse each cell in the CSV file as "a/b", where a and b are integers. + * The ratio will be plotted. This allows computation of Wilson confidence intervals (see + * below). + */ + fractions?: boolean; + + /** + * Height, in pixels, of the chart. If the container div has been explicitly sized, this will + * be ignored. + */ + height?: number; + + /** + * Whether to hide the legend when the mouse leaves the chart area. + */ + hideOverlayOnMouseOut?: boolean; + + /** + * When set, this callback gets called every time a new point is highlighted. + */ + highlightCallback?: ( + event: MouseEvent, + xval: number, + points: Point[], + row: number, + seriesName: string) => any; + + /** + * Fade the background while highlighting series. 1=fully visible background (disable + * fading), 0=hiddden background (show highlighted series only). + */ + highlightSeriesBackgroundAlpha?: number; + + /** + * When set, the options from this object are applied to the timeseries closest to the mouse + * pointer for interactive highlighting. See also 'highlightCallback'. Example: + * highlightSeriesOpts: { strokeWidth: 3 }. + */ + highlightSeriesOpts?: PerSeriesOptions; + + /** + * Usually, dygraphs will use the range of the data plus some padding to set the range of the + * y-axis. If this option is set, the y-axis will always include zero, typically as the + * lowest value. This can be used to avoid exaggerating the variance in the data + */ + includeZero?: boolean; + + /** + * TODO(konigsberg): document this + */ + interactionModel?: any; + + /** + * When this option is passed to updateOptions() along with either the + * dateWindow or valueRange options, the zoom flags are not changed + * to reflect a zoomed state. This is primarily useful for when the display area of a chart + * is changed programmatically and also where manual zooming is allowed and use is made of + * the isZoomed method to determine this. + */ + isZoomedIgnoreProgrammaticZoom?: boolean; + + /** + * A name for each data series, including the independent (X) series. For CSV files and + * DataTable objections, this is determined by context. For raw data, this must be specified. + * If it is not, default values are supplied and a warning is logged. + */ + labels?: string[]; + + /** + * Show data labels in an external div, rather than on the graph. This value can either be a + * div element or a div id. + */ + labelsDiv?: string|HTMLElement; + + /** + * Additional styles to apply to the currently-highlighted points div. For example, { + * 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to + * style the .dygraph-legend class than to use this property. + */ + labelsDivStyles?: {[cssProperty: string]: string}; + + /** + * Width (in pixels) of the div which shows information on the currently-highlighted points. + */ + labelsDivWidth?: number; + + /** + * Put <br/> between lines in the label string. Often used in conjunction + * with labelsDiv. + */ + labelsSeparateLines?: boolean; + + /** + * Show zero value labels in the labelsDiv. + */ + labelsShowZeroValues?: boolean; + + /** + * Show date/time labels according to UTC (instead of local time). + */ + labelsUTC?: boolean; + + /** + * When to display the legend. By default, it only appears when a user mouses over the chart. + * Set it to "always" to always display a legend of some sort. When set to "follow", legend + * follows highlighted points. + */ + legend?: 'always' | 'follow' | 'onmouseover'; + + /** + * A value representing the farthest a graph may be panned, in percent of the display. For + * example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the + * displayed values. null means no bounds. + */ + panEdgeFraction?: number; + + /** + * A function (or array of functions) which plot each data series on the chart. TODO(danvk): + * more details! May be set per-series. + */ + plotter?: any; + + /** + * Defines per-graph plugins. Useful for per-graph customization + */ + plugins?: any[]; + + /** + * A function to call when a data point is clicked. and the point that was clicked. + */ + pointClickCallback?: (e: MouseEvent, point: Point) => any; + + /** + * Height, in pixels, of the range selector widget. This option can only be specified at + * Dygraph creation time. + */ + rangeSelectorHeight?: number; + + /** + * The range selector mini plot fill color. This can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off fill. + */ + rangeSelectorPlotFillColor?: string; + + /** + * The range selector mini plot stroke color. This can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off stroke. + */ + rangeSelectorPlotStrokeColor?: string; + + /** + * Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to + * highlight the right-most data point. + */ + rightGap?: number; + + /** + * Number of days over which to average data. Discussed extensively above. + */ + rollPeriod?: number; + + /** + * Defines per-series options. Its keys match the y-axis label names, and the values are + * dictionaries themselves that contain options specific to that series. When this option is + * missing, it falls back on the old-style of per-series options comingled with global + * options. + */ + series?: { + [seriesName: string]: PerSeriesOptions + }; + + /** + * Whether to show the legend upon mouseover. + */ + showLabelsOnHighlight?: boolean; + + /** + * Show or hide the range selector widget. + */ + showRangeSelector?: boolean; + + /** + * If the rolling average period text box should be shown. + */ + showRoller?: boolean; + + /** + * When errorBars is set, shade this many standard deviations above/below each point. + */ + sigma?: number; + + /** + * If set, stack series on top of one another rather than drawing them independently. The + * first series specified in the input data will wind up on top of the chart and the last + * will be on bottom. NaN values are drawn as white areas without a line on top, see + * stackedGraphNaNFill for details. + */ + stackedGraph?: boolean; + + /** + * Controls handling of NaN values inside a stacked graph. NaN values are + * interpolated/extended for stacking purposes, but the actual point value remains NaN in the + * legend display. Valid option values are "all" (interpolate internally, repeat leftmost and + * rightmost value as needed), "inside" (interpolate internally only, use zero outside + * leftmost and rightmost value), and "none" (treat NaN as zero everywhere). + */ + stackedGraphNaNFill?: string; + + /** + * Text to display above the chart. You can supply any HTML for this value, not just text. If + * you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes. + */ + title?: string; + + /** + * Height of the chart title, in pixels. This also controls the default font size of the + * title. If you style the title on your own, this controls how much space is set aside above + * the chart for the title's div. + */ + titleHeight?: number; + + /** + * When set, this callback gets called before the chart is drawn. It details on how to use + * this. + */ + underlayCallback?: (context: CanvasRenderingContext2D, area: dygraphs.Area, dygraph: Dygraph) => any; + + /** + * When set, this callback gets called every time the user stops highlighting any point by + * mousing out of the graph. + */ + unhighlightCallback?: (event: MouseEvent) => any; + + /** + * Which series should initially be visible? Once the Dygraph has been constructed, you can + * access and modify the visibility of each series using the visibility and + * setVisibility methods. + */ + visibility?: boolean[]; + + /** + * Width, in pixels, of the chart. If the container div has been explicitly sized, this will + * be ignored. + */ + width?: number; + + /** + * Use in conjunction with the "fractions" option. Instead of plotting +/- N standard + * deviations, dygraphs will compute a Wilson confidence interval and plot that. This has + * more reasonable behavior for ratios close to 0 or 1. + */ + wilsonInterval?: boolean; + + /** + * Height, in pixels, of the x-axis. If not set explicitly, this is computed based on + * axisLabelFontSize and axisTickSize. + */ + xAxisHeight?: number; + + /** + * Height of the x-axis label, in pixels. This also controls the default font size of the + * x-axis label. If you style the label on your own, this controls how much space is set + * aside below the chart for the x-axis label's div. + */ + xLabelHeight?: number; + + /** + * Add the specified amount of extra space (in pixels) around the X-axis value range to + * ensure points at the edges remain visible. + */ + xRangePad?: number; + + /** + * A function which parses x-values (i.e. the dependent series). Must return a number, even + * when the values are dates. In this case, millis since epoch are used. This is used + * primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which + * it will parse. See code for details. + */ + xValueParser?: (val: string) => number; + + /** + * Text to display below the chart's x-axis. You can supply any HTML for this value, not just + * text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' + * classes. + */ + xlabel?: string; + + /** + * Text to display to the right of the chart's secondary y-axis. This label is only displayed + * if a secondary y-axis is present. See this test for an example of how to do + * this. The comments for the 'ylabel' option generally apply here as well. This label gets a + * 'dygraph-y2label' instead of a 'dygraph-ylabel' class. + */ + y2label?: string; + + /** + * Width of the div which contains the y-axis label. Since the y-axis label appears rotated + * 90 degrees, this actually affects the height of its div. + */ + yLabelWidth?: number; + + /** + * If set, add the specified amount of extra space (in pixels) around the Y-axis value range + * to ensure points at the edges remain visible. If unset, use the traditional Y padding + * algorithm. + */ + yRangePad?: number; + + /** + * Text to display to the left of the chart's y-axis. You can supply any HTML for this value, + * not just text. If you wish to style it using CSS, use the 'dygraph-label' or + * 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may + * behave in unintuitive ways. No additional space is set aside for a y-axis label. If you + * need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth + * option. If you need a wider div for the y-axis label, either style it that way with CSS + * (but remember that it's rotated, so width is controlled by the 'height' property) or set + * the yLabelWidth option. + */ + ylabel?: string; + + /** + * A function to call when the zoom window is changed (either by zooming in or out). + */ + zoomCallback?: (minDate: number, maxDate: number, yRanges: [number, number][]) => any; + } + + interface SeriesProperties { + name: string; + column: number; + visible: boolean; + color: string; + axis: number; + } + + interface Area { + x: number; + y: number; + w: number; + h: number; + } + + /** + * Point structure. + * + * xval_* and yval_* are the original unscaled data values, + * while x_* and y_* are scaled to the range (0.0-1.0) for plotting. + * yval_stacked is the cumulative Y value used for stacking graphs, + * and bottom/top/minus/plus are used for error bar graphs. + */ + interface Point { + idx: number; + name: string; + x?: number; + xval?: number; + y_bottom?: number; + y?: number; + y_stacked?: number; + y_top?: number; + yval_minus?: number; + yval?: number; + yval_plus?: number; + yval_stacked?: number; + annotation?: dygraphs.Annotation; + } + + interface Annotation { + /** The name of the series to which the annotated point belongs. */ + series: string; + + /** + * The x value of the point. This should be the same as the value + * you specified in your CSV file, e.g. "2010-09-13". + * You must set either x or xval. + */ + x?: number|string; + + /** + * numeric value of the point, or millis since epoch. + */ + xval?: number; + + /** Text that will appear on the annotation's flag. */ + shortText?: string; + + /** A longer description of the annotation which will appear when the user hovers over it. */ + text?: string; + + /** + * Specify in place of shortText to mark the annotation with an image rather than text. + * If you specify this, you must specify width and height. + */ + icon?: string; + + /** Width (in pixels) of the annotation flag or icon. */ + width?: number; + /** Height (in pixels) of the annotation flag or icon. */ + height?: number; + + /** CSS class to use for styling the annotation. */ + cssClass?: string; + + /** Height of the tick mark (in pixels) connecting the point to its flag or icon. */ + tickHeight?: number; + + /** If true, attach annotations to the x-axis, rather than to actual points. */ + attachAtBottom?: boolean; + + div?: HTMLDivElement; + + /** This function is called whenever the user clicks on this annotation. */ + clickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** This function is called whenever the user mouses over this annotation. */ + mouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** This function is called whenever the user mouses out of this annotation. */ + mouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** this function is called whenever the user double-clicks on this annotation. */ + dblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + } + + type Axis = 'x' | 'y' | 'y2'; +} + +declare class Dygraph { + constructor( + container: HTMLElement | string, + data: dygraphs.DataArray|dygraphs.GVizDataTable|string|(()=>(dygraphs.DataArray|dygraphs.GVizDataTable|string)), + options?: dygraphs.Options); + + /** + * Returns the zoomed status of the chart for one or both axes. + * + * Axis is an optional parameter. Can be set to 'x' or 'y'. + * + * The zoomed status for an axis is set whenever a user zooms using the mouse + * or when the dateWindow or valueRange are updated (unless the + * isZoomedIgnoreProgrammaticZoom option is also specified). + */ + isZoomed(axis?: 'x' | 'y'): boolean; + + /** + * Returns information about the Dygraph object, including its containing ID. + */ + toString(): string; + + /** + * Returns the current value for an option, as set in the constructor or via + * updateOptions. You may pass in an (optional) series name to get per-series + * values for the option. + * + * All values returned by this method should be considered immutable. If you + * modify them, there is no guarantee that the changes will be honored or that + * dygraphs will remain in a consistent state. If you want to modify an option, + * use updateOptions() instead. + * + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {*} The value of the option. + */ + getOption(name: string, seriesName?: string): any; + + /** + * Get the value of an option on a per-axis basis. + */ + getOptionForAxis(name: string, axis: dygraphs.Axis): any; + + /** + * Returns the current rolling period, as set by the user or an option. + */ + rollPeriod(): number; + + /** + * Returns the currently-visible x-range. This can be affected by zooming, + * panning or a call to updateOptions. + * Returns a two-element array: [left, right]. + * If the Dygraph has dates on the x-axis, these will be millis since epoch. + */ + xAxisRange(): [number, number]; + + /** + * Returns the lower- and upper-bound x-axis values of the data set. + */ + xAxisExtremes(): [number, number]; + + /** + * Returns the currently-visible y-range for an axis. This can be affected by + * zooming, panning or a call to updateOptions. Axis indices are zero-based. If + * called with no arguments, returns the range of the first axis. + * Returns a two-element array: [bottom, top]. + */ + yAxisRange(idx?: number): [number, number]; + + /** + * Returns the currently-visible y-ranges for each axis. This can be affected by + * zooming, panning, calls to updateOptions, etc. + * Returns an array of [bottom, top] pairs, one for each y-axis. + */ + yAxisRanges(): [number, number][]; + + /** + * Convert from data coordinates to canvas/div X/Y coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y] + * + * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord + * instead of toDomCoords(null, y, axis). + */ + toDomCoords(x: number, y: number, axis?: number): [number, number]; + + /** + * Convert from data x coordinates to canvas/div X coordinate. + * If specified, do this conversion for the coordinate system of a particular + * axis. + * Returns a single value or null if x is null. + */ + toDomXCoord(x: number): number; + + /** + * Convert from data y coordinates to canvas/div Y coordinate and optional + * axis. Uses the first axis by default. + * + * returns a single value or null if y is null. + */ + toDomYCoord(y: number, axis?: number): number; + + /** + * Convert from canvas/div coords to data coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y]. + * + * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord + * instead of toDataCoords(null, y, axis). + */ + toDataCoords(x: number, y: number, axis?: number): [number, number]; + + /** + * Convert from canvas/div x coordinate to data coordinate. + * + * If x is null, this returns null. + */ + toDataXCoord(x: number): number; + + /** + * Convert from canvas/div y coord to value. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + */ + toDataYCoord(y: number, axis?: number): number; + + /** + * Converts a y for an axis to a percentage from the top to the + * bottom of the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the top of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + * + * @param {number} y The data y-coordinate. + * @param {number} [axis] The axis number on which the data coordinate lives. + * @return {number} A fraction in [0, 1] where 0 = the top edge. + */ + toPercentYCoord(y: number, axis?: number): number; + + /** + * Converts an x value to a percentage from the left to the right of + * the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the left of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If x is null, this returns null. + * @param {number} x The data x-coordinate. + * @return {number} A fraction in [0, 1] where 0 = the left edge. + */ + toPercentXCoord(x: number): number; + + /** + * Returns the number of columns (including the independent variable). + */ + numColumns(): number; + + /** + * Returns the number of rows (excluding any header/label row). + */ + numRows(): number; + + /** + * Returns the value in the given row and column. If the row and column exceed + * the bounds on the data, returns null. Also returns null if the value is + * missing. + * @param {number} row The row number of the data (0-based). Row 0 is the + * first row of data, not a header row. + * @param {number} col The column number of the data (0-based) + * @return {number} The value in the specified cell or null if the row/col + * were out of range. + */ + getValue(row: number, col: number): number; + + /** + * Detach DOM elements in the dygraph and null out all data references. + * Calling this when you're done with a dygraph can dramatically reduce memory + * usage. See, e.g., the tests/perf.html example. + */ + destroy(): void; + + /** + * Return the list of colors. This is either the list of colors passed in the + * attributes or the autogenerated list of rgb(r,g,b) strings. + * This does not return colors for invisible series. + * @return {Array.} The list of colors. + */ + getColors(): string[]; + + /** + * Returns a few attributes of a series, i.e. its color, its visibility, which + * axis it's assigned to, and its column in the original data. + * Returns null if the series does not exist. + * Otherwise, returns an object with column, visibility, color and axis properties. + * The "axis" property will be set to 1 for y1 and 2 for y2. + * The "column" property can be fed back into getValue(row, column) to get + * values for this series. + */ + getPropertiesForSeries(series_name: string): dygraphs.SeriesProperties; + + /** + * Reset the zoom to the original view coordinates. This is the same as + * double-clicking on the graph. + */ + resetZoom(): void; + + /** + * Get the current graph's area object. + */ + getArea(): dygraphs.Area; + + /** + * Convert a mouse event to DOM coordinates relative to the graph origin. + * + * Returns a two-element array: [X, Y]. + */ + eventToDomCoords(event: MouseEvent): [number, number]; + + /** + * Manually set the selected points and display information about them in the + * legend. The selection can be cleared using clearSelection() and queried + * using getSelection(). + * @param {number} row Row number that should be highlighted (i.e. appear with + * hover dots on the chart). + * @param {seriesName} optional series name to highlight that series with the + * the highlightSeriesOpts setting. + * @param { locked } optional If true, keep seriesName selected when mousing + * over the graph, disabling closest-series highlighting. Call clearSelection() + * to unlock it. + */ + setSelection(row: number|boolean, seriesName?: string, locked?: boolean): void; + + /** + * Clears the current selection (i.e. points that were highlighted by moving + * the mouse over the chart). + */ + clearSelection(): void; + + /** + * Returns the number of the currently selected row. To get data for this row, + * you can use the getValue method. + * @return {number} row number, or -1 if nothing is selected + */ + getSelection(): number; + + /** + * Returns the name of the currently-highlighted series. + * Only available when the highlightSeriesOpts option is in use. + */ + getHighlightSeries(): string; + + /** + * Returns true if the currently-highlighted series was locked + * via setSelection(..., seriesName, true). + */ + isSeriesLocked(): boolean; + + /** + * Returns the number of y-axes on the chart. + */ + numAxes(): number; + + /** + * Changes various properties of the graph. These can include: + *
    + *
  • file: changes the source data for the graph
  • + *
  • errorBars: changes whether the data contains stddev
  • + *
+ * + * There's a huge variety of options that can be passed to this method. For a + * full list, see http://dygraphs.com/options.html. + * + * @param {Object} input_attrs The new properties and values + * @param {boolean} block_redraw Usually the chart is redrawn after every + * call to updateOptions(). If you know better, you can pass true to + * explicitly block the redraw. This can be useful for chaining + * updateOptions() calls, avoiding the occasional infinite loop and + * preventing redraws when it's not necessary (e.g. when updating a + * callback). + */ + updateOptions(input_attrs: dygraphs.Options, block_redraw?: boolean): void; + + /** + * Resizes the dygraph. If no parameters are specified, resizes to fill the + * containing div (which has presumably changed size since the dygraph was + * instantiated. If the width/height are specified, the div will be resized. + * + * This is far more efficient than destroying and re-instantiating a + * Dygraph, since it doesn't have to reparse the underlying data. + * + * @param {number} width Width (in pixels) + * @param {number} height Height (in pixels) + */ + resize(width: number, height: number): void; + + /** + * Adjusts the number of points in the rolling average. Updates the graph to + * reflect the new averaging period. + * @param {number} length Number of points over which to average the data. + */ + adjustRoll(length: number): void; + + /** + * Returns a boolean array of visibility statuses. + */ + visibility(): boolean[]; + + /** + * Changes the visiblity of a series. + * + * @param {number} num the series index + * @param {boolean} value true or false, identifying the visibility. + */ + setVisibility(num: number, value: boolean): void; + + /** + * Update the list of annotations and redraw the chart. + * See dygraphs.com/annotations.html for more info on how to use annotations. + * @param ann {Array} An array of annotation objects. + * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional). + */ + setAnnotations(ann: dygraphs.Annotation[], suppressDraw?: boolean): void; + + /** + * Return the list of annotations. + */ + annotations(): dygraphs.Annotation[]; + + /** + * Get the list of label names for this graph. The first column is the + * x-axis, so the data series names start at index 1. + * + * Returns null when labels have not yet been defined. + */ + getLabels(): string[]; + + /** + * Get the index of a series (column) given its name. The first column is the + * x-axis, so the data series start with index 1. + */ + indexFromSetName(name: string): number; + + /** + * Trigger a callback when the dygraph has drawn itself and is ready to be + * manipulated. This is primarily useful when dygraphs has to do an XHR for the + * data (i.e. a URL is passed as the data source) and the chart is drawn + * asynchronously. If the chart has already drawn, the callback will fire + * immediately. + * + * This is a good place to call setAnnotations(). + */ + ready(callback: (g: Dygraph) => any): void; + + // Tick granularities (passed to ticker). + static SECONDLY: number; + static TWO_SECONDLY: number; + static FIVE_SECONDLY: number; + static TEN_SECONDLY: number; + static THIRTY_SECONDLY: number; + static MINUTELY: number; + static TWO_MINUTELY: number; + static FIVE_MINUTELY: number; + static TEN_MINUTELY: number; + static THIRTY_MINUTELY: number; + static HOURLY: number; + static TWO_HOURLY: number; + static SIX_HOURLY: number; + static DAILY: number; + static TWO_DAILY: number; + static WEEKLY: number; + static MONTHLY: number; + static QUARTERLY: number; + static BIANNUAL: number; + static ANNUAL: number; + static DECADAL: number; + static CENTENNIAL: number; + static NUM_GRANULARITIES: number; + + static defaultInteractionModel: any; + + static DOTTED_LINE: number[]; + static DASHED_LINE: number[]; + static DOT_DASH_LINE: number[]; + + static Plotters: { + errorPlotter: any; + linePlotter: any; + fillPlotter: any; + } +} + +declare module "dygraphs" { + export = Dygraph; +} \ No newline at end of file From 0b25714182083b92e22c046d0bba1da0182fddd8 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 24 Sep 2016 11:51:14 -0400 Subject: [PATCH 12/31] code review --- dygraphs/dygraphs.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dygraphs/dygraphs.d.ts b/dygraphs/dygraphs.d.ts index 21d4b2acae..066e0d4a04 100644 --- a/dygraphs/dygraphs.d.ts +++ b/dygraphs/dygraphs.d.ts @@ -305,7 +305,11 @@ declare namespace dygraphs { * See also documentation on per-series and * per-axis options. */ - axes?: {[axis: string]: PerAxisOptions}; + axes?: { + x?: PerAxisOptions; + y?: PerAxisOptions; + y2?: PerAxisOptions; + }; /** * A function to call when the canvas is clicked. @@ -487,9 +491,6 @@ declare namespace dygraphs { */ includeZero?: boolean; - /** - * TODO(konigsberg): document this - */ interactionModel?: any; /** @@ -557,8 +558,8 @@ declare namespace dygraphs { panEdgeFraction?: number; /** - * A function (or array of functions) which plot each data series on the chart. TODO(danvk): - * more details! May be set per-series. + * A function (or array of functions) which plot each data series on the chart. + * TODO(danvk): more details! May be set per-series. */ plotter?: any; From 9d4378f79c3105f715590a5203a8c5d3020834c2 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 24 Sep 2016 11:51:51 -0400 Subject: [PATCH 13/31] 2 spaces --> 4 spaces --- dygraphs/dygraphs-tests.ts | 1074 ++++++++-------- dygraphs/dygraphs.d.ts | 2418 ++++++++++++++++++------------------ 2 files changed, 1746 insertions(+), 1746 deletions(-) diff --git a/dygraphs/dygraphs-tests.ts b/dygraphs/dygraphs-tests.ts index 8c7318b429..bd99fc0ac1 100644 --- a/dygraphs/dygraphs-tests.ts +++ b/dygraphs/dygraphs-tests.ts @@ -3,597 +3,597 @@ /// function demo() { - const g14 = new Dygraph( - document.getElementById("div_g14"), - 'data', { - rollPeriod: 14, - errorBars: true, - labelsDivWidth: 100, - labelsDivStyles: { - 'boxShadow': '4px 4px 4px #888' - }, - labelsSeparateLines: true, - } - ); + const g14 = new Dygraph( + document.getElementById("div_g14"), + 'data', { + rollPeriod: 14, + errorBars: true, + labelsDivWidth: 100, + labelsDivStyles: { + 'boxShadow': '4px 4px 4px #888' + }, + labelsSeparateLines: true, + } + ); } function twoAxes() { - var data = [] as number[][]; + var data = [] as number[][]; - var g = new Dygraph( - document.getElementById("demodiv"), - data, - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - series: { - 'Y3': { - axis: 'y2' - }, - 'Y4': { - axis: 'y2' - }, - }, - axes: { - y2: { - // set axis-related properties here - labelsKMB: true - }, - y: { - axisLabelWidth: 60 - } - }, - ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', - } - ); - - var g2 = new Dygraph( - document.getElementById("demodiv_y2_primary"), - data, - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', - series : { - 'Y3': { - axis: 'y2' - }, - 'Y4': { - axis: 'y2' - } - }, - axes: { - y: { - // set axis-related properties here - drawGrid: false, - independentTicks: false - }, - y2: { - // set axis-related properties here - labelsKMB: true, - drawGrid: true, - independentTicks: true - } - } - } - ); - - var g3 = new Dygraph( - document.getElementById("demodiv_two_grids"), - data, - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', - series : { - 'Y3': { - axis: 'y2' - }, - 'Y4': { - axis: 'y2' - } - }, - axes: { - y2: { - // set axis-related properties here - labelsKMB: true, - drawGrid: true, - independentTicks: true, - gridLinePattern: [2,2] - } - } - } - ); + var g = new Dygraph( + document.getElementById("demodiv"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + series: { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + }, + }, + axes: { + y2: { + // set axis-related properties here + labelsKMB: true + }, + y: { + axisLabelWidth: 60 + } + }, + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + } + ); + + var g2 = new Dygraph( + document.getElementById("demodiv_y2_primary"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y: { + // set axis-related properties here + drawGrid: false, + independentTicks: false + }, + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true + } + } + } + ); + + var g3 = new Dygraph( + document.getElementById("demodiv_two_grids"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true, + gridLinePattern: [2,2] + } + } + } + ); - var g4 = new Dygraph( - document.getElementById("demodiv_one"), - data, - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - labelsKMB: true, - ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', - } - ); - - var g5 = new Dygraph( - document.getElementById("demodiv_one_right"), - data, - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', - series : { - 'Y1': { - axis: 'y2' - }, - 'Y2': { - axis: 'y2' - }, - 'Y3': { - axis: 'y2' - }, - 'Y4': { - axis: 'y2' + var g4 = new Dygraph( + document.getElementById("demodiv_one"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + labelsKMB: true, + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', } - }, - axes: { - y: { - // set axis-related properties here - drawGrid: false, - independentTicks: false - }, - y2: { - // set axis-related properties here - labelsKMB: true, - drawGrid: true, - independentTicks: true + ); + + var g5 = new Dygraph( + document.getElementById("demodiv_one_right"), + data, + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + ylabel: 'Primary y-axis', + y2label: 'Secondary y-axis', + series : { + 'Y1': { + axis: 'y2' + }, + 'Y2': { + axis: 'y2' + }, + 'Y3': { + axis: 'y2' + }, + 'Y4': { + axis: 'y2' + } + }, + axes: { + y: { + // set axis-related properties here + drawGrid: false, + independentTicks: false + }, + y2: { + // set axis-related properties here + labelsKMB: true, + drawGrid: true, + independentTicks: true + } + } } - } + ); + + function update(el: HTMLInputElement) { + g.updateOptions( { fillGraph: el.checked } ); + g2.updateOptions( { fillGraph: el.checked } ); + g3.updateOptions( { fillGraph: el.checked } ); + g4.updateOptions( { fillGraph: el.checked } ); + g5.updateOptions( { fillGraph: el.checked } ); } - ); - - function update(el: HTMLInputElement) { - g.updateOptions( { fillGraph: el.checked } ); - g2.updateOptions( { fillGraph: el.checked } ); - g3.updateOptions( { fillGraph: el.checked } ); - g4.updateOptions( { fillGraph: el.checked } ); - g5.updateOptions( { fillGraph: el.checked } ); - } } function perSeries() { - var data = '1234'; - var g = new Dygraph( - document.getElementById("demodiv"), - data, - { - strokeWidth: 2, - series : { - 'parabola': { - strokeWidth: 0.0, - drawPoints: true, - pointSize: 4, - highlightCircleSize: 6 - }, - 'line': { - strokeWidth: 1.0, - drawPoints: true, - pointSize: 1.5 - }, - 'sine wave': { - strokeWidth: 3, - highlightCircleSize: 10 - }, - 'sine wave2': { - strokePattern: [10, 2, 5, 2], - strokeWidth: 2, - highlightCircleSize: 3 - } - } - } - ); + var data = '1234'; + var g = new Dygraph( + document.getElementById("demodiv"), + data, + { + strokeWidth: 2, + series : { + 'parabola': { + strokeWidth: 0.0, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'sine wave': { + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: [10, 2, 5, 2], + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); - var g2 = new Dygraph( - document.getElementById("demodiv2"), - data, - { - legend: 'always', - strokeWidth: 2, - series: { - 'parabola': { - strokePattern: null, - drawPoints: true, - pointSize: 4, - highlightCircleSize: 6 - }, - 'line': { - strokePattern: Dygraph.DASHED_LINE, - strokeWidth: 1.0, - drawPoints: true, - pointSize: 1.5 - }, - 'another line': { - strokePattern: [25, 5] - }, - 'sine wave': { - strokePattern: Dygraph.DOTTED_LINE, - strokeWidth: 3, - highlightCircleSize: 10 - }, - 'sine wave2': { - strokePattern: Dygraph.DOT_DASH_LINE, - strokeWidth: 2, - highlightCircleSize: 3 - } - } - } - ); + var g2 = new Dygraph( + document.getElementById("demodiv2"), + data, + { + legend: 'always', + strokeWidth: 2, + series: { + 'parabola': { + strokePattern: null, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokePattern: Dygraph.DASHED_LINE, + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'another line': { + strokePattern: [25, 5] + }, + 'sine wave': { + strokePattern: Dygraph.DOTTED_LINE, + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: Dygraph.DOT_DASH_LINE, + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); - var g3 = new Dygraph( - document.getElementById("demodiv3"), - data, - { - strokeWidth: 2, - series: { - 'parabola': { - strokeWidth: 0.0, - drawPoints: true, - pointSize: 4, - highlightCircleSize: 6 - }, - 'line': { - strokeWidth: 1.0, - drawPoints: true, - pointSize: 1.5 - }, - 'sine wave': { - strokeWidth: 3, - highlightCircleSize: 10 - }, - 'sine wave2': { - strokePattern: [10, 2, 5, 2], - strokeWidth: 2, - highlightCircleSize: 3 - } - } - } - ); + var g3 = new Dygraph( + document.getElementById("demodiv3"), + data, + { + strokeWidth: 2, + series: { + 'parabola': { + strokeWidth: 0.0, + drawPoints: true, + pointSize: 4, + highlightCircleSize: 6 + }, + 'line': { + strokeWidth: 1.0, + drawPoints: true, + pointSize: 1.5 + }, + 'sine wave': { + strokeWidth: 3, + highlightCircleSize: 10 + }, + 'sine wave2': { + strokePattern: [10, 2, 5, 2], + strokeWidth: 2, + highlightCircleSize: 3 + } + } + } + ); } function highlightedRegion() { - var highlight_start = 0, highlight_end = 0; - var g = new Dygraph( - document.getElementById("div_g"), - [], - { - labels: ['X', 'Est.', 'Actual'], - animatedZooms: true, - underlayCallback: function(canvas, area, g) { - var bottom_left = g.toDomCoords(highlight_start, -20); - var top_right = g.toDomCoords(highlight_end, +20); + var highlight_start = 0, highlight_end = 0; + var g = new Dygraph( + document.getElementById("div_g"), + [], + { + labels: ['X', 'Est.', 'Actual'], + animatedZooms: true, + underlayCallback: function(canvas, area, g) { + var bottom_left = g.toDomCoords(highlight_start, -20); + var top_right = g.toDomCoords(highlight_end, +20); - var left = bottom_left[0]; - var right = top_right[0]; + var left = bottom_left[0]; + var right = top_right[0]; - canvas.fillStyle = "rgba(255, 255, 102, 1.0)"; - canvas.fillRect(left, area.y, right - left, area.h); - } + canvas.fillStyle = "rgba(255, 255, 102, 1.0)"; + canvas.fillRect(left, area.y, right - left, area.h); + } - } - ); + } + ); } function makeGraph(className: string, numSeries: number, numRows: number, isStacked: boolean) { - var div = document.createElement('div'); - div.className = className; - div.style.display = 'inline-block'; - document.body.appendChild(div); + var div = document.createElement('div'); + div.className = className; + div.style.display = 'inline-block'; + document.body.appendChild(div); - var labels = ['x']; - for (var i = 0; i < numSeries; ++i) { - var label = '' + i; - label = 's' + '000'.substr(label.length) + label; - labels[i + 1] = label; - } - var g = new Dygraph( - div, - 'data', - { - width: 480, - height: 320, - labels: labels.slice(), - stackedGraph: isStacked, + var labels = ['x']; + for (var i = 0; i < numSeries; ++i) { + var label = '' + i; + label = 's' + '000'.substr(label.length) + label; + labels[i + 1] = label; + } + var g = new Dygraph( + div, + 'data', + { + width: 480, + height: 320, + labels: labels.slice(), + stackedGraph: isStacked, - highlightCircleSize: 2, - strokeWidth: 1, - strokeBorderWidth: isStacked ? null : 1, + highlightCircleSize: 2, + strokeWidth: 1, + strokeBorderWidth: isStacked ? null : 1, - highlightSeriesOpts: { - strokeWidth: 3, - strokeBorderWidth: 1, - highlightCircleSize: 5, - }, - }); - g.setSelection(false, 's005'); + highlightSeriesOpts: { + strokeWidth: 3, + strokeBorderWidth: 1, + highlightCircleSize: 5, + }, + }); + g.setSelection(false, 's005'); }; function linearRegressionAddSeries() { - var labels = ['X', 'Y1', 'Y2']; - var orig_colors = [] as string[]; + var labels = ['X', 'Y1', 'Y2']; + var orig_colors = [] as string[]; - var g = new Dygraph( - document.getElementById("demodiv"), - 'data', - { - labels: labels, - drawPoints: true, - strokeWidth: 0.0, - drawCallback: function(g, is_initial) { - if (!is_initial) return; - var c = g.getColors(); - for (var i = 0; i < c.length; i++) orig_colors.push(c[i]); - } - } - ); + var g = new Dygraph( + document.getElementById("demodiv"), + 'data', + { + labels: labels, + drawPoints: true, + strokeWidth: 0.0, + drawCallback: function(g, is_initial) { + if (!is_initial) return; + var c = g.getColors(); + for (var i = 0; i < c.length; i++) orig_colors.push(c[i]); + } + } + ); } function callbacks() { - var s = document.getElementById("status"); - var g: Dygraph = null; - var pts_info = function(e: MouseEvent, x: number, pts: dygraphs.Point[], row?: number) { - var str = "(" + x + ") "; - for (var i = 0; i < pts.length; i++) { - var p = pts[i]; - if (i) str += ", "; - str += p.name + ": " + p.yval; - } - - var x = e.offsetX; - var y = e.offsetY; - var dataXY = g.toDataCoords(x, y); - str += ", (" + x + ", " + y + ")"; - str += " -> (" + dataXY[0] + ", " + dataXY[1] + ")"; - str += ", row #"+row; - - return str; - }; - - g = new Dygraph( - document.getElementById("div_g"), - 'NoisyData', { - rollPeriod: 7, - showRoller: true, - errorBars: true, - - highlightCallback: function(e, x, pts, row) { - s.innerHTML += "Highlight " + pts_info(e,x,pts,row) + "
"; - }, - - unhighlightCallback: function(e) { - s.innerHTML += "Unhighlight
"; - }, - - clickCallback: function(e, x, pts) { - s.innerHTML += "Click " + pts_info(e,x,pts) + "
"; - }, - - pointClickCallback: function(e, p) { - s.innerHTML += "Point Click " + p.name + ": " + p.x + "
"; - }, - - zoomCallback: function(minX, maxX, yRanges) { - s.innerHTML += "Zoom [" + minX + ", " + maxX + ", [" + yRanges + "]]
"; - }, - - drawCallback: function(g) { - s.innerHTML += "Draw [" + g.xAxisRange() + "]
"; - } + var s = document.getElementById("status"); + var g: Dygraph = null; + var pts_info = function(e: MouseEvent, x: number, pts: dygraphs.Point[], row?: number) { + var str = "(" + x + ") "; + for (var i = 0; i < pts.length; i++) { + var p = pts[i]; + if (i) str += ", "; + str += p.name + ": " + p.yval; } - ); + + var x = e.offsetX; + var y = e.offsetY; + var dataXY = g.toDataCoords(x, y); + str += ", (" + x + ", " + y + ")"; + str += " -> (" + dataXY[0] + ", " + dataXY[1] + ")"; + str += ", row #"+row; + + return str; + }; + + g = new Dygraph( + document.getElementById("div_g"), + 'NoisyData', { + rollPeriod: 7, + showRoller: true, + errorBars: true, + + highlightCallback: function(e, x, pts, row) { + s.innerHTML += "Highlight " + pts_info(e,x,pts,row) + "
"; + }, + + unhighlightCallback: function(e) { + s.innerHTML += "Unhighlight
"; + }, + + clickCallback: function(e, x, pts) { + s.innerHTML += "Click " + pts_info(e,x,pts) + "
"; + }, + + pointClickCallback: function(e, p) { + s.innerHTML += "Point Click " + p.name + ": " + p.x + "
"; + }, + + zoomCallback: function(minX, maxX, yRanges) { + s.innerHTML += "Zoom [" + minX + ", " + maxX + ", [" + yRanges + "]]
"; + }, + + drawCallback: function(g) { + s.innerHTML += "Draw [" + g.xAxisRange() + "]
"; + } + } + ); } function valueAxisFormatters() { - function formatDate(d: Date) { - var yyyy = d.getFullYear(), - mm = d.getMonth() + 1, - dd = d.getDate(); - return yyyy + '-' + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd; - } - - var g = new Dygraph( - document.getElementById("demodiv"), - 'data', - { - labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], - width: 640, - height: 350, - series: { - 'Y3': { axis: 'y2' }, - 'Y4': { axis: 'y2' } - }, - axes: { - x: { - valueFormatter: function(ms) { - return 'xvf(' + formatDate(new Date(ms)) + ')'; - }, - axisLabelFormatter: function(d: Date) { - return 'xalf(' + formatDate(d) + ')'; - }, - pixelsPerLabel: 100, - axisLabelWidth: 100, - }, - y: { - valueFormatter: function(y) { - return 'yvf(' + y.toPrecision(2) + ')'; - }, - axisLabelFormatter: function(y: number) { - return 'yalf(' + y.toPrecision(2) + ')'; - }, - axisLabelWidth: 100, - }, - y2: { - valueFormatter: function(y2) { - return 'y2vf(' + y2.toPrecision(2) + ')'; - }, - axisLabelFormatter: function(y2: number) { - return 'y2alf(' + y2.toPrecision(2) + ')'; + function formatDate(d: Date) { + var yyyy = d.getFullYear(), + mm = d.getMonth() + 1, + dd = d.getDate(); + return yyyy + '-' + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd; } - } - } - }); + + var g = new Dygraph( + document.getElementById("demodiv"), + 'data', + { + labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], + width: 640, + height: 350, + series: { + 'Y3': { axis: 'y2' }, + 'Y4': { axis: 'y2' } + }, + axes: { + x: { + valueFormatter: function(ms) { + return 'xvf(' + formatDate(new Date(ms)) + ')'; + }, + axisLabelFormatter: function(d: Date) { + return 'xalf(' + formatDate(d) + ')'; + }, + pixelsPerLabel: 100, + axisLabelWidth: 100, + }, + y: { + valueFormatter: function(y) { + return 'yvf(' + y.toPrecision(2) + ')'; + }, + axisLabelFormatter: function(y: number) { + return 'yalf(' + y.toPrecision(2) + ')'; + }, + axisLabelWidth: 100, + }, + y2: { + valueFormatter: function(y2) { + return 'y2vf(' + y2.toPrecision(2) + ')'; + }, + axisLabelFormatter: function(y2: number) { + return 'y2alf(' + y2.toPrecision(2) + ')'; + } + } + } + }); } function annotation() { var eventDiv = document.getElementById("events"); - function nameAnnotation(ann: dygraphs.Annotation) { - return "(" + ann.series + ", " + ann.x + ")"; - } + function nameAnnotation(ann: dygraphs.Annotation) { + return "(" + ann.series + ", " + ann.x + ")"; + } - var annotations = [] as dygraphs.Annotation[]; - var graph_initialized = false; + var annotations = [] as dygraphs.Annotation[]; + var graph_initialized = false; - var g = new Dygraph( - document.getElementById("g_div"), - function() { - var zp = function(x: number) { if (x < 10) return "0"+x; else return ''+x; }; - var r = "date,parabola,line,another line,sine wave\n"; - for (var i=1; i<=31; i++) { - r += "200610" + zp(i); - r += "," + 10*(i*(31-i)); - r += "," + 10*(8*i); - r += "," + 10*(250 - 8*i); - r += "," + 10*(125 + 125 * Math.sin(0.3*i)); - r += "\n"; - } - return r; - }, - { - rollPeriod: 1, - showRoller: true, - width: 480, - height: 320, - drawCallback: function(g, is_initial) { - if (is_initial) { - graph_initialized = true; - if (annotations.length > 0) { - g.setAnnotations(annotations); - } - } + var g = new Dygraph( + document.getElementById("g_div"), + function() { + var zp = function(x: number) { if (x < 10) return "0"+x; else return ''+x; }; + var r = "date,parabola,line,another line,sine wave\n"; + for (var i=1; i<=31; i++) { + r += "200610" + zp(i); + r += "," + 10*(i*(31-i)); + r += "," + 10*(8*i); + r += "," + 10*(250 - 8*i); + r += "," + 10*(125 + 125 * Math.sin(0.3*i)); + r += "\n"; + } + return r; + }, + { + rollPeriod: 1, + showRoller: true, + width: 480, + height: 320, + drawCallback: function(g, is_initial) { + if (is_initial) { + graph_initialized = true; + if (annotations.length > 0) { + g.setAnnotations(annotations); + } + } - var ann = g.annotations(); - var html = ""; - for (var i = 0; i < ann.length; i++) { - var name = nameAnnotation(ann[i]); - html += "" - html += name + ": " + (ann[i].shortText || '(icon)') - html += " -> " + ann[i].text + "
"; - } - document.getElementById("list").innerHTML = html; - } - } - ); + var ann = g.annotations(); + var html = ""; + for (var i = 0; i < ann.length; i++) { + var name = nameAnnotation(ann[i]); + html += "" + html += name + ": " + (ann[i].shortText || '(icon)') + html += " -> " + ann[i].text + "
"; + } + document.getElementById("list").innerHTML = html; + } + } + ); - var last_ann = 0; - for (var x = 10; x < 15; x += 2) { + var last_ann = 0; + for (var x = 10; x < 15; x += 2) { + annotations.push( { + series: 'sine wave', + x: "200610" + x, + shortText: '' + x, + text: 'Stock Market Crash ' + x + } ); + last_ann = x; + } annotations.push( { - series: 'sine wave', - x: "200610" + x, - shortText: '' + x, - text: 'Stock Market Crash ' + x + series: 'another line', + x: "20061013", + icon: 'dollar.png', + width: 18, + height: 23, + tickHeight: 4, + text: 'Another one', + cssClass: 'annotation', + clickHandler: function() { + document.getElementById("events").innerHTML += "special handler
"; + } } ); - last_ann = x; - } - annotations.push( { - series: 'another line', - x: "20061013", - icon: 'dollar.png', - width: 18, - height: 23, - tickHeight: 4, - text: 'Another one', - cssClass: 'annotation', - clickHandler: function() { - document.getElementById("events").innerHTML += "special handler
"; - } - } ); - annotations.push( { - series: 'parabola', - x: '20061012', - shortText: 'P', - text: 'Parabola Annotation at same x-coord' - } ); - - if (graph_initialized) { - g.setAnnotations(annotations); - } - - function add() { - var x = last_ann + 2; - var annnotations = g.annotations(); - annotations.push({ - series: 'line', - x: "200610" + x, - shortText: ''+x, - text: 'Line ' + x, - tickHeight: 10 + annotations.push( { + series: 'parabola', + x: '20061012', + shortText: 'P', + text: 'Parabola Annotation at same x-coord' } ); - last_ann = x; - g.setAnnotations(annotations); - } - function bottom(el: HTMLInputElement) { - var to_bottom = true; - if (el.value != 'Shove to bottom') to_bottom = false; - - var anns = g.annotations(); - for (var i = 0; i < anns.length; i++) { - anns[i].attachAtBottom = to_bottom; + if (graph_initialized) { + g.setAnnotations(annotations); } - g.setAnnotations(anns); - if (to_bottom) { - el.value = 'Lift back up'; - } else { - el.value = 'Shove to bottom'; + function add() { + var x = last_ann + 2; + var annnotations = g.annotations(); + annotations.push({ + series: 'line', + x: "200610" + x, + shortText: ''+x, + text: 'Line ' + x, + tickHeight: 10 + } ); + last_ann = x; + g.setAnnotations(annotations); } - } - var saveBg = ''; - var num = 0; - g.updateOptions( { - annotationClickHandler: function(ann, point, dg, event) { - eventDiv.innerHTML += "click: " + nameAnnotation(ann) + "
"; - }, - annotationDblClickHandler: function(ann, point, dg, event) { - eventDiv.innerHTML += "dblclick: " + nameAnnotation(ann) + "
"; - }, - annotationMouseOverHandler: function(ann, point, dg, event) { - document.getElementById(nameAnnotation(ann)).style.fontWeight = 'bold'; - saveBg = ann.div.style.backgroundColor; - ann.div.style.backgroundColor = '#ddd'; - }, - annotationMouseOutHandler: function(ann, point, dg, event) { - document.getElementById(nameAnnotation(ann)).style.fontWeight = 'normal'; - ann.div.style.backgroundColor = saveBg; - }, + function bottom(el: HTMLInputElement) { + var to_bottom = true; + if (el.value != 'Shove to bottom') to_bottom = false; - pointClickCallback: function(event, p) { - // Check if the point is already annotated. - if (p.annotation) return; + var anns = g.annotations(); + for (var i = 0; i < anns.length; i++) { + anns[i].attachAtBottom = to_bottom; + } + g.setAnnotations(anns); - // If not, add one. - var ann = { - series: p.name, - xval: p.xval, - shortText: '' + num, - text: "Annotation #" + num - }; - var anns = g.annotations(); - anns.push(ann); - g.setAnnotations(anns); - - num++; + if (to_bottom) { + el.value = 'Lift back up'; + } else { + el.value = 'Shove to bottom'; + } } - }); + + var saveBg = ''; + var num = 0; + g.updateOptions( { + annotationClickHandler: function(ann, point, dg, event) { + eventDiv.innerHTML += "click: " + nameAnnotation(ann) + "
"; + }, + annotationDblClickHandler: function(ann, point, dg, event) { + eventDiv.innerHTML += "dblclick: " + nameAnnotation(ann) + "
"; + }, + annotationMouseOverHandler: function(ann, point, dg, event) { + document.getElementById(nameAnnotation(ann)).style.fontWeight = 'bold'; + saveBg = ann.div.style.backgroundColor; + ann.div.style.backgroundColor = '#ddd'; + }, + annotationMouseOutHandler: function(ann, point, dg, event) { + document.getElementById(nameAnnotation(ann)).style.fontWeight = 'normal'; + ann.div.style.backgroundColor = saveBg; + }, + + pointClickCallback: function(event, p) { + // Check if the point is already annotated. + if (p.annotation) return; + + // If not, add one. + var ann = { + series: p.name, + xval: p.xval, + shortText: '' + num, + text: "Annotation #" + num + }; + var anns = g.annotations(); + anns.push(ann); + g.setAnnotations(anns); + + num++; + } + }); } diff --git a/dygraphs/dygraphs.d.ts b/dygraphs/dygraphs.d.ts index 066e0d4a04..cc21caf766 100644 --- a/dygraphs/dygraphs.d.ts +++ b/dygraphs/dygraphs.d.ts @@ -4,1270 +4,1270 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace dygraphs { - type DataArray = number[][]; + type DataArray = number[][]; - // TODO: check for another DT definition to use here. - interface GVizDataTable { - getNumberOfRows(): number; - getNumberOfColumns(): number; - getValue(rowIndex: number, columnIndex: number): number; - } + // TODO: check for another DT definition to use here. + interface GVizDataTable { + getNumberOfRows(): number; + getNumberOfColumns(): number; + getValue(rowIndex: number, columnIndex: number): number; + } - interface PerSeriesOptions { - /** - * Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be - * set per-series. - */ - axis?: 'y1' | 'y2'; + interface PerSeriesOptions { + /** + * Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be + * set per-series. + */ + axis?: 'y1' | 'y2'; + + /** + * A per-series color definition. Used in conjunction with, and overrides, the colors option. + */ + color?: string; + + /** + * Draw a small dot at each point, in addition to a line going through the point. This makes + * the individual data points easier to see, but can increase visual clutter in the chart. + * The small dot can be replaced with a custom rendering by supplying a drawPointCallback. + */ + drawPoints?: boolean; + + /** + * Error bars (or custom bars) for each series are drawn in the same color as the series, but + * with partial transparency. This sets the transparency. A value of 0.0 means that the error + * bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark + * as the line for the series itself. This can be used to produce chart lines whose thickness + * varies at each point. + */ + fillAlpha?: number; + + /** + * Should the area underneath the graph be filled? This option is not compatible with error + * bars. This may be set on a per-series basis. + */ + fillGraph?: boolean; + + /** + * The size in pixels of the dot drawn over highlighted points. + */ + highlightCircleSize?: number; + + /** + * The size of the dot to draw on each point in pixels (see drawPoints). A dot is always + * drawn when a point is "isolated", i.e. there is a missing point on either side of it. This + * also controls the size of those dots. + */ + pointSize?: number; + + /** + * Mark this series for inclusion in the range selector. The mini plot curve will be an + * average of all such series. If this is not specified for any series, the default behavior + * is to average all the series. Setting it for one series will result in that series being + * charted alone in the range selector. + */ + showInRangeSelector?: boolean; + + /** + * When set, display the graph as a step plot instead of a line plot. This option may either + * be set for the whole graph or for single series. + */ + stepPlot?: boolean; + + /** + * Draw a border around graph lines to make crossing lines more easily distinguishable. + * Useful for graphs with many lines. + */ + strokeBorderWidth?: number; + + /** + * Color for the line border used if strokeBorderWidth is set. + */ + strokeBorderColor?: string; + + /** + * A custom pattern array where the even index is a draw and odd is a space in pixels. If + * null then it draws a solid line. The array should have a even length as any odd lengthed + * array could be expressed as a smaller even length array. This is used to create dashed + * lines. + */ + strokePattern?: number[]; + + /** + * The width of the lines connecting data points. This can be used to increase the contrast + * or some graphs. + */ + strokeWidth?: number; + } + + interface PerAxisOptions { + /** + * Color for x- and y-axis labels. This is a CSS color string. + */ + axisLabelColor?: string; + + /** + * Size of the font (in pixels) to use in the axis labels, both x- and y-axis. + */ + axisLabelFontSize?: number; + + /** + * Function to call to format the tick values that appear along an axis. This is usually set + * on a per-axis basis. + */ + axisLabelFormatter?: (v: number|Date, granularity: number, opts: (name: string) => any, dygraph: Dygraph) => any; + + /** + * Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this + * also controls the width of the y-axis. Note that for the x-axis, this is independent from + * pixelsPerLabel, which controls the spacing between labels. + */ + axisLabelWidth?: number; + + /** + * Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle + * attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'. + */ + axisLineColor?: string; + + /** + * Thickness (in pixels) of the x- and y-axis lines. + */ + axisLineWidth?: number; + + /** + * The size of the line to display next to each tick mark on x- or y-axes. + */ + axisTickSize?: number; + + /** + * Whether to draw the specified axis. This may be set on a per-axis basis to define the + * visibility of each axis separately. Setting this to false also prevents axis ticks from + * being drawn and reclaims the space for the chart grid/lines. + */ + drawAxis?: boolean; + + /** + * The color of the gridlines. This may be set on a per-axis basis to define each axis' grid + * separately. + */ + gridLineColor?: string; + + /** + * A custom pattern array where the even index is a draw and odd is a space in pixels. If + * null then it draws a solid line. The array should have a even length as any odd lengthed + * array could be expressed as a smaller even length array. This is used to create dashed + * gridlines. + */ + gridLinePattern?: number[]; + + /** + * Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal + * gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. This + * may be set on a per-axis basis to define each axis' grid separately. + */ + gridLineWidth?: number; + + /** + * Only valid for y and y2, has no effect on x: This option defines whether the y axes should + * align their ticks or if they should be independent. Possible combinations: 1.) y=true, + * y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of + * y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned + * to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and + * have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an + * error. + */ + independentTicks?: boolean; + + /** + * When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less + * than or equal to zero are not displayed. Showing log scale with ranges that go below zero + * will result in an unviewable graph. + * + * Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for + * date-based x-axes. + */ + logscale?: boolean; + + /** + * When displaying numbers in normal (not scientific) mode, large numbers will be displayed + * with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis + * labels. If there are more than maxNumberWidth digits to the left of the + * decimal in a number, dygraphs will switch to scientific notation, even when not operating + * in scientific mode. If you'd like to see all those digits, set this to something large, + * like 20 or 30. + */ + maxNumberWidth?: number; + + /** + * Number of pixels to require between each x- and y-label. Larger values will yield a + * sparser axis with fewer ticks. This is set on a per-axis + * basis. + */ + pixelsPerLabel?: number; + + /** + * By default, dygraphs displays numbers with a fixed number of digits after the decimal + * point. If you'd prefer to have a fixed number of significant figures, set this option to + * that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 + * and 1234 to be displayed as 1.23e+3. + */ + sigFigs?: number; + + /** + * This lets you specify an arbitrary function to generate tick marks on an axis. The tick + * marks are an array of (value, label) pairs. The built-in functions go to great lengths to + * choose good tick marks so, if you set this option, you'll most likely want to call one of + * them and modify the result. See dygraph-tickers.js for an extensive discussion. This is + * set on a per-axis basis. + */ + ticker?: ( + min: number, + max: number, + pixels: number, + opts: (name: string) => any, + dygraph: Dygraph, + vals: number[]) => Array<{v: number, label: string}>; + + + /** + * Function to provide a custom display format for the values displayed on mouseover. This + * does not affect the values that appear on tick marks next to the axes. To format those, + * see axisLabelFormatter. This is usually set on a per-axis + * basis. + */ + valueFormatter?: ( + v: number, + opts: (name: string) => any, + seriesName: string, + dygraph: Dygraph, + row: number, + col: number) => any; + + /** + * Explicitly set the vertical range of the graph to [low, high]. This may be set on a + * per-axis basis to define each y-axis separately. If either limit is unspecified, it will + * be calculated automatically (e.g. [null, 30] to automatically calculate just the lower + * bound) + */ + valueRange?: number[]; + + /** + * Whether to display gridlines in the chart. This may be set on a per-axis basis to define + * the visibility of each axis' grid separately. + */ + drawGrid?: boolean; + + /** + * Show K/M/B for thousands/millions/billions on y-axis. + */ + labelsKMB?: boolean; + + /** + * Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in + * that it uses base 2, not 10. + */ + labelsKMG2?: boolean; + } + + interface Options extends PerSeriesOptions, PerAxisOptions { + /** + * Set this option to animate the transition between zoom windows. Applies to programmatic + * and interactive zooms. Note that if you also set a drawCallback, it will be called several + * times on each zoom. If you set a zoomCallback, it will only be called after the animation + * is complete. + */ + animatedZooms?: boolean + + /** + * If provided, this function is called whenever the user clicks on an annotation. + */ + annotationClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user double-clicks on an annotation. + */ + annotationDblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user mouses out of an annotation. + */ + annotationMouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * If provided, this function is called whenever the user mouses over an annotation. + */ + annotationMouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** + * Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set + * on a per-axis basis. If an option may be set in this way, it will be noted on this page. + * See also documentation on per-series and + * per-axis options. + */ + axes?: { + x?: PerAxisOptions; + y?: PerAxisOptions; + y2?: PerAxisOptions; + }; + + /** + * A function to call when the canvas is clicked. + */ + clickCallback?: (e: MouseEvent, xval: number, points: Point[]) => any; + + /** + * If colors is not specified, saturation of the automatically-generated + * data series colors. (0.0-1.0). + */ + colorSaturation?: number; + + /** + * If colors is not specified, value of the data series colors, as in hue/saturation/value. + * (0.0-1.0, default 0.5) + */ + colorValue?: number; + + /** + * List of colors for the data series. These can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow", etc. If not specified, equally-spaced points around a + * color wheel are used. Overridden by the 'color' option. + */ + colors?: string[]; + + /** + * Usually, when Dygraphs encounters a missing value in a data series, it interprets this as + * a gap and draws it as such. If, instead, the missing values represents an x-value for + * which only a different series has data, then you'll want to connect the dots by setting + * this to true. To explicitly include a gap with this option set, use a value of NaN. + */ + connectSeparatedPoints?: boolean; + + /** + * When set, parse each CSV cell as "low;middle;high". Error bars will be drawn for each + * point between low and high, with the series itself going through middle. + */ + customBars?: boolean + + /** + * Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq. + */ + dataHandler?: any; + + /** + * Initially zoom in on a section of the graph. Is of the form [earliest, latest], where + * earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the + * values in dateWindow must also be numbers. + */ + dateWindow?: number[]; + + /** + * The delimiter to look for when separating fields of a CSV file. Setting this to a tab is + * not usually necessary, since tab-delimited data is auto-detected. + */ + delimiter?: string; + + /** + * Unless it's run in scientific mode (see the sigFigs option), dygraphs + * displays numbers with digitsAfterDecimal digits after the decimal point. + * Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', + * '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value + * less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be + * displayed in scientific notation. + */ + digitsAfterDecimal?: number; + + /** + * Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data + * series to be interpreted as annotations on points in that series. This is the same format + * used by Google's AnnotatedTimeLine chart. + */ + displayAnnotations?: boolean; + + /** + * When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those + * positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or + * left graph edge as usual. + */ + drawAxesAtZero?: boolean; + + /** + * When set, this callback gets called every time the dygraph is drawn. This includes the + * initial draw, after zooming and repeatedly while panning. + */ + drawCallback?: (dygraph: Dygraph, is_initial: boolean) => any; + + /** + * Draw points at the edges of gaps in the data. This improves visibility of small data + * segments or other data irregularities. + */ + drawGapEdgePoints?: boolean; + + /** + * Draw a custom item when a point is highlighted. Default is a small dot matching the + * series color. This method should constrain drawing to within pointSize pixels from (cx, + * cy) Also see drawPointCallback + */ + drawHighlightPointCallback?: ( + g: Dygraph, + seriesName: string, + canvasContext: CanvasRenderingContext2D, + cx: number, + cy: number, + color: string, + pointSize: number) => any; + + /** + * Draw a custom item when drawPoints is enabled. Default is a small dot matching the series + * color. This method should constrain drawing to within pointSize pixels from (cx, cy). + * Also see drawHighlightPointCallback + */ + drawPointCallback?: ( + g: Dygraph, + seriesName: string, + canvasContext: CanvasRenderingContext2D, + cx: number, + cy: number, + color: string, + pointSize: number) => any; + + /** + * Does the data contain standard deviations? Setting this to true alters the input format. + */ + errorBars?: boolean; + + /** + * Sets the data being displayed in the chart. This can only be set when calling + * updateOptions; it cannot be set from the constructor. For a full description of valid data + * formats, see the Data Formats page. + */ + file?: DataArray|GVizDataTable|string; + + /** + * When set, attempt to parse each cell in the CSV file as "a/b", where a and b are integers. + * The ratio will be plotted. This allows computation of Wilson confidence intervals (see + * below). + */ + fractions?: boolean; + + /** + * Height, in pixels, of the chart. If the container div has been explicitly sized, this will + * be ignored. + */ + height?: number; + + /** + * Whether to hide the legend when the mouse leaves the chart area. + */ + hideOverlayOnMouseOut?: boolean; + + /** + * When set, this callback gets called every time a new point is highlighted. + */ + highlightCallback?: ( + event: MouseEvent, + xval: number, + points: Point[], + row: number, + seriesName: string) => any; + + /** + * Fade the background while highlighting series. 1=fully visible background (disable + * fading), 0=hiddden background (show highlighted series only). + */ + highlightSeriesBackgroundAlpha?: number; + + /** + * When set, the options from this object are applied to the timeseries closest to the mouse + * pointer for interactive highlighting. See also 'highlightCallback'. Example: + * highlightSeriesOpts: { strokeWidth: 3 }. + */ + highlightSeriesOpts?: PerSeriesOptions; + + /** + * Usually, dygraphs will use the range of the data plus some padding to set the range of the + * y-axis. If this option is set, the y-axis will always include zero, typically as the + * lowest value. This can be used to avoid exaggerating the variance in the data + */ + includeZero?: boolean; + + interactionModel?: any; + + /** + * When this option is passed to updateOptions() along with either the + * dateWindow or valueRange options, the zoom flags are not changed + * to reflect a zoomed state. This is primarily useful for when the display area of a chart + * is changed programmatically and also where manual zooming is allowed and use is made of + * the isZoomed method to determine this. + */ + isZoomedIgnoreProgrammaticZoom?: boolean; + + /** + * A name for each data series, including the independent (X) series. For CSV files and + * DataTable objections, this is determined by context. For raw data, this must be specified. + * If it is not, default values are supplied and a warning is logged. + */ + labels?: string[]; + + /** + * Show data labels in an external div, rather than on the graph. This value can either be a + * div element or a div id. + */ + labelsDiv?: string|HTMLElement; + + /** + * Additional styles to apply to the currently-highlighted points div. For example, { + * 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to + * style the .dygraph-legend class than to use this property. + */ + labelsDivStyles?: {[cssProperty: string]: string}; + + /** + * Width (in pixels) of the div which shows information on the currently-highlighted points. + */ + labelsDivWidth?: number; + + /** + * Put <br/> between lines in the label string. Often used in conjunction + * with labelsDiv. + */ + labelsSeparateLines?: boolean; + + /** + * Show zero value labels in the labelsDiv. + */ + labelsShowZeroValues?: boolean; + + /** + * Show date/time labels according to UTC (instead of local time). + */ + labelsUTC?: boolean; + + /** + * When to display the legend. By default, it only appears when a user mouses over the chart. + * Set it to "always" to always display a legend of some sort. When set to "follow", legend + * follows highlighted points. + */ + legend?: 'always' | 'follow' | 'onmouseover'; + + /** + * A value representing the farthest a graph may be panned, in percent of the display. For + * example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the + * displayed values. null means no bounds. + */ + panEdgeFraction?: number; + + /** + * A function (or array of functions) which plot each data series on the chart. + * TODO(danvk): more details! May be set per-series. + */ + plotter?: any; + + /** + * Defines per-graph plugins. Useful for per-graph customization + */ + plugins?: any[]; + + /** + * A function to call when a data point is clicked. and the point that was clicked. + */ + pointClickCallback?: (e: MouseEvent, point: Point) => any; + + /** + * Height, in pixels, of the range selector widget. This option can only be specified at + * Dygraph creation time. + */ + rangeSelectorHeight?: number; + + /** + * The range selector mini plot fill color. This can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off fill. + */ + rangeSelectorPlotFillColor?: string; + + /** + * The range selector mini plot stroke color. This can be of the form "#AABBCC" or + * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off stroke. + */ + rangeSelectorPlotStrokeColor?: string; + + /** + * Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to + * highlight the right-most data point. + */ + rightGap?: number; + + /** + * Number of days over which to average data. Discussed extensively above. + */ + rollPeriod?: number; + + /** + * Defines per-series options. Its keys match the y-axis label names, and the values are + * dictionaries themselves that contain options specific to that series. When this option is + * missing, it falls back on the old-style of per-series options comingled with global + * options. + */ + series?: { + [seriesName: string]: PerSeriesOptions + }; + + /** + * Whether to show the legend upon mouseover. + */ + showLabelsOnHighlight?: boolean; + + /** + * Show or hide the range selector widget. + */ + showRangeSelector?: boolean; + + /** + * If the rolling average period text box should be shown. + */ + showRoller?: boolean; + + /** + * When errorBars is set, shade this many standard deviations above/below each point. + */ + sigma?: number; + + /** + * If set, stack series on top of one another rather than drawing them independently. The + * first series specified in the input data will wind up on top of the chart and the last + * will be on bottom. NaN values are drawn as white areas without a line on top, see + * stackedGraphNaNFill for details. + */ + stackedGraph?: boolean; + + /** + * Controls handling of NaN values inside a stacked graph. NaN values are + * interpolated/extended for stacking purposes, but the actual point value remains NaN in the + * legend display. Valid option values are "all" (interpolate internally, repeat leftmost and + * rightmost value as needed), "inside" (interpolate internally only, use zero outside + * leftmost and rightmost value), and "none" (treat NaN as zero everywhere). + */ + stackedGraphNaNFill?: string; + + /** + * Text to display above the chart. You can supply any HTML for this value, not just text. If + * you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes. + */ + title?: string; + + /** + * Height of the chart title, in pixels. This also controls the default font size of the + * title. If you style the title on your own, this controls how much space is set aside above + * the chart for the title's div. + */ + titleHeight?: number; + + /** + * When set, this callback gets called before the chart is drawn. It details on how to use + * this. + */ + underlayCallback?: (context: CanvasRenderingContext2D, area: dygraphs.Area, dygraph: Dygraph) => any; + + /** + * When set, this callback gets called every time the user stops highlighting any point by + * mousing out of the graph. + */ + unhighlightCallback?: (event: MouseEvent) => any; + + /** + * Which series should initially be visible? Once the Dygraph has been constructed, you can + * access and modify the visibility of each series using the visibility and + * setVisibility methods. + */ + visibility?: boolean[]; + + /** + * Width, in pixels, of the chart. If the container div has been explicitly sized, this will + * be ignored. + */ + width?: number; + + /** + * Use in conjunction with the "fractions" option. Instead of plotting +/- N standard + * deviations, dygraphs will compute a Wilson confidence interval and plot that. This has + * more reasonable behavior for ratios close to 0 or 1. + */ + wilsonInterval?: boolean; + + /** + * Height, in pixels, of the x-axis. If not set explicitly, this is computed based on + * axisLabelFontSize and axisTickSize. + */ + xAxisHeight?: number; + + /** + * Height of the x-axis label, in pixels. This also controls the default font size of the + * x-axis label. If you style the label on your own, this controls how much space is set + * aside below the chart for the x-axis label's div. + */ + xLabelHeight?: number; + + /** + * Add the specified amount of extra space (in pixels) around the X-axis value range to + * ensure points at the edges remain visible. + */ + xRangePad?: number; + + /** + * A function which parses x-values (i.e. the dependent series). Must return a number, even + * when the values are dates. In this case, millis since epoch are used. This is used + * primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which + * it will parse. See code for details. + */ + xValueParser?: (val: string) => number; + + /** + * Text to display below the chart's x-axis. You can supply any HTML for this value, not just + * text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' + * classes. + */ + xlabel?: string; + + /** + * Text to display to the right of the chart's secondary y-axis. This label is only displayed + * if a secondary y-axis is present. See this test for an example of how to do + * this. The comments for the 'ylabel' option generally apply here as well. This label gets a + * 'dygraph-y2label' instead of a 'dygraph-ylabel' class. + */ + y2label?: string; + + /** + * Width of the div which contains the y-axis label. Since the y-axis label appears rotated + * 90 degrees, this actually affects the height of its div. + */ + yLabelWidth?: number; + + /** + * If set, add the specified amount of extra space (in pixels) around the Y-axis value range + * to ensure points at the edges remain visible. If unset, use the traditional Y padding + * algorithm. + */ + yRangePad?: number; + + /** + * Text to display to the left of the chart's y-axis. You can supply any HTML for this value, + * not just text. If you wish to style it using CSS, use the 'dygraph-label' or + * 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may + * behave in unintuitive ways. No additional space is set aside for a y-axis label. If you + * need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth + * option. If you need a wider div for the y-axis label, either style it that way with CSS + * (but remember that it's rotated, so width is controlled by the 'height' property) or set + * the yLabelWidth option. + */ + ylabel?: string; + + /** + * A function to call when the zoom window is changed (either by zooming in or out). + */ + zoomCallback?: (minDate: number, maxDate: number, yRanges: [number, number][]) => any; + } + + interface SeriesProperties { + name: string; + column: number; + visible: boolean; + color: string; + axis: number; + } + + interface Area { + x: number; + y: number; + w: number; + h: number; + } /** - * A per-series color definition. Used in conjunction with, and overrides, the colors option. - */ - color?: string; - - /** - * Draw a small dot at each point, in addition to a line going through the point. This makes - * the individual data points easier to see, but can increase visual clutter in the chart. - * The small dot can be replaced with a custom rendering by supplying a drawPointCallback. - */ - drawPoints?: boolean; - - /** - * Error bars (or custom bars) for each series are drawn in the same color as the series, but - * with partial transparency. This sets the transparency. A value of 0.0 means that the error - * bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark - * as the line for the series itself. This can be used to produce chart lines whose thickness - * varies at each point. - */ - fillAlpha?: number; - - /** - * Should the area underneath the graph be filled? This option is not compatible with error - * bars. This may be set on a per-series basis. - */ - fillGraph?: boolean; - - /** - * The size in pixels of the dot drawn over highlighted points. - */ - highlightCircleSize?: number; - - /** - * The size of the dot to draw on each point in pixels (see drawPoints). A dot is always - * drawn when a point is "isolated", i.e. there is a missing point on either side of it. This - * also controls the size of those dots. - */ - pointSize?: number; - - /** - * Mark this series for inclusion in the range selector. The mini plot curve will be an - * average of all such series. If this is not specified for any series, the default behavior - * is to average all the series. Setting it for one series will result in that series being - * charted alone in the range selector. - */ - showInRangeSelector?: boolean; - - /** - * When set, display the graph as a step plot instead of a line plot. This option may either - * be set for the whole graph or for single series. - */ - stepPlot?: boolean; - - /** - * Draw a border around graph lines to make crossing lines more easily distinguishable. - * Useful for graphs with many lines. - */ - strokeBorderWidth?: number; - - /** - * Color for the line border used if strokeBorderWidth is set. - */ - strokeBorderColor?: string; - - /** - * A custom pattern array where the even index is a draw and odd is a space in pixels. If - * null then it draws a solid line. The array should have a even length as any odd lengthed - * array could be expressed as a smaller even length array. This is used to create dashed - * lines. - */ - strokePattern?: number[]; - - /** - * The width of the lines connecting data points. This can be used to increase the contrast - * or some graphs. - */ - strokeWidth?: number; - } - - interface PerAxisOptions { - /** - * Color for x- and y-axis labels. This is a CSS color string. - */ - axisLabelColor?: string; - - /** - * Size of the font (in pixels) to use in the axis labels, both x- and y-axis. - */ - axisLabelFontSize?: number; - - /** - * Function to call to format the tick values that appear along an axis. This is usually set - * on a per-axis basis. - */ - axisLabelFormatter?: (v: number|Date, granularity: number, opts: (name: string) => any, dygraph: Dygraph) => any; - - /** - * Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this - * also controls the width of the y-axis. Note that for the x-axis, this is independent from - * pixelsPerLabel, which controls the spacing between labels. - */ - axisLabelWidth?: number; - - /** - * Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle - * attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'. - */ - axisLineColor?: string; - - /** - * Thickness (in pixels) of the x- and y-axis lines. - */ - axisLineWidth?: number; - - /** - * The size of the line to display next to each tick mark on x- or y-axes. - */ - axisTickSize?: number; - - /** - * Whether to draw the specified axis. This may be set on a per-axis basis to define the - * visibility of each axis separately. Setting this to false also prevents axis ticks from - * being drawn and reclaims the space for the chart grid/lines. - */ - drawAxis?: boolean; - - /** - * The color of the gridlines. This may be set on a per-axis basis to define each axis' grid - * separately. - */ - gridLineColor?: string; - - /** - * A custom pattern array where the even index is a draw and odd is a space in pixels. If - * null then it draws a solid line. The array should have a even length as any odd lengthed - * array could be expressed as a smaller even length array. This is used to create dashed - * gridlines. - */ - gridLinePattern?: number[]; - - /** - * Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal - * gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. This - * may be set on a per-axis basis to define each axis' grid separately. - */ - gridLineWidth?: number; - - /** - * Only valid for y and y2, has no effect on x: This option defines whether the y axes should - * align their ticks or if they should be independent. Possible combinations: 1.) y=true, - * y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of - * y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned - * to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and - * have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an - * error. - */ - independentTicks?: boolean; - - /** - * When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less - * than or equal to zero are not displayed. Showing log scale with ranges that go below zero - * will result in an unviewable graph. + * Point structure. * - * Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for - * date-based x-axes. - */ - logscale?: boolean; - - /** - * When displaying numbers in normal (not scientific) mode, large numbers will be displayed - * with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis - * labels. If there are more than maxNumberWidth digits to the left of the - * decimal in a number, dygraphs will switch to scientific notation, even when not operating - * in scientific mode. If you'd like to see all those digits, set this to something large, - * like 20 or 30. - */ - maxNumberWidth?: number; - - /** - * Number of pixels to require between each x- and y-label. Larger values will yield a - * sparser axis with fewer ticks. This is set on a per-axis - * basis. - */ - pixelsPerLabel?: number; - - /** - * By default, dygraphs displays numbers with a fixed number of digits after the decimal - * point. If you'd prefer to have a fixed number of significant figures, set this option to - * that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 - * and 1234 to be displayed as 1.23e+3. - */ - sigFigs?: number; - - /** - * This lets you specify an arbitrary function to generate tick marks on an axis. The tick - * marks are an array of (value, label) pairs. The built-in functions go to great lengths to - * choose good tick marks so, if you set this option, you'll most likely want to call one of - * them and modify the result. See dygraph-tickers.js for an extensive discussion. This is - * set on a per-axis basis. - */ - ticker?: ( - min: number, - max: number, - pixels: number, - opts: (name: string) => any, - dygraph: Dygraph, - vals: number[]) => Array<{v: number, label: string}>; - - - /** - * Function to provide a custom display format for the values displayed on mouseover. This - * does not affect the values that appear on tick marks next to the axes. To format those, - * see axisLabelFormatter. This is usually set on a per-axis - * basis. - */ - valueFormatter?: ( - v: number, - opts: (name: string) => any, - seriesName: string, - dygraph: Dygraph, - row: number, - col: number) => any; - - /** - * Explicitly set the vertical range of the graph to [low, high]. This may be set on a - * per-axis basis to define each y-axis separately. If either limit is unspecified, it will - * be calculated automatically (e.g. [null, 30] to automatically calculate just the lower - * bound) - */ - valueRange?: number[]; - - /** - * Whether to display gridlines in the chart. This may be set on a per-axis basis to define - * the visibility of each axis' grid separately. - */ - drawGrid?: boolean; - - /** - * Show K/M/B for thousands/millions/billions on y-axis. - */ - labelsKMB?: boolean; - - /** - * Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in - * that it uses base 2, not 10. - */ - labelsKMG2?: boolean; - } - - interface Options extends PerSeriesOptions, PerAxisOptions { - /** - * Set this option to animate the transition between zoom windows. Applies to programmatic - * and interactive zooms. Note that if you also set a drawCallback, it will be called several - * times on each zoom. If you set a zoomCallback, it will only be called after the animation - * is complete. - */ - animatedZooms?: boolean - - /** - * If provided, this function is called whenever the user clicks on an annotation. - */ - annotationClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** - * If provided, this function is called whenever the user double-clicks on an annotation. - */ - annotationDblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** - * If provided, this function is called whenever the user mouses out of an annotation. - */ - annotationMouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** - * If provided, this function is called whenever the user mouses over an annotation. - */ - annotationMouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** - * Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set - * on a per-axis basis. If an option may be set in this way, it will be noted on this page. - * See also documentation on per-series and - * per-axis options. - */ - axes?: { - x?: PerAxisOptions; - y?: PerAxisOptions; - y2?: PerAxisOptions; - }; - - /** - * A function to call when the canvas is clicked. - */ - clickCallback?: (e: MouseEvent, xval: number, points: Point[]) => any; - - /** - * If colors is not specified, saturation of the automatically-generated - * data series colors. (0.0-1.0). - */ - colorSaturation?: number; - - /** - * If colors is not specified, value of the data series colors, as in hue/saturation/value. - * (0.0-1.0, default 0.5) - */ - colorValue?: number; - - /** - * List of colors for the data series. These can be of the form "#AABBCC" or - * "rgb(255,100,200)" or "yellow", etc. If not specified, equally-spaced points around a - * color wheel are used. Overridden by the 'color' option. - */ - colors?: string[]; - - /** - * Usually, when Dygraphs encounters a missing value in a data series, it interprets this as - * a gap and draws it as such. If, instead, the missing values represents an x-value for - * which only a different series has data, then you'll want to connect the dots by setting - * this to true. To explicitly include a gap with this option set, use a value of NaN. - */ - connectSeparatedPoints?: boolean; - - /** - * When set, parse each CSV cell as "low;middle;high". Error bars will be drawn for each - * point between low and high, with the series itself going through middle. - */ - customBars?: boolean - - /** - * Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq. - */ - dataHandler?: any; - - /** - * Initially zoom in on a section of the graph. Is of the form [earliest, latest], where - * earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the - * values in dateWindow must also be numbers. - */ - dateWindow?: number[]; - - /** - * The delimiter to look for when separating fields of a CSV file. Setting this to a tab is - * not usually necessary, since tab-delimited data is auto-detected. - */ - delimiter?: string; - - /** - * Unless it's run in scientific mode (see the sigFigs option), dygraphs - * displays numbers with digitsAfterDecimal digits after the decimal point. - * Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', - * '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value - * less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be - * displayed in scientific notation. - */ - digitsAfterDecimal?: number; - - /** - * Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data - * series to be interpreted as annotations on points in that series. This is the same format - * used by Google's AnnotatedTimeLine chart. - */ - displayAnnotations?: boolean; - - /** - * When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those - * positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or - * left graph edge as usual. - */ - drawAxesAtZero?: boolean; - - /** - * When set, this callback gets called every time the dygraph is drawn. This includes the - * initial draw, after zooming and repeatedly while panning. - */ - drawCallback?: (dygraph: Dygraph, is_initial: boolean) => any; - - /** - * Draw points at the edges of gaps in the data. This improves visibility of small data - * segments or other data irregularities. - */ - drawGapEdgePoints?: boolean; - - /** - * Draw a custom item when a point is highlighted. Default is a small dot matching the - * series color. This method should constrain drawing to within pointSize pixels from (cx, - * cy) Also see drawPointCallback - */ - drawHighlightPointCallback?: ( - g: Dygraph, - seriesName: string, - canvasContext: CanvasRenderingContext2D, - cx: number, - cy: number, - color: string, - pointSize: number) => any; - - /** - * Draw a custom item when drawPoints is enabled. Default is a small dot matching the series - * color. This method should constrain drawing to within pointSize pixels from (cx, cy). - * Also see drawHighlightPointCallback - */ - drawPointCallback?: ( - g: Dygraph, - seriesName: string, - canvasContext: CanvasRenderingContext2D, - cx: number, - cy: number, - color: string, - pointSize: number) => any; - - /** - * Does the data contain standard deviations? Setting this to true alters the input format. - */ - errorBars?: boolean; - - /** - * Sets the data being displayed in the chart. This can only be set when calling - * updateOptions; it cannot be set from the constructor. For a full description of valid data - * formats, see the Data Formats page. - */ - file?: DataArray|GVizDataTable|string; - - /** - * When set, attempt to parse each cell in the CSV file as "a/b", where a and b are integers. - * The ratio will be plotted. This allows computation of Wilson confidence intervals (see - * below). - */ - fractions?: boolean; - - /** - * Height, in pixels, of the chart. If the container div has been explicitly sized, this will - * be ignored. - */ - height?: number; - - /** - * Whether to hide the legend when the mouse leaves the chart area. - */ - hideOverlayOnMouseOut?: boolean; - - /** - * When set, this callback gets called every time a new point is highlighted. - */ - highlightCallback?: ( - event: MouseEvent, - xval: number, - points: Point[], - row: number, - seriesName: string) => any; - - /** - * Fade the background while highlighting series. 1=fully visible background (disable - * fading), 0=hiddden background (show highlighted series only). - */ - highlightSeriesBackgroundAlpha?: number; - - /** - * When set, the options from this object are applied to the timeseries closest to the mouse - * pointer for interactive highlighting. See also 'highlightCallback'. Example: - * highlightSeriesOpts: { strokeWidth: 3 }. - */ - highlightSeriesOpts?: PerSeriesOptions; - - /** - * Usually, dygraphs will use the range of the data plus some padding to set the range of the - * y-axis. If this option is set, the y-axis will always include zero, typically as the - * lowest value. This can be used to avoid exaggerating the variance in the data - */ - includeZero?: boolean; - - interactionModel?: any; - - /** - * When this option is passed to updateOptions() along with either the - * dateWindow or valueRange options, the zoom flags are not changed - * to reflect a zoomed state. This is primarily useful for when the display area of a chart - * is changed programmatically and also where manual zooming is allowed and use is made of - * the isZoomed method to determine this. - */ - isZoomedIgnoreProgrammaticZoom?: boolean; - - /** - * A name for each data series, including the independent (X) series. For CSV files and - * DataTable objections, this is determined by context. For raw data, this must be specified. - * If it is not, default values are supplied and a warning is logged. - */ - labels?: string[]; - - /** - * Show data labels in an external div, rather than on the graph. This value can either be a - * div element or a div id. - */ - labelsDiv?: string|HTMLElement; - - /** - * Additional styles to apply to the currently-highlighted points div. For example, { - * 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to - * style the .dygraph-legend class than to use this property. - */ - labelsDivStyles?: {[cssProperty: string]: string}; - - /** - * Width (in pixels) of the div which shows information on the currently-highlighted points. - */ - labelsDivWidth?: number; - - /** - * Put <br/> between lines in the label string. Often used in conjunction - * with labelsDiv. - */ - labelsSeparateLines?: boolean; - - /** - * Show zero value labels in the labelsDiv. - */ - labelsShowZeroValues?: boolean; - - /** - * Show date/time labels according to UTC (instead of local time). - */ - labelsUTC?: boolean; - - /** - * When to display the legend. By default, it only appears when a user mouses over the chart. - * Set it to "always" to always display a legend of some sort. When set to "follow", legend - * follows highlighted points. - */ - legend?: 'always' | 'follow' | 'onmouseover'; - - /** - * A value representing the farthest a graph may be panned, in percent of the display. For - * example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the - * displayed values. null means no bounds. - */ - panEdgeFraction?: number; - - /** - * A function (or array of functions) which plot each data series on the chart. - * TODO(danvk): more details! May be set per-series. - */ - plotter?: any; - - /** - * Defines per-graph plugins. Useful for per-graph customization - */ - plugins?: any[]; - - /** - * A function to call when a data point is clicked. and the point that was clicked. - */ - pointClickCallback?: (e: MouseEvent, point: Point) => any; - - /** - * Height, in pixels, of the range selector widget. This option can only be specified at - * Dygraph creation time. - */ - rangeSelectorHeight?: number; - - /** - * The range selector mini plot fill color. This can be of the form "#AABBCC" or - * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off fill. - */ - rangeSelectorPlotFillColor?: string; - - /** - * The range selector mini plot stroke color. This can be of the form "#AABBCC" or - * "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off stroke. - */ - rangeSelectorPlotStrokeColor?: string; - - /** - * Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to - * highlight the right-most data point. - */ - rightGap?: number; - - /** - * Number of days over which to average data. Discussed extensively above. - */ - rollPeriod?: number; - - /** - * Defines per-series options. Its keys match the y-axis label names, and the values are - * dictionaries themselves that contain options specific to that series. When this option is - * missing, it falls back on the old-style of per-series options comingled with global - * options. - */ - series?: { - [seriesName: string]: PerSeriesOptions - }; - - /** - * Whether to show the legend upon mouseover. - */ - showLabelsOnHighlight?: boolean; - - /** - * Show or hide the range selector widget. - */ - showRangeSelector?: boolean; - - /** - * If the rolling average period text box should be shown. - */ - showRoller?: boolean; - - /** - * When errorBars is set, shade this many standard deviations above/below each point. - */ - sigma?: number; - - /** - * If set, stack series on top of one another rather than drawing them independently. The - * first series specified in the input data will wind up on top of the chart and the last - * will be on bottom. NaN values are drawn as white areas without a line on top, see - * stackedGraphNaNFill for details. - */ - stackedGraph?: boolean; - - /** - * Controls handling of NaN values inside a stacked graph. NaN values are - * interpolated/extended for stacking purposes, but the actual point value remains NaN in the - * legend display. Valid option values are "all" (interpolate internally, repeat leftmost and - * rightmost value as needed), "inside" (interpolate internally only, use zero outside - * leftmost and rightmost value), and "none" (treat NaN as zero everywhere). - */ - stackedGraphNaNFill?: string; - - /** - * Text to display above the chart. You can supply any HTML for this value, not just text. If - * you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes. - */ - title?: string; - - /** - * Height of the chart title, in pixels. This also controls the default font size of the - * title. If you style the title on your own, this controls how much space is set aside above - * the chart for the title's div. - */ - titleHeight?: number; - - /** - * When set, this callback gets called before the chart is drawn. It details on how to use - * this. - */ - underlayCallback?: (context: CanvasRenderingContext2D, area: dygraphs.Area, dygraph: Dygraph) => any; - - /** - * When set, this callback gets called every time the user stops highlighting any point by - * mousing out of the graph. - */ - unhighlightCallback?: (event: MouseEvent) => any; - - /** - * Which series should initially be visible? Once the Dygraph has been constructed, you can - * access and modify the visibility of each series using the visibility and - * setVisibility methods. - */ - visibility?: boolean[]; - - /** - * Width, in pixels, of the chart. If the container div has been explicitly sized, this will - * be ignored. - */ - width?: number; - - /** - * Use in conjunction with the "fractions" option. Instead of plotting +/- N standard - * deviations, dygraphs will compute a Wilson confidence interval and plot that. This has - * more reasonable behavior for ratios close to 0 or 1. - */ - wilsonInterval?: boolean; - - /** - * Height, in pixels, of the x-axis. If not set explicitly, this is computed based on - * axisLabelFontSize and axisTickSize. - */ - xAxisHeight?: number; - - /** - * Height of the x-axis label, in pixels. This also controls the default font size of the - * x-axis label. If you style the label on your own, this controls how much space is set - * aside below the chart for the x-axis label's div. - */ - xLabelHeight?: number; - - /** - * Add the specified amount of extra space (in pixels) around the X-axis value range to - * ensure points at the edges remain visible. - */ - xRangePad?: number; - - /** - * A function which parses x-values (i.e. the dependent series). Must return a number, even - * when the values are dates. In this case, millis since epoch are used. This is used - * primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which - * it will parse. See code for details. - */ - xValueParser?: (val: string) => number; - - /** - * Text to display below the chart's x-axis. You can supply any HTML for this value, not just - * text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' - * classes. - */ - xlabel?: string; - - /** - * Text to display to the right of the chart's secondary y-axis. This label is only displayed - * if a secondary y-axis is present. See this test for an example of how to do - * this. The comments for the 'ylabel' option generally apply here as well. This label gets a - * 'dygraph-y2label' instead of a 'dygraph-ylabel' class. - */ - y2label?: string; - - /** - * Width of the div which contains the y-axis label. Since the y-axis label appears rotated - * 90 degrees, this actually affects the height of its div. - */ - yLabelWidth?: number; - - /** - * If set, add the specified amount of extra space (in pixels) around the Y-axis value range - * to ensure points at the edges remain visible. If unset, use the traditional Y padding - * algorithm. - */ - yRangePad?: number; - - /** - * Text to display to the left of the chart's y-axis. You can supply any HTML for this value, - * not just text. If you wish to style it using CSS, use the 'dygraph-label' or - * 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may - * behave in unintuitive ways. No additional space is set aside for a y-axis label. If you - * need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth - * option. If you need a wider div for the y-axis label, either style it that way with CSS - * (but remember that it's rotated, so width is controlled by the 'height' property) or set - * the yLabelWidth option. - */ - ylabel?: string; - - /** - * A function to call when the zoom window is changed (either by zooming in or out). - */ - zoomCallback?: (minDate: number, maxDate: number, yRanges: [number, number][]) => any; - } - - interface SeriesProperties { - name: string; - column: number; - visible: boolean; - color: string; - axis: number; - } - - interface Area { - x: number; - y: number; - w: number; - h: number; - } - - /** - * Point structure. - * - * xval_* and yval_* are the original unscaled data values, - * while x_* and y_* are scaled to the range (0.0-1.0) for plotting. - * yval_stacked is the cumulative Y value used for stacking graphs, - * and bottom/top/minus/plus are used for error bar graphs. - */ - interface Point { - idx: number; - name: string; - x?: number; - xval?: number; - y_bottom?: number; - y?: number; - y_stacked?: number; - y_top?: number; - yval_minus?: number; - yval?: number; - yval_plus?: number; - yval_stacked?: number; - annotation?: dygraphs.Annotation; - } - - interface Annotation { - /** The name of the series to which the annotated point belongs. */ - series: string; - - /** - * The x value of the point. This should be the same as the value - * you specified in your CSV file, e.g. "2010-09-13". - * You must set either x or xval. - */ - x?: number|string; - - /** - * numeric value of the point, or millis since epoch. - */ - xval?: number; - - /** Text that will appear on the annotation's flag. */ - shortText?: string; - - /** A longer description of the annotation which will appear when the user hovers over it. */ - text?: string; - - /** - * Specify in place of shortText to mark the annotation with an image rather than text. - * If you specify this, you must specify width and height. - */ - icon?: string; - - /** Width (in pixels) of the annotation flag or icon. */ - width?: number; - /** Height (in pixels) of the annotation flag or icon. */ - height?: number; - - /** CSS class to use for styling the annotation. */ - cssClass?: string; - - /** Height of the tick mark (in pixels) connecting the point to its flag or icon. */ - tickHeight?: number; - - /** If true, attach annotations to the x-axis, rather than to actual points. */ - attachAtBottom?: boolean; - - div?: HTMLDivElement; - - /** This function is called whenever the user clicks on this annotation. */ - clickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** This function is called whenever the user mouses over this annotation. */ - mouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** This function is called whenever the user mouses out of this annotation. */ - mouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - - /** this function is called whenever the user double-clicks on this annotation. */ - dblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; - } - - type Axis = 'x' | 'y' | 'y2'; + * xval_* and yval_* are the original unscaled data values, + * while x_* and y_* are scaled to the range (0.0-1.0) for plotting. + * yval_stacked is the cumulative Y value used for stacking graphs, + * and bottom/top/minus/plus are used for error bar graphs. + */ + interface Point { + idx: number; + name: string; + x?: number; + xval?: number; + y_bottom?: number; + y?: number; + y_stacked?: number; + y_top?: number; + yval_minus?: number; + yval?: number; + yval_plus?: number; + yval_stacked?: number; + annotation?: dygraphs.Annotation; + } + + interface Annotation { + /** The name of the series to which the annotated point belongs. */ + series: string; + + /** + * The x value of the point. This should be the same as the value + * you specified in your CSV file, e.g. "2010-09-13". + * You must set either x or xval. + */ + x?: number|string; + + /** + * numeric value of the point, or millis since epoch. + */ + xval?: number; + + /** Text that will appear on the annotation's flag. */ + shortText?: string; + + /** A longer description of the annotation which will appear when the user hovers over it. */ + text?: string; + + /** + * Specify in place of shortText to mark the annotation with an image rather than text. + * If you specify this, you must specify width and height. + */ + icon?: string; + + /** Width (in pixels) of the annotation flag or icon. */ + width?: number; + /** Height (in pixels) of the annotation flag or icon. */ + height?: number; + + /** CSS class to use for styling the annotation. */ + cssClass?: string; + + /** Height of the tick mark (in pixels) connecting the point to its flag or icon. */ + tickHeight?: number; + + /** If true, attach annotations to the x-axis, rather than to actual points. */ + attachAtBottom?: boolean; + + div?: HTMLDivElement; + + /** This function is called whenever the user clicks on this annotation. */ + clickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** This function is called whenever the user mouses over this annotation. */ + mouseOverHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** This function is called whenever the user mouses out of this annotation. */ + mouseOutHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + + /** this function is called whenever the user double-clicks on this annotation. */ + dblClickHandler?: (annotation: dygraphs.Annotation, point: Point, dygraph: Dygraph, event: MouseEvent) => any; + } + + type Axis = 'x' | 'y' | 'y2'; } declare class Dygraph { - constructor( - container: HTMLElement | string, - data: dygraphs.DataArray|dygraphs.GVizDataTable|string|(()=>(dygraphs.DataArray|dygraphs.GVizDataTable|string)), - options?: dygraphs.Options); + constructor( + container: HTMLElement | string, + data: dygraphs.DataArray|dygraphs.GVizDataTable|string|(()=>(dygraphs.DataArray|dygraphs.GVizDataTable|string)), + options?: dygraphs.Options); - /** - * Returns the zoomed status of the chart for one or both axes. - * - * Axis is an optional parameter. Can be set to 'x' or 'y'. - * - * The zoomed status for an axis is set whenever a user zooms using the mouse - * or when the dateWindow or valueRange are updated (unless the - * isZoomedIgnoreProgrammaticZoom option is also specified). - */ - isZoomed(axis?: 'x' | 'y'): boolean; + /** + * Returns the zoomed status of the chart for one or both axes. + * + * Axis is an optional parameter. Can be set to 'x' or 'y'. + * + * The zoomed status for an axis is set whenever a user zooms using the mouse + * or when the dateWindow or valueRange are updated (unless the + * isZoomedIgnoreProgrammaticZoom option is also specified). + */ + isZoomed(axis?: 'x' | 'y'): boolean; - /** - * Returns information about the Dygraph object, including its containing ID. - */ - toString(): string; + /** + * Returns information about the Dygraph object, including its containing ID. + */ + toString(): string; - /** - * Returns the current value for an option, as set in the constructor or via - * updateOptions. You may pass in an (optional) series name to get per-series - * values for the option. - * - * All values returned by this method should be considered immutable. If you - * modify them, there is no guarantee that the changes will be honored or that - * dygraphs will remain in a consistent state. If you want to modify an option, - * use updateOptions() instead. - * - * @param {string} name The name of the option (e.g. 'strokeWidth') - * @param {string=} opt_seriesName Series name to get per-series values. - * @return {*} The value of the option. - */ - getOption(name: string, seriesName?: string): any; + /** + * Returns the current value for an option, as set in the constructor or via + * updateOptions. You may pass in an (optional) series name to get per-series + * values for the option. + * + * All values returned by this method should be considered immutable. If you + * modify them, there is no guarantee that the changes will be honored or that + * dygraphs will remain in a consistent state. If you want to modify an option, + * use updateOptions() instead. + * + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {*} The value of the option. + */ + getOption(name: string, seriesName?: string): any; - /** - * Get the value of an option on a per-axis basis. - */ - getOptionForAxis(name: string, axis: dygraphs.Axis): any; + /** + * Get the value of an option on a per-axis basis. + */ + getOptionForAxis(name: string, axis: dygraphs.Axis): any; - /** - * Returns the current rolling period, as set by the user or an option. - */ - rollPeriod(): number; + /** + * Returns the current rolling period, as set by the user or an option. + */ + rollPeriod(): number; - /** - * Returns the currently-visible x-range. This can be affected by zooming, - * panning or a call to updateOptions. - * Returns a two-element array: [left, right]. - * If the Dygraph has dates on the x-axis, these will be millis since epoch. - */ - xAxisRange(): [number, number]; + /** + * Returns the currently-visible x-range. This can be affected by zooming, + * panning or a call to updateOptions. + * Returns a two-element array: [left, right]. + * If the Dygraph has dates on the x-axis, these will be millis since epoch. + */ + xAxisRange(): [number, number]; - /** - * Returns the lower- and upper-bound x-axis values of the data set. - */ - xAxisExtremes(): [number, number]; + /** + * Returns the lower- and upper-bound x-axis values of the data set. + */ + xAxisExtremes(): [number, number]; - /** - * Returns the currently-visible y-range for an axis. This can be affected by - * zooming, panning or a call to updateOptions. Axis indices are zero-based. If - * called with no arguments, returns the range of the first axis. - * Returns a two-element array: [bottom, top]. - */ - yAxisRange(idx?: number): [number, number]; + /** + * Returns the currently-visible y-range for an axis. This can be affected by + * zooming, panning or a call to updateOptions. Axis indices are zero-based. If + * called with no arguments, returns the range of the first axis. + * Returns a two-element array: [bottom, top]. + */ + yAxisRange(idx?: number): [number, number]; - /** - * Returns the currently-visible y-ranges for each axis. This can be affected by - * zooming, panning, calls to updateOptions, etc. - * Returns an array of [bottom, top] pairs, one for each y-axis. - */ - yAxisRanges(): [number, number][]; + /** + * Returns the currently-visible y-ranges for each axis. This can be affected by + * zooming, panning, calls to updateOptions, etc. + * Returns an array of [bottom, top] pairs, one for each y-axis. + */ + yAxisRanges(): [number, number][]; - /** - * Convert from data coordinates to canvas/div X/Y coordinates. - * If specified, do this conversion for the coordinate system of a particular - * axis. Uses the first axis by default. - * Returns a two-element array: [X, Y] - * - * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord - * instead of toDomCoords(null, y, axis). - */ - toDomCoords(x: number, y: number, axis?: number): [number, number]; + /** + * Convert from data coordinates to canvas/div X/Y coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y] + * + * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord + * instead of toDomCoords(null, y, axis). + */ + toDomCoords(x: number, y: number, axis?: number): [number, number]; - /** - * Convert from data x coordinates to canvas/div X coordinate. - * If specified, do this conversion for the coordinate system of a particular - * axis. - * Returns a single value or null if x is null. - */ - toDomXCoord(x: number): number; + /** + * Convert from data x coordinates to canvas/div X coordinate. + * If specified, do this conversion for the coordinate system of a particular + * axis. + * Returns a single value or null if x is null. + */ + toDomXCoord(x: number): number; - /** - * Convert from data y coordinates to canvas/div Y coordinate and optional - * axis. Uses the first axis by default. - * - * returns a single value or null if y is null. - */ - toDomYCoord(y: number, axis?: number): number; + /** + * Convert from data y coordinates to canvas/div Y coordinate and optional + * axis. Uses the first axis by default. + * + * returns a single value or null if y is null. + */ + toDomYCoord(y: number, axis?: number): number; - /** - * Convert from canvas/div coords to data coordinates. - * If specified, do this conversion for the coordinate system of a particular - * axis. Uses the first axis by default. - * Returns a two-element array: [X, Y]. - * - * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord - * instead of toDataCoords(null, y, axis). - */ - toDataCoords(x: number, y: number, axis?: number): [number, number]; + /** + * Convert from canvas/div coords to data coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y]. + * + * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord + * instead of toDataCoords(null, y, axis). + */ + toDataCoords(x: number, y: number, axis?: number): [number, number]; - /** - * Convert from canvas/div x coordinate to data coordinate. - * - * If x is null, this returns null. - */ - toDataXCoord(x: number): number; + /** + * Convert from canvas/div x coordinate to data coordinate. + * + * If x is null, this returns null. + */ + toDataXCoord(x: number): number; - /** - * Convert from canvas/div y coord to value. - * - * If y is null, this returns null. - * if axis is null, this uses the first axis. - */ - toDataYCoord(y: number, axis?: number): number; + /** + * Convert from canvas/div y coord to value. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + */ + toDataYCoord(y: number, axis?: number): number; - /** - * Converts a y for an axis to a percentage from the top to the - * bottom of the drawing area. - * - * If the coordinate represents a value visible on the canvas, then - * the value will be between 0 and 1, where 0 is the top of the canvas. - * However, this method will return values outside the range, as - * values can fall outside the canvas. - * - * If y is null, this returns null. - * if axis is null, this uses the first axis. - * - * @param {number} y The data y-coordinate. - * @param {number} [axis] The axis number on which the data coordinate lives. - * @return {number} A fraction in [0, 1] where 0 = the top edge. - */ - toPercentYCoord(y: number, axis?: number): number; + /** + * Converts a y for an axis to a percentage from the top to the + * bottom of the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the top of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + * + * @param {number} y The data y-coordinate. + * @param {number} [axis] The axis number on which the data coordinate lives. + * @return {number} A fraction in [0, 1] where 0 = the top edge. + */ + toPercentYCoord(y: number, axis?: number): number; - /** - * Converts an x value to a percentage from the left to the right of - * the drawing area. - * - * If the coordinate represents a value visible on the canvas, then - * the value will be between 0 and 1, where 0 is the left of the canvas. - * However, this method will return values outside the range, as - * values can fall outside the canvas. - * - * If x is null, this returns null. - * @param {number} x The data x-coordinate. - * @return {number} A fraction in [0, 1] where 0 = the left edge. - */ - toPercentXCoord(x: number): number; + /** + * Converts an x value to a percentage from the left to the right of + * the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the left of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If x is null, this returns null. + * @param {number} x The data x-coordinate. + * @return {number} A fraction in [0, 1] where 0 = the left edge. + */ + toPercentXCoord(x: number): number; - /** - * Returns the number of columns (including the independent variable). - */ - numColumns(): number; + /** + * Returns the number of columns (including the independent variable). + */ + numColumns(): number; - /** - * Returns the number of rows (excluding any header/label row). - */ - numRows(): number; + /** + * Returns the number of rows (excluding any header/label row). + */ + numRows(): number; - /** - * Returns the value in the given row and column. If the row and column exceed - * the bounds on the data, returns null. Also returns null if the value is - * missing. - * @param {number} row The row number of the data (0-based). Row 0 is the - * first row of data, not a header row. - * @param {number} col The column number of the data (0-based) - * @return {number} The value in the specified cell or null if the row/col - * were out of range. - */ - getValue(row: number, col: number): number; + /** + * Returns the value in the given row and column. If the row and column exceed + * the bounds on the data, returns null. Also returns null if the value is + * missing. + * @param {number} row The row number of the data (0-based). Row 0 is the + * first row of data, not a header row. + * @param {number} col The column number of the data (0-based) + * @return {number} The value in the specified cell or null if the row/col + * were out of range. + */ + getValue(row: number, col: number): number; - /** - * Detach DOM elements in the dygraph and null out all data references. - * Calling this when you're done with a dygraph can dramatically reduce memory - * usage. See, e.g., the tests/perf.html example. - */ - destroy(): void; + /** + * Detach DOM elements in the dygraph and null out all data references. + * Calling this when you're done with a dygraph can dramatically reduce memory + * usage. See, e.g., the tests/perf.html example. + */ + destroy(): void; - /** - * Return the list of colors. This is either the list of colors passed in the - * attributes or the autogenerated list of rgb(r,g,b) strings. - * This does not return colors for invisible series. - * @return {Array.} The list of colors. - */ - getColors(): string[]; + /** + * Return the list of colors. This is either the list of colors passed in the + * attributes or the autogenerated list of rgb(r,g,b) strings. + * This does not return colors for invisible series. + * @return {Array.} The list of colors. + */ + getColors(): string[]; - /** - * Returns a few attributes of a series, i.e. its color, its visibility, which - * axis it's assigned to, and its column in the original data. - * Returns null if the series does not exist. - * Otherwise, returns an object with column, visibility, color and axis properties. - * The "axis" property will be set to 1 for y1 and 2 for y2. - * The "column" property can be fed back into getValue(row, column) to get - * values for this series. - */ - getPropertiesForSeries(series_name: string): dygraphs.SeriesProperties; + /** + * Returns a few attributes of a series, i.e. its color, its visibility, which + * axis it's assigned to, and its column in the original data. + * Returns null if the series does not exist. + * Otherwise, returns an object with column, visibility, color and axis properties. + * The "axis" property will be set to 1 for y1 and 2 for y2. + * The "column" property can be fed back into getValue(row, column) to get + * values for this series. + */ + getPropertiesForSeries(series_name: string): dygraphs.SeriesProperties; - /** - * Reset the zoom to the original view coordinates. This is the same as - * double-clicking on the graph. - */ - resetZoom(): void; + /** + * Reset the zoom to the original view coordinates. This is the same as + * double-clicking on the graph. + */ + resetZoom(): void; - /** - * Get the current graph's area object. - */ - getArea(): dygraphs.Area; + /** + * Get the current graph's area object. + */ + getArea(): dygraphs.Area; - /** - * Convert a mouse event to DOM coordinates relative to the graph origin. - * - * Returns a two-element array: [X, Y]. - */ - eventToDomCoords(event: MouseEvent): [number, number]; + /** + * Convert a mouse event to DOM coordinates relative to the graph origin. + * + * Returns a two-element array: [X, Y]. + */ + eventToDomCoords(event: MouseEvent): [number, number]; - /** - * Manually set the selected points and display information about them in the - * legend. The selection can be cleared using clearSelection() and queried - * using getSelection(). - * @param {number} row Row number that should be highlighted (i.e. appear with - * hover dots on the chart). - * @param {seriesName} optional series name to highlight that series with the - * the highlightSeriesOpts setting. - * @param { locked } optional If true, keep seriesName selected when mousing - * over the graph, disabling closest-series highlighting. Call clearSelection() - * to unlock it. - */ - setSelection(row: number|boolean, seriesName?: string, locked?: boolean): void; + /** + * Manually set the selected points and display information about them in the + * legend. The selection can be cleared using clearSelection() and queried + * using getSelection(). + * @param {number} row Row number that should be highlighted (i.e. appear with + * hover dots on the chart). + * @param {seriesName} optional series name to highlight that series with the + * the highlightSeriesOpts setting. + * @param { locked } optional If true, keep seriesName selected when mousing + * over the graph, disabling closest-series highlighting. Call clearSelection() + * to unlock it. + */ + setSelection(row: number|boolean, seriesName?: string, locked?: boolean): void; - /** - * Clears the current selection (i.e. points that were highlighted by moving - * the mouse over the chart). - */ - clearSelection(): void; + /** + * Clears the current selection (i.e. points that were highlighted by moving + * the mouse over the chart). + */ + clearSelection(): void; - /** - * Returns the number of the currently selected row. To get data for this row, - * you can use the getValue method. - * @return {number} row number, or -1 if nothing is selected - */ - getSelection(): number; + /** + * Returns the number of the currently selected row. To get data for this row, + * you can use the getValue method. + * @return {number} row number, or -1 if nothing is selected + */ + getSelection(): number; - /** - * Returns the name of the currently-highlighted series. - * Only available when the highlightSeriesOpts option is in use. - */ - getHighlightSeries(): string; + /** + * Returns the name of the currently-highlighted series. + * Only available when the highlightSeriesOpts option is in use. + */ + getHighlightSeries(): string; - /** - * Returns true if the currently-highlighted series was locked - * via setSelection(..., seriesName, true). - */ - isSeriesLocked(): boolean; + /** + * Returns true if the currently-highlighted series was locked + * via setSelection(..., seriesName, true). + */ + isSeriesLocked(): boolean; - /** - * Returns the number of y-axes on the chart. - */ - numAxes(): number; + /** + * Returns the number of y-axes on the chart. + */ + numAxes(): number; - /** - * Changes various properties of the graph. These can include: - *
    - *
  • file: changes the source data for the graph
  • - *
  • errorBars: changes whether the data contains stddev
  • - *
- * - * There's a huge variety of options that can be passed to this method. For a - * full list, see http://dygraphs.com/options.html. - * - * @param {Object} input_attrs The new properties and values - * @param {boolean} block_redraw Usually the chart is redrawn after every - * call to updateOptions(). If you know better, you can pass true to - * explicitly block the redraw. This can be useful for chaining - * updateOptions() calls, avoiding the occasional infinite loop and - * preventing redraws when it's not necessary (e.g. when updating a - * callback). - */ - updateOptions(input_attrs: dygraphs.Options, block_redraw?: boolean): void; + /** + * Changes various properties of the graph. These can include: + *
    + *
  • file: changes the source data for the graph
  • + *
  • errorBars: changes whether the data contains stddev
  • + *
+ * + * There's a huge variety of options that can be passed to this method. For a + * full list, see http://dygraphs.com/options.html. + * + * @param {Object} input_attrs The new properties and values + * @param {boolean} block_redraw Usually the chart is redrawn after every + * call to updateOptions(). If you know better, you can pass true to + * explicitly block the redraw. This can be useful for chaining + * updateOptions() calls, avoiding the occasional infinite loop and + * preventing redraws when it's not necessary (e.g. when updating a + * callback). + */ + updateOptions(input_attrs: dygraphs.Options, block_redraw?: boolean): void; - /** - * Resizes the dygraph. If no parameters are specified, resizes to fill the - * containing div (which has presumably changed size since the dygraph was - * instantiated. If the width/height are specified, the div will be resized. - * - * This is far more efficient than destroying and re-instantiating a - * Dygraph, since it doesn't have to reparse the underlying data. - * - * @param {number} width Width (in pixels) - * @param {number} height Height (in pixels) - */ - resize(width: number, height: number): void; + /** + * Resizes the dygraph. If no parameters are specified, resizes to fill the + * containing div (which has presumably changed size since the dygraph was + * instantiated. If the width/height are specified, the div will be resized. + * + * This is far more efficient than destroying and re-instantiating a + * Dygraph, since it doesn't have to reparse the underlying data. + * + * @param {number} width Width (in pixels) + * @param {number} height Height (in pixels) + */ + resize(width: number, height: number): void; - /** - * Adjusts the number of points in the rolling average. Updates the graph to - * reflect the new averaging period. - * @param {number} length Number of points over which to average the data. - */ - adjustRoll(length: number): void; + /** + * Adjusts the number of points in the rolling average. Updates the graph to + * reflect the new averaging period. + * @param {number} length Number of points over which to average the data. + */ + adjustRoll(length: number): void; - /** - * Returns a boolean array of visibility statuses. - */ - visibility(): boolean[]; + /** + * Returns a boolean array of visibility statuses. + */ + visibility(): boolean[]; - /** - * Changes the visiblity of a series. - * - * @param {number} num the series index - * @param {boolean} value true or false, identifying the visibility. - */ - setVisibility(num: number, value: boolean): void; + /** + * Changes the visiblity of a series. + * + * @param {number} num the series index + * @param {boolean} value true or false, identifying the visibility. + */ + setVisibility(num: number, value: boolean): void; - /** - * Update the list of annotations and redraw the chart. - * See dygraphs.com/annotations.html for more info on how to use annotations. - * @param ann {Array} An array of annotation objects. - * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional). - */ - setAnnotations(ann: dygraphs.Annotation[], suppressDraw?: boolean): void; + /** + * Update the list of annotations and redraw the chart. + * See dygraphs.com/annotations.html for more info on how to use annotations. + * @param ann {Array} An array of annotation objects. + * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional). + */ + setAnnotations(ann: dygraphs.Annotation[], suppressDraw?: boolean): void; - /** - * Return the list of annotations. - */ - annotations(): dygraphs.Annotation[]; + /** + * Return the list of annotations. + */ + annotations(): dygraphs.Annotation[]; - /** - * Get the list of label names for this graph. The first column is the - * x-axis, so the data series names start at index 1. - * - * Returns null when labels have not yet been defined. - */ - getLabels(): string[]; + /** + * Get the list of label names for this graph. The first column is the + * x-axis, so the data series names start at index 1. + * + * Returns null when labels have not yet been defined. + */ + getLabels(): string[]; - /** - * Get the index of a series (column) given its name. The first column is the - * x-axis, so the data series start with index 1. - */ - indexFromSetName(name: string): number; + /** + * Get the index of a series (column) given its name. The first column is the + * x-axis, so the data series start with index 1. + */ + indexFromSetName(name: string): number; - /** - * Trigger a callback when the dygraph has drawn itself and is ready to be - * manipulated. This is primarily useful when dygraphs has to do an XHR for the - * data (i.e. a URL is passed as the data source) and the chart is drawn - * asynchronously. If the chart has already drawn, the callback will fire - * immediately. - * - * This is a good place to call setAnnotations(). - */ - ready(callback: (g: Dygraph) => any): void; + /** + * Trigger a callback when the dygraph has drawn itself and is ready to be + * manipulated. This is primarily useful when dygraphs has to do an XHR for the + * data (i.e. a URL is passed as the data source) and the chart is drawn + * asynchronously. If the chart has already drawn, the callback will fire + * immediately. + * + * This is a good place to call setAnnotations(). + */ + ready(callback: (g: Dygraph) => any): void; - // Tick granularities (passed to ticker). - static SECONDLY: number; - static TWO_SECONDLY: number; - static FIVE_SECONDLY: number; - static TEN_SECONDLY: number; - static THIRTY_SECONDLY: number; - static MINUTELY: number; - static TWO_MINUTELY: number; - static FIVE_MINUTELY: number; - static TEN_MINUTELY: number; - static THIRTY_MINUTELY: number; - static HOURLY: number; - static TWO_HOURLY: number; - static SIX_HOURLY: number; - static DAILY: number; - static TWO_DAILY: number; - static WEEKLY: number; - static MONTHLY: number; - static QUARTERLY: number; - static BIANNUAL: number; - static ANNUAL: number; - static DECADAL: number; - static CENTENNIAL: number; - static NUM_GRANULARITIES: number; + // Tick granularities (passed to ticker). + static SECONDLY: number; + static TWO_SECONDLY: number; + static FIVE_SECONDLY: number; + static TEN_SECONDLY: number; + static THIRTY_SECONDLY: number; + static MINUTELY: number; + static TWO_MINUTELY: number; + static FIVE_MINUTELY: number; + static TEN_MINUTELY: number; + static THIRTY_MINUTELY: number; + static HOURLY: number; + static TWO_HOURLY: number; + static SIX_HOURLY: number; + static DAILY: number; + static TWO_DAILY: number; + static WEEKLY: number; + static MONTHLY: number; + static QUARTERLY: number; + static BIANNUAL: number; + static ANNUAL: number; + static DECADAL: number; + static CENTENNIAL: number; + static NUM_GRANULARITIES: number; - static defaultInteractionModel: any; + static defaultInteractionModel: any; - static DOTTED_LINE: number[]; - static DASHED_LINE: number[]; - static DOT_DASH_LINE: number[]; + static DOTTED_LINE: number[]; + static DASHED_LINE: number[]; + static DOT_DASH_LINE: number[]; - static Plotters: { - errorPlotter: any; - linePlotter: any; - fillPlotter: any; - } + static Plotters: { + errorPlotter: any; + linePlotter: any; + fillPlotter: any; + } } declare module "dygraphs" { - export = Dygraph; + export = Dygraph; } \ No newline at end of file From 966b3eff1b559cfe4a16548451e3affb56ab51c4 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 24 Sep 2016 13:16:24 -0400 Subject: [PATCH 14/31] reference google.visualization --- dygraphs/dygraphs.d.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dygraphs/dygraphs.d.ts b/dygraphs/dygraphs.d.ts index cc21caf766..a29394fd88 100644 --- a/dygraphs/dygraphs.d.ts +++ b/dygraphs/dygraphs.d.ts @@ -3,15 +3,12 @@ // Definitions by: Dan Vanderkam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare namespace dygraphs { type DataArray = number[][]; - // TODO: check for another DT definition to use here. - interface GVizDataTable { - getNumberOfRows(): number; - getNumberOfColumns(): number; - getValue(rowIndex: number, columnIndex: number): number; - } + type Data = string|DataArray|google.visualization.DataTable; interface PerSeriesOptions { /** @@ -441,7 +438,7 @@ declare namespace dygraphs { * updateOptions; it cannot be set from the constructor. For a full description of valid data * formats, see the Data Formats page. */ - file?: DataArray|GVizDataTable|string; + file?: Data; /** * When set, attempt to parse each cell in the CSV file as "a/b", where a and b are integers. @@ -870,7 +867,7 @@ declare namespace dygraphs { declare class Dygraph { constructor( container: HTMLElement | string, - data: dygraphs.DataArray|dygraphs.GVizDataTable|string|(()=>(dygraphs.DataArray|dygraphs.GVizDataTable|string)), + data: dygraphs.Data|(()=>dygraphs.Data), options?: dygraphs.Options); /** From d7f49d81663861660d9554a0897a2307b8b2e5b5 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 24 Sep 2016 13:37:33 -0400 Subject: [PATCH 15/31] include version --- dygraphs/dygraphs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dygraphs/dygraphs.d.ts b/dygraphs/dygraphs.d.ts index a29394fd88..0fbb4fae74 100644 --- a/dygraphs/dygraphs.d.ts +++ b/dygraphs/dygraphs.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dygraphs +// Type definitions for dygraphs 1.1.1 // Project: http://dygraphs.com // Definitions by: Dan Vanderkam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From e277344c14a3660e20e4645525c50b59c9756e1d Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Sat, 24 Sep 2016 21:18:16 +0200 Subject: [PATCH 16/31] Added typings for css-modules-require-hook --- .../css-modules-require-hook-tests.ts | 174 ++++++++++++++++++ .../css-modules-require-hook.d.ts | 47 +++++ 2 files changed, 221 insertions(+) create mode 100644 css-modules-require-hook/css-modules-require-hook-tests.ts create mode 100644 css-modules-require-hook/css-modules-require-hook.d.ts diff --git a/css-modules-require-hook/css-modules-require-hook-tests.ts b/css-modules-require-hook/css-modules-require-hook-tests.ts new file mode 100644 index 0000000000..8fde182571 --- /dev/null +++ b/css-modules-require-hook/css-modules-require-hook-tests.ts @@ -0,0 +1,174 @@ +/// +/// + +import * as hook from 'css-modules-require-hook'; +import * as path from 'path'; + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#usage +// + +hook({ generateScopedName: '[name]__[local]___[hash:base64:5]' }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#adding-custom-postcss-plugins +// + +hook({ + prepend: [ + () => { + // my prepender + }, + ], +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#specify-custom-pattern-to-build-generic-names +// + +hook({ generateScopedName: '[name]__[local]___[hash:base64:5]' }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#using-stylus-as-a-preprocessor +// + +hook({ + extensions: ['.styl'], + preprocessCss: (css: string, filepath: string) => { + // my preprocesser + }, +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#tuning-options +// + +hook({ /* my option */ }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#devmode-boolean +// + +hook({ devMode: false }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#extensions-array +// + +hook({ extensions: ['.scss', '.sass'] }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#ignore-functionregexstring +// + +hook({ ignore: (file: string) => false }); +hook({ ignore: 'unused' }); +hook({ ignore: /\.test\.(css|scss|sass)/$ }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#preprocesscss-function +// + +hook({ preprocessCss: (css: string, filepath: string) => css }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#processcss-function +// + +hook({ processCss: (css: string, filepath: string) => css }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#processoropts-object +// + +hook({ + extensions: '.scss', + processorOpts: { + parser: () => { + // my parser + }, + }, +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#camelcase-boolean +// + +hook({ camelCase: true }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#append-array +// + +hook({ + append: [ + () => { + // another plugin + }, + ], +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#prepend-array +// + +hook({ + prepend: [ + () => { + // again, another plugin + }, + ], +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#use-array +// + +hook({ + use: [ + () => { + // they like plugins very much + }, + ], +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#createimportedname-function +// + +hook({ + createImportedName: (css: string, filepath: string) => { + // my import name creator + }, +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#generatescopedname-stringfunction +// + +hook({ generateScopedName: '[name]__[local]___[hash:base64:5]' }); +hook({ + generateScopedName: () => { + // should generate something + }, +}); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#hashprefix-string +// + +hook({ hashPrefix: 'awesome_' }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#mode-string +// + +hook({ mode: 'global' }); +hook({ mode: 'local' }); +hook({ mode: 'pure' }); + +// +// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#rootdir-string +// + +hook({ rootDir: path.resolve('./my-folder') }); diff --git a/css-modules-require-hook/css-modules-require-hook.d.ts b/css-modules-require-hook/css-modules-require-hook.d.ts new file mode 100644 index 0000000000..3777cf1fc2 --- /dev/null +++ b/css-modules-require-hook/css-modules-require-hook.d.ts @@ -0,0 +1,47 @@ +// Type definitions for css-modules-require-hook +// Project: https://github.com/css-modules/css-modules-require-hook +// Definitions by: Cedric van Putten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'css-modules-require-hook' { + interface Options { + /** Helps you to invalidate cache of all require calls. */ + devMode?: boolean; + /** Attach the require hook to additional file extensions. */ + extensions?: string | string[]; + /** Provides possibility to exclude particular files from processing. */ + ignore?: string | RegExp | Function; + /** In rare cases you may want to precompile styles, before they will be passed to the PostCSS pipeline. */ + preprocessCss?: Function; + /** In rare cases you may want to get compiled styles in runtime, so providing this option helps. */ + processCss?: Function; + /** Provides possibility to pass custom options to the LazyResult instance. */ + processorOpts?: Object; + /** Camelizes exported class names. */ + camelCase?: boolean; + /** Appends custom plugins to the end of the PostCSS pipeline. */ + append?: Array; + /** Prepends custom plugins to the beginning of the PostCSS pipeline. */ + prepend?: Array; + /** Provides the full list of PostCSS plugins to the pipeline. */ + use?: Array; + /** Short alias for the postcss-modules-extract-imports plugin's createImportedName option. */ + createImportedName?: Function; + /** Short alias for the postcss-modules-scope plugin's option. */ + generateScopedName?: string | Function; + /** Short alias for the generic-names helper option. */ + hashPrefix?: string; + /** Short alias for the postcss-modules-local-by-default plugin's option. */ + mode?: string; + /** Provides absolute path to the project directory. */ + rootDir?: string; + } + + interface RequireHook { + (options?: Options): void; + } + + var requireHook: RequireHook; + + export = requireHook; +} From 53a729cd0973d20549cf7bc320bc95932c7c0f7d Mon Sep 17 00:00:00 2001 From: microshine Date: Sun, 25 Sep 2016 01:33:59 +0300 Subject: [PATCH 17/31] Remove spaces --- pkcs11js/pkcs11js.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkcs11js/pkcs11js.d.ts b/pkcs11js/pkcs11js.d.ts index 676dce6555..d1b5314878 100644 --- a/pkcs11js/pkcs11js.d.ts +++ b/pkcs11js/pkcs11js.d.ts @@ -1173,11 +1173,11 @@ declare module "pkcs11js" { const CKM_RSA_PKCS_TPM_1_1: number; const CKM_RSA_PKCS_OAEP_TPM_1_1: number; const CKM_VENDOR_DEFINED: number; - + // Session flags const CKF_RW_SESSION: number; const CKF_SERIAL_SESSION: number; - + // Follows const CKF_HW: number; const CKF_ENCRYPT: number; From 9215c3e845e3b03882b5c7fd45644eb5f3b17cf8 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Sun, 25 Sep 2016 02:22:40 +0200 Subject: [PATCH 18/31] Added semver, added explicit ignore callback, unified array definition and removed one time interface --- .../css-modules-require-hook.d.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/css-modules-require-hook/css-modules-require-hook.d.ts b/css-modules-require-hook/css-modules-require-hook.d.ts index 3777cf1fc2..b990ffb90f 100644 --- a/css-modules-require-hook/css-modules-require-hook.d.ts +++ b/css-modules-require-hook/css-modules-require-hook.d.ts @@ -1,4 +1,4 @@ -// Type definitions for css-modules-require-hook +// Type definitions for css-modules-require-hook 4.0.3 // Project: https://github.com/css-modules/css-modules-require-hook // Definitions by: Cedric van Putten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,7 +10,7 @@ declare module 'css-modules-require-hook' { /** Attach the require hook to additional file extensions. */ extensions?: string | string[]; /** Provides possibility to exclude particular files from processing. */ - ignore?: string | RegExp | Function; + ignore?: string | RegExp | ((filepath: string) => boolean); /** In rare cases you may want to precompile styles, before they will be passed to the PostCSS pipeline. */ preprocessCss?: Function; /** In rare cases you may want to get compiled styles in runtime, so providing this option helps. */ @@ -20,11 +20,11 @@ declare module 'css-modules-require-hook' { /** Camelizes exported class names. */ camelCase?: boolean; /** Appends custom plugins to the end of the PostCSS pipeline. */ - append?: Array; + append?: any[]; /** Prepends custom plugins to the beginning of the PostCSS pipeline. */ - prepend?: Array; + prepend?: any[]; /** Provides the full list of PostCSS plugins to the pipeline. */ - use?: Array; + use?: any[]; /** Short alias for the postcss-modules-extract-imports plugin's createImportedName option. */ createImportedName?: Function; /** Short alias for the postcss-modules-scope plugin's option. */ @@ -37,11 +37,7 @@ declare module 'css-modules-require-hook' { rootDir?: string; } - interface RequireHook { - (options?: Options): void; - } - - var requireHook: RequireHook; + var requireHook: (options?: Options) => void; export = requireHook; } From 6b5e394f6f408b50a1fff4d8734fcf9c0585d76c Mon Sep 17 00:00:00 2001 From: Andrea Zucchini Date: Sun, 25 Sep 2016 02:50:36 +0200 Subject: [PATCH 19/31] Overwriting method signature --- method-override/method-override.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/method-override/method-override.d.ts b/method-override/method-override.d.ts index 572a9226f8..73e2956cd2 100644 --- a/method-override/method-override.d.ts +++ b/method-override/method-override.d.ts @@ -20,8 +20,10 @@ declare module "method-override" { } } - function e(getter?: string, options?: e.MethodOverrideOptions): express.RequestHandler; - function e(getter?: (req: express.Request, res: express.Response) => string, options?: e.MethodOverrideOptions): express.RequestHandler; + + type stringType = string; + type functionType = (req: express.Request, res: express.Response) => string; + function e(getter?: stringType | functionType, options?: e.MethodOverrideOptions): express.RequestHandler; export = e; } From 34ff2d1550fa30142966b1f5fa3a5cb8ca60c9e4 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Sun, 25 Sep 2016 12:39:15 +0800 Subject: [PATCH 20/31] Correct parameter type --- validator/validator.d.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/validator/validator.d.ts b/validator/validator.d.ts index c2289cf169..48fce17ff8 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -17,7 +17,7 @@ declare namespace ValidatorJS { contains(str: string, elem: any): boolean; // check if the string matches the comparison. - equals(str: string, comparison: any): boolean; + equals(str: string, comparison: string): boolean; // check if the string is a date that's after the specified date (defaults to now). isAfter(str: string, date?: string): boolean; @@ -152,7 +152,7 @@ declare namespace ValidatorJS { isURL(str: string, options?: IsURLOptions): boolean; // check if the string is a UUID. Must be one of ['3', '4', '5', 'all'], default is all. - isUUID(str: string, version?: string|number): boolean; + isUUID(str: string, version?: string | number): boolean; // check if the string is uppercase. isUppercase(str: string): boolean; @@ -161,10 +161,10 @@ declare namespace ValidatorJS { isVariableWidth(str: string): boolean; // checks characters if they appear in the whitelist. - isWhitelisted(str: string, chars: string|string[]): boolean; + isWhitelisted(str: string, chars: string | string[]): boolean; // check if string matches the pattern. - matches(str: string, pattern: RegExp|string, modifiers?: string): boolean; + matches(str: string, pattern: RegExp | string, modifiers?: string): boolean; // ************** // * Sanitizers * @@ -181,13 +181,13 @@ declare namespace ValidatorJS { unescape(input: string): string; // trim characters from the left-side of the input. - ltrim(input: any, chars?: string): string; + ltrim(input: string, chars?: string): string; // canonicalize an email address. normalizeEmail(email: string, options?: NormalizeEmailOptions): string; // trim characters from the right-side of the input. - rtrim(input: any, chars?: string): string; + rtrim(input: string, chars?: string): string; // remove characters with a numerical value < 32 and 127, mostly control characters. If keep_new_lines is true, // newline characters are preserved (\n and \r, hex 0xA and 0xD). Unicode-safe in JavaScript. @@ -195,19 +195,19 @@ declare namespace ValidatorJS { // convert the input to a boolean. Everything except for '0', 'false' and '' returns true. In strict mode only '1' // and 'true' return true. - toBoolean(input: any, strict?: boolean): boolean; + toBoolean(input: string, strict?: boolean): boolean; // convert the input to a date, or null if the input is not a date. - toDate(input: any): Date; // Date or null + toDate(input: string): Date; // Date or null // convert the input to a float, or NaN if the input is not a float. - toFloat(input: any): number; // number or NaN + toFloat(input: string): number; // number or NaN // convert the input to an integer, or NaN if the input is not an integer. - toInt(input: any, radix?: number): number; // number or NaN + toInt(input: string, radix?: number): number; // number or NaN // trim characters (whitespace by default) from both sides of the input. - trim(input: any, chars?: string): string; + trim(input: string, chars?: string): string; // remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will // need to escape some chars, e.g. whitelist(input, '\\[\\]'). @@ -284,8 +284,8 @@ declare namespace ValidatorJS { require_host: boolean; require_valid_protocol?: boolean; allow_underscores?: boolean; - host_whitelist?: (string|RegExp)[]; - host_blacklist?: (string|RegExp)[]; + host_whitelist?: (string | RegExp)[]; + host_blacklist?: (string | RegExp)[]; allow_trailing_dot?: boolean; allow_protocol_relative_urls?: boolean; } @@ -304,7 +304,7 @@ declare module "validator" { } // deprecated interfaces for backward compatibility, please use ValidatorJS.* instead the ones -interface IValidatorStatic extends ValidatorJS.ValidatorStatic {} -interface IURLoptions extends ValidatorJS.IsURLOptions {} -interface IFQDNoptions extends ValidatorJS.IsFQDNOptions {} -interface IEmailoptions extends ValidatorJS.NormalizeEmailOptions {} +interface IValidatorStatic extends ValidatorJS.ValidatorStatic { } +interface IURLoptions extends ValidatorJS.IsURLOptions { } +interface IFQDNoptions extends ValidatorJS.IsFQDNOptions { } +interface IEmailoptions extends ValidatorJS.NormalizeEmailOptions { } From ac3aa50a8dff706e9f7495e19dfab96c32925a89 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Sun, 25 Sep 2016 12:53:48 +0800 Subject: [PATCH 21/31] Add MobilePhoneLocale --- validator/validator.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/validator/validator.d.ts b/validator/validator.d.ts index c2289cf169..dc69ff1c54 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -6,7 +6,8 @@ declare namespace ValidatorJS { type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - + type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" + interface ValidatorStatic { // ************** @@ -130,7 +131,7 @@ declare namespace ValidatorJS { // 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'hu-HU', // 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', // 'vi-VN', 'zh-CN', 'zh-TW']). - isMobilePhone(str: string, locale: string): boolean; + isMobilePhone(str: string, locale: MobilePhoneLocale): boolean; // check if the string is a valid hex-encoded representation of a MongoDB ObjectId // (http://docs.mongodb.org/manual/reference/object-id/). From bf8640709e1ba72ed387b5f80970f60734bfe054 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Sun, 25 Sep 2016 12:56:19 +0800 Subject: [PATCH 22/31] Add isMobilePhone tests --- validator/validator-tests.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index 748a6bf340..cc857121bb 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -178,7 +178,39 @@ let any: any; result = validator.isMD5('sample'); + result = validator.isMobilePhone('sample', 'ar-DZ'); + result = validator.isMobilePhone('sample', 'ar-SA'); + result = validator.isMobilePhone('sample', 'ar-SY'); + result = validator.isMobilePhone('sample', 'cs-CZ'); + result = validator.isMobilePhone('sample', 'de-DE'); + result = validator.isMobilePhone('sample', 'da-DK'); + result = validator.isMobilePhone('sample', 'el-GR'); + result = validator.isMobilePhone('sample', 'en-AU'); + result = validator.isMobilePhone('sample', 'en-GB'); + result = validator.isMobilePhone('sample', 'en-HK'); + result = validator.isMobilePhone('sample', 'en-IN'); + result = validator.isMobilePhone('sample', 'en-NZ'); result = validator.isMobilePhone('sample', 'en-US'); + result = validator.isMobilePhone('sample', 'en-CA'); + result = validator.isMobilePhone('sample', 'en-ZA'); + result = validator.isMobilePhone('sample', 'en-ZM'); + result = validator.isMobilePhone('sample', 'es-ES'); + result = validator.isMobilePhone('sample', 'fi-FI'); + result = validator.isMobilePhone('sample', 'fr-FR'); + result = validator.isMobilePhone('sample', 'hu-HU'); + result = validator.isMobilePhone('sample', 'it-IT'); + result = validator.isMobilePhone('sample', 'ja-JP'); + result = validator.isMobilePhone('sample', 'ms-MY'); + result = validator.isMobilePhone('sample', 'nb-NO'); + result = validator.isMobilePhone('sample', 'nn-NO'); + result = validator.isMobilePhone('sample', 'pl-PL'); + result = validator.isMobilePhone('sample', 'pt-PT'); + result = validator.isMobilePhone('sample', 'ru-RU'); + result = validator.isMobilePhone('sample', 'sr-RS'); + result = validator.isMobilePhone('sample', 'tr-TR'); + result = validator.isMobilePhone('sample', 'vi-VN'); + result = validator.isMobilePhone('sample', 'zh-CN'); + result = validator.isMobilePhone('sample', 'zh-TW'); result = validator.isMongoId('sample'); From 9e563f461278090424447a065809149f017cd182 Mon Sep 17 00:00:00 2001 From: mudkip Date: Sun, 25 Sep 2016 14:34:01 +0800 Subject: [PATCH 23/31] Type definitions for bit-array --- bit-array/bit-array-tests.ts | 10 ++++ bit-array/bit-array.d.ts | 106 +++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 bit-array/bit-array-tests.ts create mode 100644 bit-array/bit-array.d.ts diff --git a/bit-array/bit-array-tests.ts b/bit-array/bit-array-tests.ts new file mode 100644 index 0000000000..9337c2afa9 --- /dev/null +++ b/bit-array/bit-array-tests.ts @@ -0,0 +1,10 @@ +/// + +import * as BitArray from "bit-array"; + +const a = new BitArray(32); +a.set(0, true); +a.set(31, true); +a.toString(); // "10000000000000000000000000000001" +a.get(1); // false +a.get(31); // true \ No newline at end of file diff --git a/bit-array/bit-array.d.ts b/bit-array/bit-array.d.ts new file mode 100644 index 0000000000..e9ee31339e --- /dev/null +++ b/bit-array/bit-array.d.ts @@ -0,0 +1,106 @@ +// Type definitions for bit-array v0.2.2 +// Project: https://github.com/bramstein/bit-array +// Definitions by: Mudkip +// Definitions: https://github.com/mudkipme/DefinitelyTyped + +declare module "bit-array" { + + class BitArray { + /** + * Creates a new empty BitArray with the given length or initialises the BitArray with the given hex representation. + */ + constructor(size: number, hex?: string); + + /** + * Returns the total number of bits in this BitArray. + */ + size(): number; + + /** + * Sets the bit at index to a value (boolean.) + */ + set(index: number, value: boolean): BitArray; + + /** + * Toggles the bit at index. If the bit is on, it is turned off. Likewise, if the bit is off it is turned on. + */ + toggle(index: number): BitArray; + + /** + * Returns the value of the bit at index (boolean.) + */ + get(index: number): boolean; + + /** + * Resets the BitArray so that it is empty and can be re-used. + */ + reset(): BitArray; + + /** + * Returns a copy of this BitArray. + */ + copy(): BitArray; + + /** + * Returns true if this BitArray equals another. Two BitArrays are considered + * equal if both have the same length and bit pattern. + */ + equals(x: BitArray): boolean; + + /** + * Returns the JSON representation of this BitArray. + */ + toJSON(): string; + + /** + * Returns a string representation of the BitArray with bits + * in mathemetical order. + */ + toBinaryString(): string; + + /** + * Returns a hexadecimal string representation of the BitArray + * with bits in logical order. + */ + toHexString(): string; + + /** + * Returns a string representation of the BitArray with bits + * in logical order. + */ + toString(): string; + + /** + * Convert the BitArray to an Array of boolean values (slow). + */ + toArray(): boolean[]; + + /** + * Returns the total number of bits set to one in this BitArray. + */ + count(): number; + + /** + * Inverts this BitArray. + */ + not(): BitArray; + + /** + * Bitwise OR on the values of this BitArray using BitArray x. + */ + or(x: BitArray): BitArray; + + /** + * Bitwise AND on the values of this BitArray using BitArray x. + */ + and(x: BitArray): BitArray; + + /** + * Bitwise XOR on the values of this BitArray using BitArray x. + */ + xor(x: BitArray): BitArray; + } + + namespace BitArray {} + export = BitArray; +} \ No newline at end of file From cc8a36678692b28eeea4e5f8dcc17fc3de21e4b6 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Sun, 25 Sep 2016 15:03:32 +0800 Subject: [PATCH 24/31] Add emit for cluster --- node/node.d.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index f3657db4a5..5b807cb5b2 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -797,6 +797,14 @@ declare module "cluster" { addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. addListener(event: "online", listener: () => void): this; + emit(event: string, listener: Function): boolean + emit(event: "disconnect", listener: () => void): boolean + emit(event: "error", listener: (code: number, signal: string) => void): boolean + emit(event: "exit", listener: (code: number, signal: string) => void): boolean + emit(event: "listening", listener: (address: Address) => void): boolean + emit(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): boolean + emit(event: "online", listener: () => void): boolean + on(event: string, listener: Function): this; on(event: "disconnect", listener: () => void): this; on(event: "error", listener: (code: number, signal: string) => void): this; @@ -863,6 +871,15 @@ declare module "cluster" { addListener(event: "online", listener: (worker: Worker) => void): this; addListener(event: "setup", listener: (settings: any) => void): this; + emit(event: string, listener: Function): boolean; + emit(event: "disconnect", listener: (worker: Worker) => void): boolean; + emit(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): boolean; + emit(event: "fork", listener: (worker: Worker) => void): boolean; + emit(event: "listening", listener: (worker: Worker, address: Address) => void): boolean; + emit(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): boolean; + emit(event: "online", listener: (worker: Worker) => void): boolean; + emit(event: "setup", listener: (settings: any) => void): boolean; + on(event: string, listener: Function): this; on(event: "disconnect", listener: (worker: Worker) => void): this; on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; @@ -932,6 +949,15 @@ declare module "cluster" { export function addListener(event: "online", listener: (worker: Worker) => void): Cluster; export function addListener(event: "setup", listener: (settings: any) => void): Cluster; + export function emit(event: string, listener: Function): boolean; + export function emit(event: "disconnect", listener: (worker: Worker) => void): boolean; + export function emit(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): boolean; + export function emit(event: "fork", listener: (worker: Worker) => void): boolean; + export function emit(event: "listening", listener: (worker: Worker, address: Address) => void): boolean; + export function emit(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): boolean; + export function emit(event: "online", listener: (worker: Worker) => void): boolean; + export function emit(event: "setup", listener: (settings: any) => void): boolean; + export function on(event: string, listener: Function): Cluster; export function on(event: "disconnect", listener: (worker: Worker) => void): Cluster; export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; @@ -955,7 +981,6 @@ declare module "cluster" { export function setMaxListeners(n: number): Cluster; export function getMaxListeners(): number; export function listeners(event: string): Function[]; - export function emit(event: string, ...args: any[]): boolean; export function listenerCount(type: string): number; export function prependListener(event: string, listener: Function): Cluster; From 1dc78748609a0d41e1dd2cbef975f2b2dbfba7d9 Mon Sep 17 00:00:00 2001 From: Andrea Zucchini Date: Sun, 25 Sep 2016 11:46:06 +0200 Subject: [PATCH 25/31] To use the definition inline --- method-override/method-override.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/method-override/method-override.d.ts b/method-override/method-override.d.ts index 73e2956cd2..e201c5434a 100644 --- a/method-override/method-override.d.ts +++ b/method-override/method-override.d.ts @@ -21,9 +21,8 @@ declare module "method-override" { } - type stringType = string; - type functionType = (req: express.Request, res: express.Response) => string; - function e(getter?: stringType | functionType, options?: e.MethodOverrideOptions): express.RequestHandler; + function e(getter?: string | ((req: express.Request, res: express.Response) => string), options?: e.MethodOverrideOptions): express.RequestHandler; + export = e; } From b6dd4429d8e87574882fa3c9cf205943d4627336 Mon Sep 17 00:00:00 2001 From: Vikash Kumar Date: Sun, 25 Sep 2016 18:07:43 +0530 Subject: [PATCH 26/31] [logat.d.ts] Type definition for node module 'logat' (#11485) * Create logat.d.ts * Create logat-tests.ts * Update logat-tests.ts * Update logat-tests.ts * Update logat.d.ts * updated logat test * updated type definiton --- logat/logat-tests.ts | 19 +++++++++++++++++++ logat/logat.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 logat/logat-tests.ts create mode 100644 logat/logat.d.ts diff --git a/logat/logat-tests.ts b/logat/logat-tests.ts new file mode 100644 index 0000000000..58a7333342 --- /dev/null +++ b/logat/logat-tests.ts @@ -0,0 +1,19 @@ +/// + +import logat = require('logat'); + +logat.on('LogConfigError', function(err: any){ +}) + +logat.error('This is error'); +logat.error( new Error('This is error instance') ); +logat.error( String('object1'), String('object2') ); +logat.warn('This is warn'); +logat.info('This is info'); +logat.debug('This is debug'); + +logat.setOptions( { + logLevel: 4, + logMethod: 1 +}); +logat.getOptions(); diff --git a/logat/logat.d.ts b/logat/logat.d.ts new file mode 100644 index 0000000000..f36adb3dfb --- /dev/null +++ b/logat/logat.d.ts @@ -0,0 +1,26 @@ +// Type definitions for logat 1.x.x +// Project: https://github.com/krvikash35/logat +// Definitions by: Vikash +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'logat'{ + + interface LogOptionsI { + logLevel?: number, + logMethod?: number, + logFileName?: string + } + + class Logger extends NodeJS.EventEmitter { + error(...args: any[]): void; + warn(...args: any[]): void; + info(...args: any[]): void; + debug(...args: any[]): void; + getOptions(): LogOptionsI; + setOptions(options: LogOptionsI): void; + } + + export = new Logger(); +} From 1d3de94f5077de90ec0d0a765c3887bab07399bd Mon Sep 17 00:00:00 2001 From: Kombu Date: Tue, 20 Sep 2016 10:23:29 +0800 Subject: [PATCH 27/31] [dateformat.d.ts] Add definitions for dateformat --- dateformat/dateformat-tests.ts | 58 +++++++++++++++++++++++++ dateformat/dateformat.d.ts | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 dateformat/dateformat-tests.ts create mode 100644 dateformat/dateformat.d.ts diff --git a/dateformat/dateformat-tests.ts b/dateformat/dateformat-tests.ts new file mode 100644 index 0000000000..95d642b922 --- /dev/null +++ b/dateformat/dateformat-tests.ts @@ -0,0 +1,58 @@ +/// + +/** + * https://github.com/felixge/node-dateformat#usage + */ + +import * as dateFormat from 'dateformat' +const now = new Date() + +// Basic usage +dateFormat(now, 'dddd, mmmm dS, yyyy, h:MM:ss TT') +// Saturday, June 9th, 2007, 5:46:21 PM + +// You can use one of several named masks +dateFormat(now, 'isoDateTime') +// 2007-06-09T17:46:21 + +// ...Or add your own +dateFormat.masks['hammerTime'] = `HH:MM! "Can't touch this!"` +dateFormat(now, 'hammerTime') +// 17:46! Can't touch this! + +// When using the standalone dateFormat function, +// you can also provide the date as a string +dateFormat('Jun 9 2007', 'fullDate') +// Saturday, June 9, 2007 + +// Note that if you don't include the mask argument, +// dateFormat.masks.default is used +dateFormat(now) +// Sat Jun 09 2007 17:46:21 + +// And if you don't include the date argument, +// the current date and time is used +dateFormat() +// Sat Jun 09 2007 17:46:22 + +// You can also skip the date argument (as long as your mask doesn't +// contain any numbers), in which case the current date/time is used +dateFormat('longTime') +// 5:46:22 PM EST + +// And finally, you can convert local time to UTC time. Simply pass in +// true as an additional argument (no argument skipping allowed in this case): +dateFormat(now, 'longTime', true) +// 10:46:21 PM UTC + +// ...Or add the prefix 'UTC:' or 'GMT:' to your mask. +dateFormat(now, 'UTC:h:MM:ss TT Z') +// 10:46:21 PM UTC + +// You can also get the ISO 8601 week of the year: +dateFormat(now, 'W') +// 42 + +// and also get the ISO 8601 numeric representation of the day of the week: +dateFormat(now, 'N') +// 6 diff --git a/dateformat/dateformat.d.ts b/dateformat/dateformat.d.ts new file mode 100644 index 0000000000..9a97ba620f --- /dev/null +++ b/dateformat/dateformat.d.ts @@ -0,0 +1,77 @@ +// Type definitions for dateformat v1.0.12 +// Project: https://github.com/felixge/node-dateformat +// Definitions by: Kombu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * dateFormat.masks + * + * Predefined Formats + * + * https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L107 + */ +interface DateFormatMasks { + default: string; + shortDate: string; + mediumDate: string; + longDate: string; + fullDate: string; + shortTime: string; + mediumTime: string; + longTime: string; + isoDate: string; + isoTime: string; + isoDateTime: string; + isoUtcDateTime: string; + expiresHeaderFormat: string; + [key: string]: string; +} + +/** + * dateFormat.i18n + * + * Internationalization strings + * + * Example: + * + * ``` + * dateFormat.i18n = { + * dayNames: [ + * 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', + * 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' + * ], + * monthNames: [ + * 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', + * 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' + * ] + * } + * ``` + * + * https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L124 + */ +interface DateFormatI18n { + dayNames: string[]; + monthNames: string[]; +} + +/** + * dateFormat() + * + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + * + * https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L18 + */ +interface DateFormatStatic { + (date?: Date | string | number, mask?: string, utc?: boolean, gmt?: boolean): string; + (mask?: string, utc?: boolean, gmt?: boolean): string; + masks: DateFormatMasks; + i18n: DateFormatI18n; +} + +declare module 'dateformat' { + const dateFormat: DateFormatStatic; + export = dateFormat; +} From df45fdf0af7a829a74e86e04f94413c6cadebac1 Mon Sep 17 00:00:00 2001 From: mudkip Date: Sun, 25 Sep 2016 22:43:40 +0800 Subject: [PATCH 28/31] Remove the ES6 module hack --- bit-array/bit-array-tests.ts | 2 +- bit-array/bit-array-tests.ts.tscparams | 1 + bit-array/bit-array.d.ts | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 bit-array/bit-array-tests.ts.tscparams diff --git a/bit-array/bit-array-tests.ts b/bit-array/bit-array-tests.ts index 9337c2afa9..20310b2208 100644 --- a/bit-array/bit-array-tests.ts +++ b/bit-array/bit-array-tests.ts @@ -1,6 +1,6 @@ /// -import * as BitArray from "bit-array"; +import BitArray = require("bit-array"); const a = new BitArray(32); a.set(0, true); diff --git a/bit-array/bit-array-tests.ts.tscparams b/bit-array/bit-array-tests.ts.tscparams new file mode 100644 index 0000000000..85542607d1 --- /dev/null +++ b/bit-array/bit-array-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs diff --git a/bit-array/bit-array.d.ts b/bit-array/bit-array.d.ts index e9ee31339e..bab3d98a46 100644 --- a/bit-array/bit-array.d.ts +++ b/bit-array/bit-array.d.ts @@ -101,6 +101,5 @@ declare module "bit-array" { xor(x: BitArray): BitArray; } - namespace BitArray {} export = BitArray; } \ No newline at end of file From 3ab295950ca3106cb1bf90d13fd1c7a1e9c5e6fa Mon Sep 17 00:00:00 2001 From: David Wood Date: Sun, 25 Sep 2016 16:21:10 +0100 Subject: [PATCH 29/31] Yayson definitions (#11484) * Add yayson Store typings * Add yayson Store tests * Improve yayson coverage * Specify version in yayson definition * Remove yayson generics and tidy --- yayson/yayson-tests.ts | 116 +++++++++++++++++++++++++++++++++++++++++ yayson/yayson.d.ts | 64 +++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 yayson/yayson-tests.ts create mode 100644 yayson/yayson.d.ts diff --git a/yayson/yayson-tests.ts b/yayson/yayson-tests.ts new file mode 100644 index 0000000000..7ae86c541f --- /dev/null +++ b/yayson/yayson-tests.ts @@ -0,0 +1,116 @@ +/// + +import * as Yayson from "yayson"; + +const yayson = Yayson({ adapter: 'default' }) || Yayson({ adapter: 'sequelize' }) || Yayson(); +const Adapter = yayson.Adapter; +const Store = yayson.Store; +const Presenter = yayson.Presenter; + +interface Thing { + hello: 'world' | 'you'; +} + +function test_store() { + const store = new Store(); + + store.sync('some string').toString(); + store.sync(1234).toString(); + store.sync({ any: 'thing' }).toString(); + + store.find('mytype', '1234').toString(); + <[]> store.findAll('mytype'); + + store.remove('mytype', '1234'); + store.remove('mytype'); + + store.reset(); + + store.records; + store.records[0].attributes.toString(); + store.records[0].id.toString(); + store.records[0].relationships.toString(); + store.records[0].type; + + store.relations['something']; +} + +function test_presenter_static() { + Presenter.render('something').toString(); + Presenter.render({}).toString(); + Presenter.render({}, { meta: {} }).toString(); + + <[]> Presenter.render([]); + <[]> Presenter.render([], { meta: {} }); + + const promiseNum: PromiseLike = null; + + Presenter.render(promiseNum).then(data => data.toExponential()); + Presenter.render(promiseNum, { meta: { so: 'meta' } }).then(data => data.toExponential()); + + Presenter.toJSON({ any: 'thing' }).toString(); + Presenter.toJSON({ other: 'thing' }, { meta: { so: 'meta' } }).toString(); +} + +function test_presenter_instance() { + const presenter = new Presenter(); + + presenter.render({}).toString(); + presenter.render({}, { meta: {} }).toString(); + + <[]> presenter.render([]); + <[]> presenter.render([], { meta: {} }); + + const promiseNum: PromiseLike = null; + + presenter.render(promiseNum).then(data => data.toExponential()); + presenter.render(promiseNum, { meta: { so: 'meta' } }).then(data => data.toExponential()); + + presenter.toJSON({ any: 'thing' }).toString(); + presenter.toJSON({ other: 'thing' }, { meta: { so: 'meta' } }).toString(); +} + +function test_presenter_inheritance() { + class MotorPresenter extends Presenter { + type = 'motors'; + relationships() { + return { car: CarPresenter } + }; + selfLinks(instance: any) { + return '/cars/' + this.id(instance); + }; + } + + class CarPresenter extends Presenter { + type = 'cars' + relationships() { + return { motor: MotorPresenter } + }; + } + + const motor: { id: any; car: any } = { + id: 2, + car: null + } + + const car = { + id: 1, + motor: motor + } + + motor.car = car; + + CarPresenter.toJSON(car).toString(); + CarPresenter.toJSON(car, { meta: { so: 'meta' } }).toString(); + + CarPresenter.render({ id: 3 }).toString(); + CarPresenter.render({ id: 3 }, { meta: { so: 'meta' } }).toString(); + CarPresenter.render({ id: 3 }, { car: { id: 3 } }).toString(); +} + +function test_adapter() { + Adapter.get({ name: 'Abraham' }).toString(); + Adapter.get({ name: 'Abraham' }, 'name').toString(); + + Adapter.id({ id: 5 }); +} diff --git a/yayson/yayson.d.ts b/yayson/yayson.d.ts new file mode 100644 index 0000000000..1ee0eda777 --- /dev/null +++ b/yayson/yayson.d.ts @@ -0,0 +1,64 @@ +// Type definitions for yayson v2.0.1 +// Project: https://github.com/confetti/yayson +// Definitions by: David Wood +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'yayson' { + class Store { + sync(obj: {}): any; + find(type: string, id: string): any; + findAll(type: string): any[]; + remove(type: string, id?: string): void; + reset(): void; + + records: y.Record[]; + relations: { [key: string]: any }; + } + + interface Adapter { + get(model: {}, key?: string): any; + id(model: {}): string; + } + + class Presenter { + static adapter: string; + + static render(instanceOrCollection: PromiseLike, options?: y.JsonOptions): PromiseLike; + static render(instanceOrCollection: {}, options?: y.JsonOptions): any; + static toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any; + + render(instanceOrCollection: PromiseLike, options?: y.JsonOptions): PromiseLike; + render(instanceOrCollection: {}, options?: y.JsonOptions): any; + toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any; + id(instance: {}): string; + + type: string; + } + + interface Yayson { + Store: typeof Store; + Presenter: typeof Presenter; + Adapter: Adapter; + } + + interface YaysonOptions { + adapter?: 'default' | 'sequelize'; + } + + function y(arg?: YaysonOptions): Yayson; + + namespace y { + interface JsonOptions { + [key: string]: any; + meta?: {}; + } + interface Record { + id: any; + type: string; + attributes: any; + relationships: any; + } + } + + export = y; +} From 8ca204242d6b56ec6c79ef663f7c0eaf14ac483e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niko=20Kova=C4=8Di=C4=8D?= Date: Sun, 25 Sep 2016 19:57:26 +0200 Subject: [PATCH 30/31] Changed namespace from angularTouchspin to angular.touchspin (#11414) --- angular-touchspin/angular-touchspin-tests.ts | 6 +++--- angular-touchspin/angular-touchspin.d.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/angular-touchspin/angular-touchspin-tests.ts b/angular-touchspin/angular-touchspin-tests.ts index c6e229c7f5..c69c6b3140 100644 --- a/angular-touchspin/angular-touchspin-tests.ts +++ b/angular-touchspin/angular-touchspin-tests.ts @@ -2,9 +2,9 @@ /// angular - .module('touchspin-tests', ['lm.touchspin']) - .config(function(touchspinConfigProvider: angularTouchSpin.ITouchSpinConfigProvider) { - touchspinConfigProvider.defaults({ + .module('touchspin-tests', ['nk.touchspin']) + .config(function(touchspinConfigProvider: angular.touchspin.ITouchSpinConfigProvider) { + touchspinConfigProvider.defaults({ min: 0, max: 0, step: 0, diff --git a/angular-touchspin/angular-touchspin.d.ts b/angular-touchspin/angular-touchspin.d.ts index 5423b17e55..adae8cc92c 100644 --- a/angular-touchspin/angular-touchspin.d.ts +++ b/angular-touchspin/angular-touchspin.d.ts @@ -11,7 +11,7 @@ declare module "angular-touchspin" { export = _; } -declare namespace angularTouchSpin { +declare namespace angular.touchspin { interface ITouchSpinOptions { min?: number; max?: number; From a1769ac42af931b508ae94b7a833a2654594e815 Mon Sep 17 00:00:00 2001 From: Kombu Date: Mon, 26 Sep 2016 02:01:26 +0800 Subject: [PATCH 31/31] [perfect-scrollbar.d.ts] Add definitions for perfect-scrollbar (#11486) --- perfect-scrollbar/perfect-scrollbar-tests.ts | 42 ++++++ perfect-scrollbar/perfect-scrollbar.d.ts | 134 +++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 perfect-scrollbar/perfect-scrollbar-tests.ts create mode 100644 perfect-scrollbar/perfect-scrollbar.d.ts diff --git a/perfect-scrollbar/perfect-scrollbar-tests.ts b/perfect-scrollbar/perfect-scrollbar-tests.ts new file mode 100644 index 0000000000..2036d19f0f --- /dev/null +++ b/perfect-scrollbar/perfect-scrollbar-tests.ts @@ -0,0 +1,42 @@ +/// +/// + +/** + * https://github.com/noraesae/perfect-scrollbar#how-to-use + */ + +import * as Ps from 'perfect-scrollbar' +const container = document.body + +// To initialise the plugin, `Ps.initialize` is used. +Ps.initialize(container) + +// It can be initialised with optional parameters. +Ps.initialize(container, { + wheelSpeed: 2, + wheelPropagation: true, + minScrollbarLength: 20 +}) + +// If the size of your container or content changes, call `update`. +Ps.update(container) + +// If you want to destroy the scrollbar, use `destroy`. +Ps.destroy(container) + +// If you want to scroll to somewhere, just use a `scrollTop` property and update. +container.scrollTop = 0 +Ps.update(container) + +/** + * https://github.com/noraesae/perfect-scrollbar#jquery + */ + +import * as $ from 'jquery' +import mountJQuery = require('perfect-scrollbar/jquery') +mountJQuery($) + +$('#container').perfectScrollbar() // Initialize +$('#container').perfectScrollbar({ /*...*/ }) // with options +$('#container').perfectScrollbar('update') // Update +$('#container').perfectScrollbar('destroy') // Destroy diff --git a/perfect-scrollbar/perfect-scrollbar.d.ts b/perfect-scrollbar/perfect-scrollbar.d.ts new file mode 100644 index 0000000000..85155ea3cd --- /dev/null +++ b/perfect-scrollbar/perfect-scrollbar.d.ts @@ -0,0 +1,134 @@ +// Type definitions for perfect-scrollbar v0.6.12 +// Project: https://github.com/noraesae/perfect-scrollbar +// Definitions by: Kombu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/default-setting.js#L3 + * https://github.com/noraesae/perfect-scrollbar#optional-parameters + */ +interface PerfectScrollbarSettings { + + /** + * It is a list of handlers to use to scroll the element. + * https://github.com/noraesae/perfect-scrollbar#handlers + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/initialize.js#L9 + */ + handlers?: ('click-rail' | + 'drag-scrollbar' | + 'keyboard' | + 'wheel' | + 'touch' | + 'selection')[]; + + /** + * When set to an integer value, the thumb part of the scrollbar will not expand over that number of pixels. + * https://github.com/noraesae/perfect-scrollbar#maxscrollbarlength + */ + maxScrollbarLength?: number; + + /** + * When set to an integer value, the thumb part of the scrollbar will not shrink below that number of pixels. + * https://github.com/noraesae/perfect-scrollbar#minscrollbarlength + */ + minScrollbarLength?: number; + + /** + * The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. + * Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels. + * https://github.com/noraesae/perfect-scrollbar#scrollxmarginoffset + */ + scrollXMarginOffset?: number; + + /** + * The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. + * Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels. + * https://github.com/noraesae/perfect-scrollbar#scrollymarginoffset + */ + scrollYMarginOffset?: number; + + /** + * When set to false, when clicking on a rail, the click event will be allowed to propagate. + * https://github.com/noraesae/perfect-scrollbar#stoppropagationonclick + */ + stopPropagationOnClick?: boolean; + + /** + * When set to true, the scroll bar in X axis will not be available, regardless of the content width. + * https://github.com/noraesae/perfect-scrollbar#suppressscrollx + */ + suppressScrollX?: boolean; + + /** + * When set to true, the scroll bar in Y axis will not be available, regardless of the content height. + * https://github.com/noraesae/perfect-scrollbar#suppressscrolly + */ + suppressScrollY?: boolean; + + /** + * If this option is true, when the scroll reaches the end of the side, touch scrolling will be propagated to parent element. + * https://github.com/noraesae/perfect-scrollbar#swipepropagation + */ + swipePropagation?: boolean; + + /** + * When set to true, and only one (vertical or horizontal) scrollbar is visible then both vertical and horizontal scrolling will affect the scrollbar. + * https://github.com/noraesae/perfect-scrollbar#usebothwheelaxes + */ + useBothWheelAxes?: boolean; + + /** + * If this option is true, when the scroll reaches the end of the side, mousewheel event will be propagated to parent element. + * https://github.com/noraesae/perfect-scrollbar#wheelpropagation + */ + wheelPropagation?: boolean; + + /** + * The scroll speed applied to mousewheel event. + * https://github.com/noraesae/perfect-scrollbar#wheelspeed + */ + wheelSpeed?: number; + + /** + * A string. + * It's a class name added to the container element. + * The class name is prepended with `ps-theme-`. + * So default theme class name is `ps-theme-default`. + * In order to create custom themes with scss use `ps-container($theme)` mixin, where `$theme` is a scss map. + * https://github.com/noraesae/perfect-scrollbar#theme + */ + theme?: string; +} + +declare module 'perfect-scrollbar' { + + /** + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/initialize.js#L19 + */ + export function initialize(element: HTMLElement, settings?: PerfectScrollbarSettings): void; + + /** + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/update.js#L9 + */ + export function update(element: HTMLElement): void; + + /** + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/plugin/destroy.js#L7 + */ + export function destroy(element: HTMLElement): void; +} + +interface JQuery { + + /** + * https://github.com/noraesae/perfect-scrollbar/blob/master/src/js/adaptor/jquery.js#L6 + */ + perfectScrollbar(settingOrCommand?: PerfectScrollbarSettings | 'update' | 'destroy'): JQuery; +} + +declare module 'perfect-scrollbar/jquery' { + function mountJQuery(jQuery: JQueryStatic): void; + export = mountJQuery; +}