Anaconda Enterprise: Documentation

# bokeh.core.property_mixins

Mix-in classes that bulk add groups of properties to Bokeh models.

Some groups of properties often show up in Bokeh models together. For instance, any model that exposes a fill color property for use when rendering will almost always want to expose a fill alpha as well. To reduce boilerplate code and simplify defining models with these sets of properties, use the mix-in classes in this module:

- `FillProps` — properties for fill color and alpha
- `LineProps` — properties for line color, dashing, width, etc.
- `TextProps` — properties for text color, font, etc.

To include these properties in a Bokeh model, use the `Include` property as shown here:

    class SomeGlyph(Glyph):

        fill_props = Include(FillProps, use_prefix=False, help="""
        The %s values for the annular wedges.
        """)

This adds all the fill properties `fill_color` and `fill_alpha` to this model with one simple statement. Note that the help string contains a placeholder format %s. When docs for this class are rendered by the bokeh_model Sphinx extension, the placeholder will be replaced with more information specific to each property. The setting `use_prefix` means that the names of the properties added to `SomeGlyph` are exactly `fill_alpha` and `fill_color`. Some situations require a different usage, for more information see the docs for `Include`.

class `bokeh.core.property_mixins.``FillProps`(**properties)

  Properties relevant to rendering fill regions.

  Mirrors the BokehJS `properties.Fill` class.

  `fill_alpha`

    property type: `NumberSpec`

    An alpha value to use to fill paths with.

    Acceptable values are floating point numbers between 0 (transparent) and 1 (opaque).

  `fill_color`

    property type: `ColorSpec`

    A color to use to fill paths with.

    Acceptable values are:

    - any of the 147 named CSS colors, e.g `'green'`, `'indigo'`
    - an RGB(A) hex value, e.g., `'#FF0000'`, `'#44444444'`
    - a 3-tuple of integers (r,g,b) between 0 and 255
    - a 4-tuple of (r,g,b,a) where r,g,b are integers between 0..255 and a is between 0..1

class `bokeh.core.property_mixins.``LineProps`(**properties)

  Properties relevant to rendering path operations.

  Mirrors the BokehJS `properties.Line` class.

  `line_alpha`

    property type: `NumberSpec`

    An alpha value to use to stroke paths with.

    Acceptable values are floating point numbers between 0 (transparent) and 1 (opaque).

  `line_cap`

    property type: `Enum` ( `LineCap` )

    How path segments should be terminated.

    Acceptable values are:

    - `'butt'`
    - `'round'`
    - `'square'`
  `line_color`

    property type: `ColorSpec`

    A color to use to stroke paths with.

    Acceptable values are:

    - any of the 147 named CSS colors, e.g `'green'`, `'indigo'`
    - an RGB(A) hex value, e.g., `'#FF0000'`, `'#44444444'`
    - a 3-tuple of integers (r,g,b) between 0 and 255
    - a 4-tuple of (r,g,b,a) where r,g,b are integers between 0..255 and a is between 0..1
  `line_dash`

    property type: `DashPattern`

    How should the line be dashed.

  `line_dash_offset`

    property type: `Int`

    The distance into the `line_dash` (in pixels) that the pattern should start from.

  `line_join`

    property type: `Enum` ( `LineJoin` )

    How path segments should be joined together.

    Acceptable values are:

    - `'miter'`
    - `'round'`
    - `'bevel'`
  `line_width`

    property type: `NumberSpec`

    Stroke width in units of pixels.

class `bokeh.core.property_mixins.``TextProps`(**properties)

  Properties relevant to rendering text.

  Mirrors the BokehJS `properties.Text` class.

  Note

  There is currently only support for filling text. An interface to stroke the outlines of text has not yet been exposed.

  `text_align`

    property type: `Enum` ( `TextAlign` )

    Horizontal anchor point to use when rendering text.

    Acceptable values are:

    - `'left'`
    - `'right'`
    - `'center'`
  `text_alpha`

    property type: `NumberSpec`

    An alpha value to use to fill text with.

    Acceptable values are floating point numbers between 0 (transparent) and 1 (opaque).

  `text_baseline`

    property type: `Enum` ( `TextBaseline` )

    Vertical anchor point to use when rendering text.

    Acceptable values are:

    - `'top'`
    - `'middle'`
    - `'bottom'`
    - `'alphabetic'`
    - `'hanging'`
    - `'ideographic'`
  `text_color`

    property type: `ColorSpec`

    A color to use to fill text with.

    Acceptable values are:

    - any of the 147 named CSS colors, e.g `'green'`, `'indigo'`
    - an RGB(A) hex value, e.g., `'#FF0000'`, `'#44444444'`
    - a 3-tuple of integers (r,g,b) between 0 and 255
    - a 4-tuple of (r,g,b,a) where r,g,b are integers between 0..255 and a is between 0..1
  `text_font`

    property type: `String`

    Name of a font to use for rendering text, e.g., `'times'`, `'helvetica'`.

  `text_font_style`

    property type: `Enum` ( `FontStyle` )

    A style to use for rendering text.

    Acceptable values are:

    - `'normal'` normal text
    - `'italic'` italic text
    - `'bold'` bold text
  `text_line_height`

    property type: `Float`

    In multi-line text, how much additional space should be allocated for each line. The value is provided as a number, but should be treated as a percentage of font size. The default is 120%. Setting it to 1.0, so 100%, means no additional space will be used.