X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=9f4fcb0052eedd7aeaa30e3281797c633d6174c9;hb=2996a18eb00729b2624d8d75e8d24b056c5732bc;hp=0ae3f08f24bd1ff4c800ab1e4c8efffeea60447e;hpb=78e58af463c6b5a09d85d6014bbdba0b3d8a605a;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index 0ae3f08..9f4fcb0 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -35,6 +35,13 @@ Dygraph.ERROR = 3; // https://github.com/eriwen/javascript-stacktrace Dygraph.LOG_STACK_TRACES = false; +/** A dotted line stroke pattern. */ +Dygraph.DOTTED_LINE = [2, 2]; +/** A dashed line stroke pattern. */ +Dygraph.DASHED_LINE = [7, 3]; +/** A dot dash stroke pattern. */ +Dygraph.DOT_DASH_LINE = [7, 2, 2, 2]; + /** * @private * Log an error on the JS console at the given severity. @@ -778,6 +785,29 @@ Dygraph.isPixelChangingOptionList = function(labels, attrs) { return requiresNewPoints; }; +/** + * Compares two arrays to see if they are equal. If either parameter is not an + * array it will return false. Does a shallow compare + * Dygraph.compareArrays([[1,2], [3, 4]], [[1,2], [3,4]]) === false. + * @param array1 first array + * @param array2 second array + * @return True if both parameters are arrays, and contents are equal. + */ +Dygraph.compareArrays = function(array1, array2) { + if (!Dygraph.isArrayLike(array1) || !Dygraph.isArrayLike(array2)) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; +}; + Dygraph.RegularConvex = function(sides, rotation) { this.sides = sides;