本文整理汇总了TypeScript中models/canvas/cartesian_frame.CartesianFrame类的典型用法代码示例。如果您正苦于以下问题:TypeScript CartesianFrame类的具体用法?TypeScript CartesianFrame怎么用?TypeScript CartesianFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CartesianFrame类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe("_get_scales method", () => {
let frame: CartesianFrame
let frame_range: Range1d
beforeEach(() => {
frame = new CartesianFrame(
new LinearScale(),
new LinearScale(),
new Range1d(),
new Range1d())
frame_range = new Range1d({start: 0, end: 100})
})
it("should return scale if defined", () => {
// scale = new LinearScale()
const ranges = {default: new Range1d()}
const scales = frame._get_scales(frame.x_scale, ranges, frame_range)
expect(scales.default).to.be.instanceof(LinearScale)
expect(scales.default.source_range).to.be.instanceof(Range1d)
expect(scales.default.target_range).to.be.instanceof(Range1d)
})
it("should throw error for incompatible numeric scale and factor range", () => {
const ranges = {default: new FactorRange()}
const scale = new LinearScale()
expect(() => frame._get_scales(scale, ranges, frame_range)).to.throw(Error)
})
it("should throw error for incompatible factor scale and numeric range", () => {
const ranges = {default: new Range1d()}
const scale = new CategoricalScale()
expect(() => frame._get_scales(scale, ranges, frame_range)).to.throw(Error)
})
})
示例2: it
it("should return scale if defined", () => {
// scale = new LinearScale()
const ranges = {default: new Range1d()}
const scales = frame._get_scales(frame.x_scale, ranges, frame_range)
expect(scales.default).to.be.instanceof(LinearScale)
expect(scales.default.source_range).to.be.instanceof(Range1d)
expect(scales.default.target_range).to.be.instanceof(Range1d)
})
示例3: expect
expect(() => frame._get_scales(scale, ranges, frame_range)).to.throw(Error)