Skip to content

Commit

Permalink
Include outline_shape="none" in tests and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpap committed May 13, 2024
1 parent d78eae1 commit 1aa1529
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Figure bbox=[0, 0, 1000, 400]
Canvas bbox=[0, 0, 1000, 400]
CartesianFrame bbox=[5, 5, 990, 390]
GlyphRenderer bbox=[67, 356, 866, 0]
Text bbox=[67, 356, 866, 0]
GlyphRenderer bbox=[67, 239, 866, 0]
TeXGlyph bbox=[67, 239, 866, 0]
GlyphRenderer bbox=[67, 83, 866, 0]
TeXGlyph bbox=[67, 83, 866, 0]
GlyphRenderer bbox=[60, 356, 880, 0]
Text bbox=[60, 356, 880, 0]
GlyphRenderer bbox=[60, 239, 880, 0]
TeXGlyph bbox=[60, 239, 880, 0]
GlyphRenderer bbox=[60, 83, 880, 0]
TeXGlyph bbox=[60, 83, 880, 0]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 15 additions & 8 deletions bokehjs/test/integration/glyphs/glyphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,22 +709,26 @@ describe("Glyph models", () => {

describe("should support Text-like glyphs", () => {
it("with outline_shape", async () => {
const p = fig([1000, 400], {x_range: [5, 85], y_range: [0, 50], x_axis_type: null, y_axis_type: null})
const p = fig([1000, 400], {
x_range: [5, 95], y_range: [0, 50],
x_axis_type: null, y_axis_type: null,
background_fill_color: "ivory",
})

const x = [10, 20, 30, 40, 50, 60, 70, 80]
const x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
const padding = 5

p.text({
anchor: "center",
x,
y: 5,
text: ["circle", "square", "ellipse", "box\nrectangle", "trapezoid", "parallelogram", "diamond", "triangle"],
outline_shape: ["circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
text: ["none", "circle", "square", "ellipse", "box\nrectangle", "trapezoid", "parallelogram", "diamond", "triangle"],
outline_shape: ["none", "circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color: "white",
background_fill_alpha: 0.8,
background_fill_alpha: 1.0,
padding,
border_line_color: "black",
text_font_size: "1.2em",
text_font_size: "0.9em",
})

function tex(display: DisplayMode, y: number, color: Color) {
Expand All @@ -734,6 +738,7 @@ describe("Glyph models", () => {
x,
y,
text: [
r`\emptyset`,
r`x^{y^z}`,
r`\frac{1}{x^2\cdot y}`,
r`\int_{-\infty}^{\infty} \frac{1}{x} dx`,
Expand All @@ -743,10 +748,12 @@ describe("Glyph models", () => {
r`x^2`,
r`y_{\rho \theta}`,
],
outline_shape: ["circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color: color, background_fill_alpha: 0.8,
outline_shape: ["none", "circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color: color,
background_fill_alpha: 0.8,
padding,
border_line_color: "black",
text_font_size: "1.0em",
display,
})
}
Expand Down
13 changes: 8 additions & 5 deletions examples/styling/mathtext/latex_outline_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
width=1000, height=400,
x_axis_type=None, y_axis_type=None,
toolbar_location=None,
background_fill_color="ivory",
)

x = [10, 20, 30, 40, 50, 60, 70, 80]
x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
padding = 5

p.text(
anchor="center",
x=x,
y=5,
text=["circle", "square", "ellipse", "box\nrectangle", "trapezoid", "parallelogram", "diamond", "triangle"],
outline_shape=["circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color="white", background_fill_alpha=0.8,
text=["none", "circle", "square", "ellipse", "box\nrectangle", "trapezoid", "parallelogram", "diamond", "triangle"],
outline_shape=["none", "circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color="white",
background_fill_alpha=1.0,
padding=padding,
border_line_color="black",
text_font_size="1.2em",
Expand All @@ -31,6 +33,7 @@ def tex(display: Literal["inline", "block"], y: float, color: str):
x=x,
y=y,
text=[
r"\emptyset",
r"x^{y^z}",
r"\frac{1}{x^2\cdot y}",
r"\int_{-\infty}^{\infty} \frac{1}{x} dx",
Expand All @@ -40,7 +43,7 @@ def tex(display: Literal["inline", "block"], y: float, color: str):
r"x^2",
r"y_{\rho \theta}",
],
outline_shape=["circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
outline_shape=["none", "circle", "square", "ellipse", "box", "trapezoid", "parallelogram", "diamond", "triangle"],
background_fill_color=color,
background_fill_alpha=0.8,
padding=padding,
Expand Down

0 comments on commit 1aa1529

Please sign in to comment.