Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bokehjs' property mixins to match bokeh #10192

Merged
merged 2 commits into from
Jun 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bokeh/models/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class ColorBar(Annotation):
main plot area.
""")

bar_props = Include(LineProps, help="""
bar_props = Include(ScalarLineProps, help="""
The %s for the color scale bar outline.
""")

Expand Down
66 changes: 33 additions & 33 deletions bokehjs/src/lib/core/property_mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ export type LineVector = {
line_color: p.VectorSpec<Color | null>
line_alpha: p.VectorSpec<number>
line_width: p.VectorSpec<number>
line_join: p.ScalarSpec<LineJoin>
line_cap: p.ScalarSpec<LineCap>
line_dash: p.ScalarSpec<number[]>
line_dash_offset: p.ScalarSpec<number>
line_join: p.Property<LineJoin>
line_cap: p.Property<LineCap>
line_dash: p.Property<number[]>
line_dash_offset: p.Property<number>
}

export type FillVector = {
Expand All @@ -173,53 +173,53 @@ export type HatchVector = {
hatch_scale: p.VectorSpec<number>
hatch_pattern: p.VectorSpec<HatchPattern | null>
hatch_weight: p.VectorSpec<number>
hatch_extra: p.VectorSpec<HatchExtra>
hatch_extra: p.Property<HatchExtra>
}

export type TextVector = {
text_color: p.VectorSpec<Color | null>
text_alpha: p.VectorSpec<number>
text_font: p.ScalarSpec<string>
text_font: p.Property<string>
text_font_size: p.VectorSpec<string>
text_font_style: p.ScalarSpec<FontStyle>
text_align: p.ScalarSpec<TextAlign>
text_baseline: p.ScalarSpec<TextBaseline>
text_line_height: p.ScalarSpec<number>
text_font_style: p.Property<FontStyle>
text_align: p.Property<TextAlign>
text_baseline: p.Property<TextBaseline>
text_line_height: p.Property<number>
}

export const LineVector: p.DefineOf<LineVector> = {
line_color: [ p.ColorSpec, "black" ],
line_alpha: [ p.NumberSpec, 1.0 ],
line_width: [ p.NumberSpec, 1 ],
line_join: [ p.LineJoinScalar, "bevel" ],
line_cap: [ p.LineCapScalar, "butt" ],
line_dash: [ p.ArrayScalar, [] ],
line_dash_offset: [ p.NumberScalar, 0 ],
line_color: [ p.ColorSpec, "black" ],
line_alpha: [ p.NumberSpec, 1.0 ],
line_width: [ p.NumberSpec, 1 ],
line_join: [ p.LineJoin, "bevel" ],
line_cap: [ p.LineCap, "butt" ],
line_dash: [ p.Array, [] ],
line_dash_offset: [ p.Number, 0 ],
}

export const FillVector: p.DefineOf<FillVector> = {
fill_color: [ p.ColorSpec, "gray" ],
fill_alpha: [ p.NumberSpec, 1.0 ],
fill_color: [ p.ColorSpec, "gray" ],
fill_alpha: [ p.NumberSpec, 1.0 ],
}

export const HatchVector: p.DefineOf<HatchVector> = {
hatch_color: [ p.ColorSpec, "black" ],
hatch_alpha: [ p.NumberSpec, 1.0 ],
hatch_scale: [ p.NumberSpec, 12.0 ],
hatch_pattern: [ p.NullStringSpec, null ],
hatch_weight: [ p.NumberSpec, 1.0 ],
hatch_extra: [ p.AnyScalar, {} ],
hatch_color: [ p.ColorSpec, "black" ],
hatch_alpha: [ p.NumberSpec, 1.0 ],
hatch_scale: [ p.NumberSpec, 12.0 ],
hatch_pattern: [ p.NullStringSpec, null ],
hatch_weight: [ p.NumberSpec, 1.0 ],
hatch_extra: [ p.Any, {} ],
}

export const TextVector: p.DefineOf<TextVector> = {
text_color: [ p.ColorSpec, "#444444" ],
text_alpha: [ p.NumberSpec, 1.0 ],
text_font: [ p.Font, "helvetica" ],
text_font_size: [ p.FontSizeSpec, "16px" ],
text_font_style: [ p.FontStyleScalar, "normal" ],
text_align: [ p.TextAlignScalar, "left" ],
text_baseline: [ p.TextBaselineScalar, "bottom" ],
text_line_height: [ p.NumberScalar, 1.2 ],
text_color: [ p.ColorSpec, "#444444" ],
text_alpha: [ p.NumberSpec, 1.0 ],
text_font: [ p.Font, "helvetica" ],
text_font_size: [ p.FontSizeSpec, "16px" ],
text_font_style: [ p.FontStyle, "normal" ],
text_align: [ p.TextAlign, "left" ],
text_baseline: [ p.TextBaseline, "bottom" ],
text_line_height: [ p.Number, 1.2 ],
}

// Common property mixins used in models. This duplication is currently unavoidable.
Expand Down
6 changes: 3 additions & 3 deletions bokehjs/test/unit/core/visuals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Fill", () => {
it(`should set canvas context ${attr} value from ${spec} spec value`, () =>{
const ctx = {} as any
const attrs = {} as any
attrs[spec] = {value}
attrs[spec] = value
const model = new Circle(attrs)
const fill = new Fill(model)
fill.set_value(ctx)
Expand Down Expand Up @@ -69,7 +69,7 @@ describe("Line", () => {
ctx.setLineDash = function(x: number) { ctx.lineDash = x }
ctx.setLineDashOffset = function(x: number) { ctx.lineDashOffset = x }
const attrs = {line_dash: [1, 2]} as any
attrs[spec] = {value}
attrs[spec] = value
const model = new Circle(attrs)
const line = new Line(model)
line.set_value(ctx)
Expand Down Expand Up @@ -120,7 +120,7 @@ describe("Text", () => {
it(`should set canvas context ${attr} value from ${spec} spec value`, () =>{
const ctx = {} as any
const attrs = {text_font: 'times', text_font_size: "16px", text_font_style: "bold"} as any
attrs[spec] = {value}
attrs[spec] = value
const model = new text_glyph.Text(attrs)
const text = new Text(model)
text.set_value(ctx)
Expand Down