Closed korunekosama closed 3 years ago
There's 2 ways to do it :
[
{
"type": "scatter",
"mode": "markers",
"line": {
"color": "red",
"width": 2
}
},
{
"type": "scatter",
"mode": "lines",
"line": {
"color": "blue",
"width": 2
}
},
]
let x1 = data.series[0].fields[1].values.buffer
let y1 = data.series[1].fields[1].values.buffer
let serie1 = {
x : x1,
y : y1,
name : 'M1',
mode : 'markers',
line : {
color : 'red'
}
}
let x2 = data.series[2].fields[1].values.buffer let y2 = data.series[3].fields[1].values.buffer let serie2 = { x : x2, y : y2, name : 'M2', mode : 'lines', line : { color : 'blue' } }
Hope it helps
Thank you very much, that's exactly what I need !
Hello, Sorry i f my question seems trivial to you.
I am trying to display several series simultaneously on a scatter graph with the same template. I manage to display the series but the template specified in data (type: scatter; mode: markers) only applies to the first one. The other series are displayed in line mode which seems to be the default mode.
The 'Data' bloc containing the following code : [ { "type": "scatter", "mode": "markers", "line": { "color": "red", "width": 2 } } ]
The script bloc containing the following code : console.log(data)
let x1 = data.series[0].fields[1].values.buffer let y1 = data.series[1].fields[1].values.buffer let serie1 = { x : x1, y : y1, name : 'M1' }
let x2 = data.series[2].fields[1].values.buffer let y2 = data.series[3].fields[1].values.buffer let serie2 = { x : x2, y : y2, name : 'M2' }
return { data:[serie1,serie2], layout:{title:'My Chart'} };
I also try to display the different series in a different color; in order to distinguish them. I imagine this should be done in the script block; but the 'data' output does not seem to allow the passing of certain parameters found in the dedicated 'data' block.
Any help would be appreciate.
Thanks !