X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=experimental%2Fpalette%2Fpalette.js;h=514463f554c45d374cb8ec6497c0b672c9133a12;hb=c36a62c2638dd9a4ce0c91146b9bcb2557168aff;hp=7588befd4d5fd363c9a2674faf39fdf3443fbdc0;hpb=f3fe39ed031e2ff2e6d699c06ad391013e84cac3;p=dygraphs.git diff --git a/experimental/palette/palette.js b/experimental/palette/palette.js index 7588bef..514463f 100644 --- a/experimental/palette/palette.js +++ b/experimental/palette/palette.js @@ -25,90 +25,109 @@ */ "use strict"; -function Palette() { +/** + * scope is either "global", "series", "x", "y" or "y2". + */ +function Palette(scope) { + // Contains pair of "input" (the input object) and "row" (the parent row) + // Also contains functionString. this.model = {}; + // This is meant to be overridden by a palette host. this.onchange = function() {}; - this.filterBar = null; + this.scope = scope; + this.root = null; } -Palette.prototype.create = function(document, parentElement) { +Palette.prototype.create = function(parentElement) { var palette = this; - var createChild = function(type, parentElement) { - var element = document.createElement(type); - parentElement.appendChild(element); - return element; - }; - - var table = createChild("table", parentElement); - table.class = "palette"; - - var row = createChild("tr", table); - row.style.display = "block"; - - createChild("td", row).innerText = "Filter:"; - this.filterBar = createChild("input", createChild("td", row)); - this.filterBar.onkeyup = function() { - palette.filter(palette.filterBar.value) - }; - var go = document.createElement("button"); - createChild("td", row).appendChild(go); - go.innerText = "Redraw" - go.onclick = function() { - palette.onchange(); - }; - - for (var opt in opts) { + + var table = $("