Closed PierreBrisorgueil closed 3 years ago
Hey mate, there's currently no direct way to update a value in a datasource, the library only allows you to push or set.
However, you could simulate it yourself using a set if you wanted to, like this...
let source = DSFSparkline.DataSource(values: [0,1,2,3,4,5,6,7])
// source contains [0,1,2,3,4,5,6,7]
// Do something...
// Grab out the current datasource raw data, manipulate it as you need, then set() it back
var currentData = source.data
currentData.replaceSubrange(3...3, with: [33])
source.set(values: currentData)
// source now contains [0,1,2,33,4,5,6,7]
Not the most elegant for sure, but it would do what you needed.
Hum, okok, Nice ! 👌
Thx for your time and reactivity !
hey, is it possible to update an index of the datasource in the dot graph in addition to the push? this would generate other types of filling animations ?