aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tensorflow/tensorboard/lib/js/colorScale/colorScale.ts7
-rw-r--r--tensorflow/tensorboard/lib/js/colorScale/palettes.ts66
-rw-r--r--tensorflow/tensorboard/lib/js/colorScale/test/colorScaleTests.ts17
-rw-r--r--tensorflow/tensorboard/tslint.json1
4 files changed, 42 insertions, 49 deletions
diff --git a/tensorflow/tensorboard/lib/js/colorScale/colorScale.ts b/tensorflow/tensorboard/lib/js/colorScale/colorScale.ts
index f57551dbe0..3899bb7778 100644
--- a/tensorflow/tensorboard/lib/js/colorScale/colorScale.ts
+++ b/tensorflow/tensorboard/lib/js/colorScale/colorScale.ts
@@ -66,7 +66,7 @@ module TF {
this.domain([]);
if (palette.length < 2) {
- throw new Error("Not enough colors in palette. Must be more than one.")
+ throw new Error("Not enough colors in palette. Must be more than one.");
}
var k = (this.numColors - 1) / (palette.length - 1);
@@ -83,14 +83,13 @@ module TF {
return Math.abs(Array.prototype.reduce.call(s, h, 0)) % this.numColors;
}
-
/**
* Set the domain of strings so we can calculate collisions preemptively.
* Can be reset at any point.
*
* @param {string[]} strings - An array of strings to use as the domain
* for your scale.
- */
+ */
public domain(strings: string[]) {
this.buckets = d3.range(this.numColors).map(() => []);
var sortedUniqueKeys = d3.set(strings).values().sort(function(a, b) { return a.localeCompare(b); });
@@ -132,7 +131,7 @@ module TF {
* @param {string} The input string to map to a color.
* @return {string} The color corresponding to that input string.
* @throws Will error if input string is not in the scale's domain.
- */
+ */
public getColor(s: string): string {
var bucket = this.getBucketForString(s);
diff --git a/tensorflow/tensorboard/lib/js/colorScale/palettes.ts b/tensorflow/tensorboard/lib/js/colorScale/palettes.ts
index 76d69779a3..0c63c1de74 100644
--- a/tensorflow/tensorboard/lib/js/colorScale/palettes.ts
+++ b/tensorflow/tensorboard/lib/js/colorScale/palettes.ts
@@ -1,44 +1,44 @@
module TF {
export const palettes = {
googleStandard: [
- "#db4437", //google red 500
- "#ff7043", //deep orange 400
- "#f4b400", //google yellow 500
- "#0f9d58", //google green 500
- "#00796b", //teal 700
- "#00acc1", //cyan 600
- "#4285f4", //google blue 500
- "#5c6bc0", //indigo 400
- "#ab47bc" //purple 400
+ "#db4437", // google red 500
+ "#ff7043", // deep orange 400
+ "#f4b400", // google yellow 500
+ "#0f9d58", // google green 500
+ "#00796b", // teal 700
+ "#00acc1", // cyan 600
+ "#4285f4", // google blue 500
+ "#5c6bc0", // indigo 400
+ "#ab47bc" // purple 400
],
googleCool: [
- "#9e9d24", //lime 800
- "#0f9d58", //google green 500
- "#00796b", //teal 700
- "#00acc1", //cyan 600
- "#4285f4", //google blue 500
- "#5c6bc0", //indigo 400
- "#607d8b" //blue gray 500
+ "#9e9d24", // lime 800
+ "#0f9d58", // google green 500
+ "#00796b", // teal 700
+ "#00acc1", // cyan 600
+ "#4285f4", // google blue 500
+ "#5c6bc0", // indigo 400
+ "#607d8b" // blue gray 500
],
googleWarm: [
- "#795548", //brown 500
- "#ab47bc", //purple 400
- "#f06292", //pink 300
- "#c2185b", //pink 700
- "#db4437", //google red 500
- "#ff7043", //deep orange 400
- "#f4b400" //google yellow 700
+ "#795548", // brown 500
+ "#ab47bc", // purple 400
+ "#f06292", // pink 300
+ "#c2185b", // pink 700
+ "#db4437", // google red 500
+ "#ff7043", // deep orange 400
+ "#f4b400" // google yellow 700
],
googleColorBlind: [
- "#c53929", //google red 700
- "#ff7043", //deep orange 400
- "#f7cb4d", //google yellow 300
- "#0b8043", //google green 700
- "#80deea", //cyan 200
- "#4285f4", //google blue 500
- "#5e35b1" //deep purple 600
+ "#c53929", // google red 700
+ "#ff7043", // deep orange 400
+ "#f7cb4d", // google yellow 300
+ "#0b8043", // google green 700
+ "#80deea", // cyan 200
+ "#4285f4", // google blue 500
+ "#5e35b1" // deep purple 600
],
- //This rainbow palette attempts to keep a constant brightness across hues.
+ // This rainbow palette attempts to keep a constant brightness across hues.
constantValue: [
"#f44336",
"#ffa216",
@@ -48,7 +48,5 @@ module TF {
"#505ec4",
"#a633ba"
]
- }
+ };
}
-
-
diff --git a/tensorflow/tensorboard/lib/js/colorScale/test/colorScaleTests.ts b/tensorflow/tensorboard/lib/js/colorScale/test/colorScaleTests.ts
index b3709fd520..1a8c06fcba 100644
--- a/tensorflow/tensorboard/lib/js/colorScale/test/colorScaleTests.ts
+++ b/tensorflow/tensorboard/lib/js/colorScale/test/colorScaleTests.ts
@@ -34,7 +34,7 @@ module TF {
});
it("Returns consistent colors, given no hash collisions", function() {
- //These three colors don't have hash collisions
+ // These three colors don't have hash collisions
ccs.domain(["red", "yellow"]);
var firstRedColor = ccs.getColor("red");
ccs.domain(["red", "yellow", "blue"]);
@@ -48,13 +48,13 @@ module TF {
twoColorScale.domain(["red", "blue"]);
assert.deepEqual(twoColorScale.getColor("blue"), TF.palettes.googleStandard[0]);
assert.deepEqual(twoColorScale.getColor("red"), TF.palettes.googleStandard[TF.palettes.googleStandard.length - 1]);
- })
+ });
- //This is testing that when we reset the domain with new colors, the old
- //domain doesn't influence the new color choices. Basically testing that we
- //get a fresh slate if we have a new domain. Basically testing that all the
- //internal bins are reset etc. and we aren't finding collisions with
- //previous colors.
+ // This is testing that when we reset the domain with new colors, the old
+ // domain doesn't influence the new color choices. Basically testing that we
+ // get a fresh slate if we have a new domain. Basically testing that all the
+ // internal bins are reset etc. and we aren't finding collisions with
+ // previous colors.
it("Colors don't nudge away from colors from an old domain.", function() {
// at 12 breaks, "orange" and "blue" collide.
ccs.domain(["red", "blue"]);
@@ -92,8 +92,5 @@ module TF {
ccs.getColor("not in domain");
}, "String was not in the domain.");
});
-
-
});
-
}
diff --git a/tensorflow/tensorboard/tslint.json b/tensorflow/tensorboard/tslint.json
index bd1efdbd6f..91072d420c 100644
--- a/tensorflow/tensorboard/tslint.json
+++ b/tensorflow/tensorboard/tslint.json
@@ -11,7 +11,6 @@
"max-line-length": [true, 140],
"member-ordering": [false, "variables-before-functions"],
"no-arg": true,
- "no-bitwise": true,
"no-consecutive-blank-lines": true,
"no-console": [true,
"log",