<link rel="import" href="../polymer/polymer.html">

<!--
tf-color-scale is a plumbing component that takes in an array of runs, and produces
an upward-bindable outColorScale, which is a color scale mapping from those runs to
a set of colors.
-->
<dom-module id="tf-color-scale">
  <script src="palettes.js"></script>
  <script src="colorScale.js"></script>
  <script>
    (function() {
      Polymer({
        is: "tf-color-scale",
        properties: {
          runs: Array,
          outColorScale: {
            type: Object,
            computed: "makeColorScale(runs.*)",
            notify: true,
          },
        },
        makeColorScale: function(runs) {
          return new TF.ColorScale().domain(this.runs);
        },
      });
    })();
  </script>
</dom-module>

<link rel="import" href="../polymer/polymer.html">

<!--
tf-color-scale is a plumbing component that takes in an array of runs, and produces
an upward-bindable outColorScale, which is a color scale mapping from those runs to
a set of colors.
-->
<dom-module id="tf-color-scale">
  <script src="palettes.js"></script>
  <script src="colorScale.js"></script>
  <script>
    (function() {
      Polymer({
        is: "tf-color-scale",
        properties: {
          runs: {
            type: Array,
          },
          outColorScale: {
            type: Object,
            readOnly: true,
            notify: true,
            value: function() {
              return new TF.ColorScale();
            },
          },
        },
        observers: ['updateColorScale(runs.*)'],
        updateColorScale: function(runsChange) {
          this.outColorScale.domain(this.runs);
        },
      });
    })();
  </script>
</dom-module>

Fix bug where color scale can break if new runs load over the lifetime of tensorboard. Change: 122541517
Fix bug where color scale can break if new runs load over the lifetime of tensorboard.
Change: 122541517
