X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=experimental%2Fpalette%2Fpalette.js;h=514463f554c45d374cb8ec6497c0b672c9133a12;hb=77a1405a7dea7e9de770583598a50e5907e6b1a1;hp=f24254550455335c8ba8af2b20581641bed6fbf5;hpb=205900008a083c27e85995aec2b90e81e6d51c9e;p=dygraphs.git diff --git a/experimental/palette/palette.js b/experimental/palette/palette.js index f242545..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 = $("