Skip to content

Using functions in channel encodings #134

Answered by jheer
marr asked this question in Q&A
Discussion options

You must be logged in to vote

Mosaic pushes computation to the database, so instead of a JS function you should be able to provide a SQL expression.

vg.dot(vg.from('stocks'), {
  x: vg.sql`(Close - Open) / Open`,
  y: 'Volume',
  r: 'Volume'
}),

Depending on the column types you may also want to include type casts where needed.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@marr
Comment options

Answer selected by marr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants