-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransferDensityPlotForReact.R
More file actions
47 lines (39 loc) · 1.04 KB
/
TransferDensityPlotForReact.R
File metadata and controls
47 lines (39 loc) · 1.04 KB
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
#load("./BMIQ_Result.rda")
getPoints <- function(i)
{
tmp <- density(myNorm[,i])
#points <- list()
#for(i in 1:length(tmp$x))
#{
# points[[i]] <- list(x=tmp$x[i],y=tmp$y[i])
#}
oneSample <- list(label=colnames(myNorm)[i],
fill=FALSE,
backgroundColor='rgba(75,192,192,0.4)',
borderColor='rgba(75,192,192,1)',
borderCapStyle='butt',
borderDashOffset=0.0,
borderJoinStyle='miter',
pointBorderColor='rgba(75,192,192,1)',
pointBackgroundColor='#fff',
pointBorderWidth=1,
pointHoverRadius=1,
pointHoverBackgroundColor='rgba(75,192,192,1)',
pointHoverBorderColor='rgba(220,220,220,1)',
pointHoverBorderWidth=2,
pointRadius=1,
pointHitRadius=2,
data=tmp$y[seq(1,512,by=8)]
)
}
datasets <- list()
for(i in 1:ncol(myNorm))
{
datasets[[i]] <- getPoints(i)
}
#apply(myNorm,2,function(x) getPoints(x))
library(jsonlite)
#toJSON(points,auto_unbox = FALSE)
sink("myjson.json")
toJSON(datasets,auto_unbox=TRUE)
sink()