本文整理汇总了TypeScript中@bokehjs/models/sources/column_data_source.ColumnDataSource.patch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ColumnDataSource.patch方法的具体用法?TypeScript ColumnDataSource.patch怎么用?TypeScript ColumnDataSource.patch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@bokehjs/models/sources/column_data_source.ColumnDataSource
的用法示例。
在下文中一共展示了ColumnDataSource.patch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should should re-compute if a source patches", () => {
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.patch({foo: [[1, 12]]})
const ret1 = s.v_compute(source)
expect(ret1).to.deep.equal(new Float64Array([1.1, 12.2, 3.3]))
source.patch({bar: [[0, 1.1]]})
const ret2 = s.v_compute(source)
expect(ret2).to.deep.equal(new Float64Array([2.1, 12.2, 3.3]))
})
示例2: it
it("should should re-compute if a source patches", () => {
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.patch({foo: [[1, 12]]})
const ret1 = s.v_compute(source)
expect(ret1).to.deep.equal(new Float64Array([1, 13, 16, 20]))
source.patch({foo: [[0, 1.1]]})
const ret2 = s.v_compute(source)
expect(ret2).to.deep.equal(new Float64Array([1.1, 13.1, 16.1, 20.1]))
})
示例3: it
it("should update its indices when its source patches new data", () => {
const cds = new ColumnDataSource({data: {x: ["a"], y: [1]}})
const group_filter = new GroupFilter({column_name: "x", group: "b"})
const view = new CDSView({source: cds, filters: [group_filter]})
expect(view.indices).to.be.deep.equal([])
cds.patch({x: [[0, "b"]]})
expect(view.indices).to.be.deep.equal([0])
})