You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Presidential Opinion example has something that looks a lot like "select a column/sql-expression via this menu and it gets plotted on the chart." This is a really neat feature to have.
However, the way it is implemented (where the Parameter takes on a value of 1 or -1 and a sql expression does a multiplication with the column values) doesn't generalize well to more than two options.
It is already possible to get the "choose between many options" behavior in javascript by setting the options of the menu to the object produced by vg.sql. However, to my knowledge, this is not possible to do via a spec. In a spec, the best you can do is make the options strings, but the strings get quoted as literals, and are not interpreted as column names.
I thought of two ways this could be implemented to work with specs:
The Menu could special-case some key-namespace to interpret as sql (probably in the form of objects that look like {sql: "y_column"})
The spec parser could have some syntax for producing a vg.sql object. I went down this route at first, but it's relatively tricky to get it to work because the menu options are parsed via the completely generic parseOptions creating a LiteralNode with the list of options. So to get this feature would require special-casing in code that is fully generic right now (and the LiteralNode which right now holds an opaque list would have to be further decomposed into nodes).
The text was updated successfully, but these errors were encountered:
The Presidential Opinion example has something that looks a lot like "select a column/sql-expression via this menu and it gets plotted on the chart." This is a really neat feature to have.
However, the way it is implemented (where the Parameter takes on a value of 1 or -1 and a sql expression does a multiplication with the column values) doesn't generalize well to more than two options.
It is already possible to get the "choose between many options" behavior in javascript by setting the options of the menu to the object produced by
vg.sql
. However, to my knowledge, this is not possible to do via a spec. In a spec, the best you can do is make the options strings, but the strings get quoted as literals, and are not interpreted as column names.I thought of two ways this could be implemented to work with specs:
{sql: "y_column"}
)vg.sql
object. I went down this route at first, but it's relatively tricky to get it to work because the menu options are parsed via the completely genericparseOptions
creating aLiteralNode
with the list of options. So to get this feature would require special-casing in code that is fully generic right now (and theLiteralNode
which right now holds an opaque list would have to be further decomposed into nodes).The text was updated successfully, but these errors were encountered: