本文整理汇总了TypeScript中core/util/serialization.encode_column_data函数的典型用法代码示例。如果您正苦于以下问题:TypeScript encode_column_data函数的具体用法?TypeScript encode_column_data怎么用?TypeScript encode_column_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encode_column_data函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should encode typed column data source", () => {
const data = {
x: new Float64Array([1, 2]),
y: new Float64Array([1.1, 2.2]),
}
const shapes = {
x: [2],
y: [2],
}
const e = ser.encode_column_data(data, shapes)
const [d, s] = ser.decode_column_data(e)
expect(data).to.be.deep.equal(d)
expect(shapes).to.be.deep.equal(s)
})
示例2: attributes_as_json
attributes_as_json(include_defaults: boolean = true, value_to_json = ColumnDataSource._value_to_json): any {
const attrs: {[key: string]: any} = {}
const obj = this.serializable_attributes()
for (const key of keys(obj)) {
let value = obj[key]
if (key === 'data')
value = encode_column_data(value, this._shapes)
if (include_defaults)
attrs[key] = value
else if (key in this._set_after_defaults)
attrs[key] = value
}
return value_to_json("attributes", attrs, this)
}
示例3: attributes_as_json
attributes_as_json(include_defaults: boolean = true, value_to_json = ColumnDataSource._value_to_json) {
const attrs = {}
const object = this.serializable_attributes()
for (const key of Object.keys(object || {})) {
let value = object[key]
if (key === 'data') {
value = serialization.encode_column_data(value, this._shapes)
}
if (include_defaults) {
attrs[key] = value
} else if (key in this._set_after_defaults) {
attrs[key] = value
}
}
return value_to_json("attributes", attrs, this)
}
示例4: _value_to_json
static _value_to_json(key: string, value: any, optional_parent_object: any): any {
if (isPlainObject(value) && key === 'data')
return encode_column_data(value as any, optional_parent_object._shapes) // XXX: unknown vs. any
else
return HasProps._value_to_json(key, value, optional_parent_object)
}