當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Plot.add_layout方法代碼示例

本文整理匯總了TypeScript中models/plots/plot.Plot.add_layout方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Plot.add_layout方法的具體用法?TypeScript Plot.add_layout怎麽用?TypeScript Plot.add_layout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models/plots/plot.Plot的用法示例。


在下文中一共展示了Plot.add_layout方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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}) as PlotView
    const plot_canvas_view = plot_view.plot_canvas_view

    const axis_view = new axis.default_view({
      model: axis,
      plot_view: plot_canvas_view,
      parent: plot_canvas_view,
    }) as AxisView

    return {axis, axis_view}
  }
開發者ID:,項目名稱:,代碼行數:30,代碼來源:

示例2: it

  it("use user bounds when set'", () => {
    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, 'below')
    const grid = new Grid({ticker, bounds: [1, 9]})
    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([1, 9])
  })
開發者ID:jsignell,項目名稱:bokeh,代碼行數:16,代碼來源:grid.ts

示例3: it

 it("should have a SidePanel after plot.add_layout is called", () => {
   const ticker = new BasicTicker()
   const formatter = new BasicTickFormatter()
   const axis = new Axis({ticker, formatter})
   expect(axis.panel).to.be.undefined
   const plot = new Plot({
     x_range: new Range1d({start: 0, end: 1}),
     y_range: new Range1d({start: 0, end: 1}),
   })
   plot.add_layout(axis, 'left')
   expect(axis.panel).to.be.an.instanceOf(SidePanel)
 })
開發者ID:,項目名稱:,代碼行數:12,代碼來源:

示例4: beforeEach

 beforeEach(function() {
   const plot = new Plot({
     x_range: new Range1d({start: 0, end: 1}),
     y_range: new Range1d({start: 0, end: 1}),
   })
   const axis = new Axis({
     ticker: new BasicTicker(),
     formatter: new BasicTickFormatter(),
   })
   plot.add_layout(axis, 'below')
   const plot_view = new plot.default_view({model: plot, parent: null}) as any
   this.axis_view = plot_view.plot_canvas_view.renderer_views[axis.id]
 })
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例5: 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:jsignell,項目名稱:bokeh,代碼行數:16,代碼來源:color_bar.ts

示例6: 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:jsignell,項目名稱:bokeh,代碼行數:17,代碼來源:axis.ts


注:本文中的models/plots/plot.Plot.add_layout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。