本文整理匯總了TypeScript中@bokehjs/models/sources/column_data_source.ColumnDataSource.stream方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ColumnDataSource.stream方法的具體用法?TypeScript ColumnDataSource.stream怎麽用?TypeScript ColumnDataSource.stream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@bokehjs/models/sources/column_data_source.ColumnDataSource
的用法示例。
在下文中一共展示了ColumnDataSource.stream方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should update its indices when its source streams new data", () => {
const cds = new ColumnDataSource({data: {x: [], y: []}})
const new_data = {x: [1], y: [1]}
const view = new CDSView({source: cds})
expect(view.indices).to.be.deep.equal([])
cds.stream(new_data)
expect(view.indices).to.be.deep.equal([0])
})
示例2: it
it("should should re-compute if a source streams", () => {
const source = new ColumnDataSource({data: {foo: [1, 2, 3], bar: [0.1, 0.2, 0.3]}})
const s = new Stack({fields: ['foo', 'bar']})
const ret0 = s.v_compute(source)
expect(ret0).to.deep.equal(new Float64Array([1.1, 2.2, 3.3]))
source.stream({foo: [4], bar: [0.4]})
const ret1 = s.v_compute(source)
expect(ret1).to.deep.equal(new Float64Array([1.1, 2.2, 3.3, 4.4]))
})
示例3: it
it("should should re-compute if a source streams", () => {
const source = new ColumnDataSource({data: {foo: [1, 2, 3, 4]}})
const s = new CumSum({field: 'foo'})
const ret0 = s.v_compute(source)
expect(ret0).to.deep.equal(new Float64Array([1, 3, 6, 10]))
source.stream({foo: [5]})
const ret1 = s.v_compute(source)
expect(ret1).to.deep.equal(new Float64Array([1, 3, 6, 10, 15]))
})