plot: add support for stringified objects {} to allow change specific points' coordinates (issue #130)
This commit is contained in:
parent
e8a5c83b00
commit
5e8aea0022
3 changed files with 16 additions and 5 deletions
|
|
@ -171,13 +171,24 @@ module.exports = class _plots_base extends _canvas_base {
|
|||
|
||||
setValue(v, options={}) {
|
||||
|
||||
if (typeof v == 'string' && v.indexOf('[') == 0) {
|
||||
if (typeof v == 'string' && (v[0] == '[' || v[0] == '{' )) {
|
||||
v = JSON.parseFlex(v)
|
||||
}
|
||||
|
||||
if (Array.isArray(v)) {
|
||||
if (typeof v == 'object') {
|
||||
|
||||
if (Array.isArray(v)) {
|
||||
|
||||
this.data = v
|
||||
|
||||
} else {
|
||||
|
||||
for (var i in v) {
|
||||
if (!isNaN(i)) this.data[i] = v[i]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.data = v
|
||||
this.batchDraw()
|
||||
|
||||
if (options.sync) this.changed(options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue