当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript column_data_source.ColumnDataSource类代码示例

本文整理汇总了TypeScript中models/sources/column_data_source.ColumnDataSource的典型用法代码示例。如果您正苦于以下问题:TypeScript ColumnDataSource类的具体用法?TypeScript ColumnDataSource怎么用?TypeScript ColumnDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ColumnDataSource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it("should clear typed arrays to typed arrays", () => {
   for (const typ of [Float32Array, Float64Array, Int32Array]) {
     const r = new ColumnDataSource({data: {foo: [10, 20], bar: new typ([1,2])}})
     r.clear()
     expect(r.data).to.be.deep.equal({foo: [], bar: new typ([])})
   }
 })
开发者ID:jsignell,项目名称:bokeh,代码行数:7,代码来源:column_data_source.ts

示例2: 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])
  })
开发者ID:jsignell,项目名称:bokeh,代码行数:9,代码来源:cds_view.ts

示例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]))
  })
开发者ID:jsignell,项目名称:bokeh,代码行数:11,代码来源:cumsum.ts

示例4: 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]))
  })
开发者ID:jsignell,项目名称:bokeh,代码行数:11,代码来源:stack.ts


注:本文中的models/sources/column_data_source.ColumnDataSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。