我想知道哪个是获得CanvasXpress帮助的最佳位置。我在论坛中看不到任何线索。我实际上使用CanvasXpress来显示一些动态数据,我理解canvasXpress接受它作为json对象。我的问题是我正在构建一个热图,当我分配vars:和smps:变量以及data:变量和我的javascript数组变量时,它不会创建一个合适的json对象,并且只返回一个错误或简单的页面不加载。我有如下javascript数组:var axis ='A2','A3','A20','A6','A10','A17','A7','A19','A11','A12' ,'A9','C2','C7','C29','C24'对于两个变量都是相同的:和smps:对于数据:变量我有一个javascript数组,它基本上是一个像这样的二维数组 矩阵= [0.00,0.33,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0 0.00,0.00,0.00,0.33,0.33,0.00], [0.33,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0 0.00,0.00,0,03,0.00,0.00,0.33], [0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,0.00], [0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0 0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,1.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0,0,0.00,0.00,0.00,0.00,0.00]
但是,我无法在下面的json对象中分配这些javascript变量:
var cx = new CanvasXpress('canvas1',
{y: {vars: axis,
smps: axis,
desc: ['Intensity'],
data: [matrix]}},
{graphType: 'Heatmap',
showDataValues: true,
background: 'rgb(245,245,245)',
indicatorCenter: 'rainbow',
heatmapType: 'green',
// gradient: true,
centerData: true,
indicatorWidth: 8});
你可以帮我解决这个问题,或者把我转到一个可以获得帮助的论坛。
谢谢!
答案 0 :(得分:1)
我相信你有一个方括号问题。尝试这样的事情:
remoteData = [
[10,12,153,4,100,73,42,64],
[12,4,60,5,24,14,32,13],
[7,12,20,13,49,52,42,92],
[21,10,30,8,65,2000,47,58],
[15,14,100,5,34,130,82,51],
[100,82,73,124,0,4,5,142],
[100,82,73,124,0,4,5,142]
];
newData = {
"y": {
"vars": ["Gene1","Gene2","Gene3","Gene4","Gene5","Gene6","Gene7"],
"smps": ["Smp1","Smp2","Smp3","Smp4","Smp5","Smp6","Smp7","Smp8"],
"desc": ["Intensity"],
"data": remoteData
}
};