• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript plot.Plot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Plot类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: function

const make_testcase = function(): BoxEditTestCase {
  // Note default plot dimensions is 600 x 600 (height x width)
  const plot = new Plot({
    x_range: new Range1d({start: -1, end: 1}),
    y_range: new Range1d({start: -1, end: 1}),
  });

  const plot_view: any = new plot.default_view({model: plot, parent: null});
  plot_view.layout();

  const plot_canvas_view = plot_view.plot_canvas_view;

  const data = {
    x: [0, 0.5, 1],
    y: [0, 0.5, 1],
    width: [0.1, 0.2, 0.3],
    height: [0.3, 0.2, 0.1],
    z: [null, null, null],
  };
  const data_source = new ColumnDataSource({data: data});

  const glyph = new Rect({
    x: {field: "x"},
    y: {field: "y"},
    width: {field: "width"},
    height: {field: "height"},
  });

  const glyph_renderer: any = new GlyphRenderer({
    glyph: glyph,
    data_source: data_source,
  });

  // Untyped to access GlyphView
  const glyph_renderer_view: any = new glyph_renderer.default_view({
    model: glyph_renderer,
    plot_view: plot_canvas_view,
    parent: plot_canvas_view,
  });

  const draw_tool = new BoxEditTool({
    active: true,
    renderers: [glyph_renderer],
    empty_value: "Test",
  });
  plot.add_tools(draw_tool);
  const draw_tool_view = plot_canvas_view.tool_views[draw_tool.id];
  plot_canvas_view.renderer_views[glyph_renderer.id] = glyph_renderer_view;

  return {
    data: data,
    data_source: data_source,
    draw_tool_view: draw_tool_view,
    glyph_view: glyph_renderer_view.glyph,
  }
}
开发者ID:Zyell,项目名称:bokeh,代码行数:56,代码来源:box_edit_tool.ts


示例3: mkplot

 function mkplot(tool: Tool): PlotView {
   const plot = new Plot({
     x_range: new Range1d({start: -1, end: 1}),
     y_range: new Range1d({start: -1, end: 1}),
   })
   plot.add_tools(tool)
   const document = new Document()
   document.add_root(plot)
   return new plot.default_view({model: plot, parent: null}).build()
 }
开发者ID:jsignell,项目名称:bokeh,代码行数:10,代码来源:zoom_out_tool.ts


示例4: 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,代码来源:


示例5: function

const make_testcase = function(): PolyDrawTestCase {
  // Note default plot dimensions is 600 x 600 (height x width)
  const plot = new Plot({
    x_range: new Range1d({start: -1, end: 1}),
    y_range: new Range1d({start: -1, end: 1}),
  });

  const plot_view: any = new plot.default_view({model: plot, parent: null});
  plot_view.layout();

  const plot_canvas_view = plot_view.plot_canvas_view;

  const data = {
    xs: [[0, 0.5, 1], [0, 0.5, 1]],
    ys: [[0, -0.5, -1], [0, -0.5, -1]],
    z: [null, null],
  };
  const data_source = new ColumnDataSource({data: data});

  const glyph = new Patches({
    xs: {field: "xs"},
    ys: {field: "ys"},
  });

  const glyph_renderer: any = new GlyphRenderer({
    glyph: glyph,
    data_source: data_source,
  });

  const glyph_renderer_view: any = new glyph_renderer.default_view({
    model: glyph_renderer,
    plot_view: plot_canvas_view,
    parent: plot_canvas_view,
  });

  const draw_tool = new PolyDrawTool({
    active: true,
    empty_value: "Test",
    renderers: [glyph_renderer],
  });
  plot.add_tools(draw_tool);
  const draw_tool_view = plot_canvas_view.tool_views[draw_tool.id];
  plot_canvas_view.renderer_views[glyph_renderer.id] = glyph_renderer_view;
  sinon.stub(glyph_renderer_view, "set_data");

  return {
    data: data,
    data_source: data_source,
    draw_tool_view: draw_tool_view,
    glyph_view: glyph_renderer_view.glyph,
  }
}
开发者ID:Zyell,项目名称:bokeh,代码行数:52,代码来源:poly_draw_tool.ts


示例6: 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,代码来源:


示例7: 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


示例8: 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


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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript data_range1d.DataRange1d类代码示例发布时间:2022-05-25
下一篇:
TypeScript stage.Stage类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap