Description Usage Arguments Value Examples
This function allows to create, append data to be passed to the https://github.com/npellet/visualizer. Prior to this, the list have to be parsed and stored as a json file. This file can be either stored locally or stored on https://gist.github.com.
1 | appendData(data, variable, variableName, type)
|
data |
data, if it exists |
variable |
new dataset |
variableName |
name of the dataset. The name of the data must be exposed to the https://github.com/npellet/visualizer using the exposeData.R function. |
type |
type of the data. The types currently supported are
|
a list object with the data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | x <- seq(from = 0, to = pi, by = 0.1)
#simple array
d <- appendData(variableName = "simpleArray", variable = cos(x), type = "1D Y array")
d <- appendData(data = d, variableName = "simpleArray2", variable = sin(x), type = "1D Y array")
#XY array
xy = data.frame( x = x, y = sin(x) )
d <- appendData(data = d, variableName = "simpleArray3", variable = xy, type = "1D XY array")
#chart
chart <- data.frame("x" = x,
"y" = cos(3*x),
"highlight" = seq_along(x) - 1,
"info"= paste0("ID: ", 0:31)
)
d <- appendData(data = d, variableName = "chart", variable = chart, type = "chart")
opts = list(
"trackMouseLabelRouding" = 1,
"trackMouse" = "false",
"lineToZero" = "false",
"trackMouseLabel" = "false",
"lineColor" = "red",
"autoPeakPickingNb" = 4,
"markers" = list(
"fillColor" = "transparent",
"zoom" = 1,
"show" = "false",
"type" = 1,
"strokeColor" = "false",
"strokeWidth" = 1
),
"lineStyle" = 1,
"autoPeakPickingMinDistance" = 10,
"label" = "",
"autoPeakPicking" = "false",
"flip" = "false"
)
chart1 <- data.frame("x" = x,
"y" = cos(3*x),
"highlight" = seq_along(x) - 1,
"info"= paste0("cosID: ", 0:31)
)
chart2 <- data.frame("x" = x,
"y" = sin(3*x),
"highlight" = seq_along(x) - 1,
"info"= paste0("sinID: ", 0:31)
)
chart = list( list(chart=chart1, options=opts), list(chart=chart2, options=opts))
d <- appendData( data = d, variableName = "multiChart", variable = chart, type = "multiChart")
#saveJSON(d, "~/", "data.json")
v <- new('visualization')
push(v, 'data', d)
#visualize(v)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.