I have an array with 1000 elements that I’m trying to graph in Perspective. Is there a way to do this without making 1000 bindings? I think I need to build an Expression Structure of some kind can’t quite figure it out.
You should able to do this with the XY chart. Add a key to datasources
, add an expression binding to the array tag, and add a script transform like this:
return [
{
"row": index,
"value": value
}
for index, value in enumerate(value)
]
Then just configure the ‘X’ axis as row
and the ‘Y’ axis as value
.
1 Like
Fantastic! thank you!
If I wanted to parse out just every x rows, would I use something like something like “if (value % x == 0)”?
Yes, you can add that to the list comprehension, e.g.
return [
{
"row": index,
"value": value
}
for index, value in enumerate(value)
if index % 3 == 0
]
1 Like
Thank you.