From 53c494183eb298d1a19fdd4a978fbd24463ef164 Mon Sep 17 00:00:00 2001 From: Vlad-Shcherbina Date: Wed, 8 Jan 2020 22:05:52 +0300 Subject: [PATCH] dygraphs: add missing getRowForX() definition (#41335) * dygraphs: add missing getRowForX() definition Documentation: http://dygraphs.com/jsdoc/symbols/Dygraph.html#getRowForX Source code: https://github.com/danvk/dygraphs/blob/27cee3f7233fbbbeed31f0cf03ea81bf92555b18/src/dygraph.js#L3345-L3372 * dygraphs: Drop type annotations from .d.ts's JSDoc danvk: "At best they are duplicative and at worst they disagree (as in this case)." --- types/dygraphs/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/dygraphs/index.d.ts b/types/dygraphs/index.d.ts index e1bcf1e633..3e2c02d9df 100644 --- a/types/dygraphs/index.d.ts +++ b/types/dygraphs/index.d.ts @@ -1284,6 +1284,16 @@ declare class Dygraph { */ indexFromSetName(name: string): number; + /** + * Find the row number corresponding to the given x-value. + * Returns null if there is no such x-value in the data. + * If there are multiple rows with the same x-value, this will return the + * first one. + * @param xVal The x-value to look for (e.g. millis since epoch). + * @return The row number, which you can pass to getValue(), or null. + */ + getRowForX(xVal: number): number | null; + /** * 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