@@ -3,16 +3,13 @@ import { CString, CFunction, CEventPtr } from '../cvizzu.types'
33import * as Anim from '../types/anim.js'
44import * as Config from '../types/config.js'
55import * as Styles from '../types/styles.js'
6- import * as Data from '../types/data.js'
76
87import { CManagedObject , CObject , CEnv } from './cenv.js'
98import { CPointerClosure } from './objregistry.js'
109import { CProxy } from './cproxy.js'
1110import { CCanvas } from './ccanvas.js'
1211import { CAnimation } from './canimctrl.js'
1312
14- import { isIterable } from '../utils.js'
15-
1613/** Stored Chart object. */
1714export class Snapshot extends CManagedObject { }
1815
@@ -136,42 +133,15 @@ export class CChart extends CManagedObject {
136133 this . _wasm . _chart_getList ,
137134 this . _wasm . _chart_getValue ,
138135 this . _wasm . _chart_setValue ,
139- ( value : unknown ) : value is Record < string , unknown > =>
140- isIterable ( value ) && ! this . _isSeriesDescriptor ( value ) ,
141- ( value : unknown ) : string => {
142- // workaround: we should be able to pass series descriptor as two string
143- if ( this . _isSeriesDescriptor ( value ) ) {
144- return value . aggregator ? `${ value . aggregator } (${ value . name } )` : value . name
145- } else {
146- return String ( value ) . toString ( )
147- }
148- } ,
149136 ( path : string , value : string ) : unknown => {
150137 // workaround because channel.*.set returns already json instead of scalars
151138 if ( path . startsWith ( 'channels.' ) && path . endsWith ( '.set' ) ) {
152- return JSON . parse ( value ) . map ( ( v : string ) => this . _toSeriesDescriptor ( v ) )
139+ return JSON . parse ( value )
153140 } else return value
154141 }
155142 )
156143 }
157144
158- private _toSeriesDescriptor ( value : string ) : Data . SeriesDescriptor {
159- const pattern = / ^ ( \w + ) \( ( .* ?) \) $ /
160- const match = value . match ( pattern )
161- if ( match ) {
162- return {
163- name : match [ 2 ] ! ,
164- aggregator : match [ 1 ] ! as Data . AggregatorType
165- }
166- } else {
167- return { name : value }
168- }
169- }
170-
171- private _isSeriesDescriptor ( value : unknown ) : value is Data . SeriesDescriptor {
172- return typeof value === 'object' && value !== null && 'name' in value
173- }
174-
175145 private _makeStyle ( computed : boolean ) : CStyle {
176146 return new CStyle (
177147 this . getId ,
0 commit comments