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


TypeScript Plot.add_layout方法代码示例

本文整理汇总了TypeScript中@bokehjs/models/plots/plot.Plot.add_layout方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Plot.add_layout方法的具体用法?TypeScript Plot.add_layout怎么用?TypeScript Plot.add_layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@bokehjs/models/plots/plot.Plot的用法示例。


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

示例1: it

  it("use axis computed bounds when dimensions doesn't match, and bounds='auto'", () => {
    const plot = new Plot({
      x_range: new Range1d({start: 0, end: 10}),
      y_range: new Range1d({start: 0, end: 10}),
    })
    const ticker = new BasicTicker()
    const formatter = new BasicTickFormatter()
    const axis = new Axis({ticker, formatter, bounds: [2, 8]})
    plot.add_layout(axis, 'left')
    const grid = new Grid({ticker})
    plot.add_layout(grid, 'center')
    const plot_view = new plot.default_view({model: plot, parent: null}).build()
    const grid_view = plot_view.renderer_views[grid.id] as GridView

    expect(grid_view.computed_bounds()).to.be.deep.equal([0, 10])
  })
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:16,代码来源:grid.ts

示例2: color_bar_view

function color_bar_view(attrs: Partial<ColorBar.Attrs>, place: Place = "center"): ColorBarView {
  const plot = new Plot({
     x_range: new Range1d({start: 0, end: 1}),
     y_range: new Range1d({start: 0, end: 1}),
     frame_width: 500,
     frame_height: 500,
     width_policy: "min",
     height_policy: "min",
  })

  const color_bar = new ColorBar(attrs)
  plot.add_layout(color_bar, place)

  const plot_view = new plot.default_view({model: plot, parent: null}).build()
  return plot_view.renderer_views[color_bar.id] as ColorBarView
}
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:16,代码来源:color_bar.ts

示例3: it

 it("should return zero offsets when fixed_location is numeric", () => {
   const plot = new Plot({
     x_range: new Range1d({start: 0, end: 10}),
     y_range: new Range1d({start: 0, end: 10}),
   })
   const ticker = new BasicTicker()
   const formatter = new BasicTickFormatter()
   const axis = new Axis({
     ticker,
     formatter,
     fixed_location: 5,
   })
   plot.add_layout(axis, "left")
   const plot_view = new plot.default_view({model: plot, parent: null}).build()
   const axis_view = plot_view.renderer_views[axis.id] as AxisView
   expect(axis_view.offsets).to.deep.equal([0, 0])
 })
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:17,代码来源:axis.ts

示例4: build

  function build(axis_attrs: Partial<Axis.Attrs> = {}) {
    const ticker = new BasicTicker()
    const formatter = new BasicTickFormatter()

    const axis = new Axis({
      major_label_standoff: 11,
      major_tick_out: 12,
      ticker,
      formatter,
      ...axis_attrs,
    })

    const plot = new Plot({
      x_range: new Range1d({start: 0, end: 1}),
      y_range: new Range1d({start: 0, end: 1}),
      toolbar: new Toolbar(),
    })
    plot.add_layout(axis, 'below')

    const plot_view = new plot.default_view({model: plot, parent: null}).build()
    const axis_view = plot_view.renderer_views[axis.id] as AxisView

    return {axis, axis_view}
  }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:24,代码来源:axis.ts


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