Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: CategoryAxis

[112:7] extends: Region

Wraps JavaFX CategoryAxis, an axis that displays a discrete set of string category labels evenly spaced along the axis. It is used as the X or Y axis in XY charts such as BarChart and StackedBarChart where the domain values are named categories rather than numbers. Extends Axis, Region, and Node.

CSS Properties -- CategoryAxis

Property Values Default Description
-fx-start-margin <number> 5 Margin in pixels before the first category.
-fx-end-margin <number> 5 Margin in pixels after the last category.
-fx-gap-start-and-end true | false true When true, a gap is added before and after the end categories.

CSS Properties -- Axis

Property Values Default Description
-fx-side top | bottom | left | right (auto) Side of the chart on which this axis is placed.
-fx-tick-length <size> 8 Length of major tick marks.
-fx-tick-label-font <font> system default Font for the tick mark labels.
-fx-tick-label-fill <paint> black Fill color of the tick mark labels.
-fx-tick-label-gap <size> 3 Gap between the tick mark and its label.
-fx-tick-mark-visible true | false true When true, major tick marks are drawn.
-fx-tick-labels-visible true | false true When true, labels for major tick marks are drawn.
-fx-minor-tick-length <size> 5 Length of minor tick marks.
-fx-minor-tick-count <integer> 5 Number of minor tick divisions between major ticks.
-fx-minor-tick-visible true | false true When true, minor tick marks are drawn.
-fx-animated true | false true When true, axis changes are animated.

CSS Properties -- Region

Background fills

Property Values Default Description
-fx-background-color <paint> [, <paint>]* transparent One or more paint values for background fill layers, rendered back to front.
-fx-background-insets <size> or <t> <r> <b> <l> [, ...]* 0 0 0 0 Insets from the region edges for each background fill layer.
-fx-background-radius <size> [/ <size>]* [, ...]* 0 0 0 0 Corner radii for each background fill layer.

Background images

Property Values Default Description
-fx-background-image <uri> [, <uri>]* null One or more image URIs for background image layers.
-fx-background-position <bg-position> [, ...]* 0% 0% Position of each background image within the region.
-fx-background-repeat <repeat-style> [, ...]* repeat repeat Tiling behavior for each background image.
-fx-background-size <bg-size> [, ...]* auto auto Dimensions for each background image.

Stroked borders

Property Values Default Description
-fx-border-color <paint> or <t> <r> <b> <l> [, ...]* null Paint colors for the border stroke layers.
-fx-border-insets <size> or <t> <r> <b> <l> [, ...]* null Insets from region edges for each border layer.
-fx-border-radius <size> [, ...]* null Corner radii for border stroke layers.
-fx-border-style <border-style> [, ...]* null Border line style (solid, dotted, dashed) plus phase and line cap/join options per layer.
-fx-border-width <size> or <t> <r> <b> <l> [, ...]* null Thickness of each border stroke layer, per side.

Border images

Property Values Default Description
-fx-border-image-source <uri> [, <uri>]* null Image URIs used to paint the border.
-fx-border-image-insets <size> or <t> <r> <b> <l> [, ...]* 0 0 0 0 Insets for each border image layer.
-fx-border-image-repeat <repeat-style> [, ...]* repeat repeat Tiling behavior for each border image.
-fx-border-image-slice <size> or <t> <r> <b> <l> [fill] [, ...]* 100% Divides each border image into nine regions. Adding fill preserves the center region.
-fx-border-image-width <size> or <t> <r> <b> <l> [, ...]* 1 1 1 1 Width of each border image slice per side.

Other Region properties

Property Values Default Description
-fx-padding <size> or <t> <r> <b> <l> 0 0 0 0 Interior padding between the region border and its content.
-fx-shape <string> null SVG path string that defines a custom clip shape for the region.
-fx-scale-shape true | false true When true, the shape is scaled to fit the region.
-fx-position-shape true | false true When true, the shape is centered within the region.
-fx-snap-to-pixel true | false true When true, positions and sizes are rounded to whole pixel boundaries.
-fx-min-width <size> -1 Minimum width. -1 uses the computed minimum.
-fx-pref-width <size> -1 Preferred width. -1 uses the computed preferred.
-fx-max-width <size> -1 Maximum width. -1 uses the computed maximum.
-fx-min-height <size> -1 Minimum height. -1 uses the computed minimum.
-fx-pref-height <size> -1 Preferred height. -1 uses the computed preferred.
-fx-max-height <size> -1 Maximum height. -1 uses the computed maximum.

CSS Properties -- Node

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-cursor null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> null (inherits) Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-focus-traversable true | false false Whether this node participates in focus traversal.
-fx-view-order <number> 0 Adjusts rendering and hit-test order within the parent without changing the scene graph order.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-scale-z <number> 1 Scale factor along the Z axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
-fx-translate-z <number> 0 Translation offset along the Z axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods

  • CategoryAxis ()

    Creates a new CategoryAxis with no predefined categories.

    • @r this object
  • setLabel (string Label)

    Sets the axis label text displayed alongside the axis.

    • @p Label is the string to display as the axis label.
    • @r this object
  • categorySpacingProperty ()

    Returns the read-only property that holds the spacing computed between consecutive category labels.

    • @r A ReadOnlyDoubleProperty AJO holding the spacing in pixels.
  • endMarginProperty ()

    Returns the property that holds the end margin.

    • @r A DoubleProperty AJO holding the end margin in pixels.
  • gapStartAndEndProperty ()

    Returns the property that holds the gap-start-and-end flag.

    • @r A BooleanProperty AJO holding the flag.
  • getCategories ()

    Returns the live ObservableList of category label strings. Mutations to the list are reflected on the axis.

    • @r An ObservableList AJO of String elements.
  • getCategorySpacing ()

    Returns the computed spacing between consecutive categories.

    • @r A double with the spacing in pixels.
  • getDisplayPosition (string Value)

    Returns the display position in pixels for a given category value. Wraps the (String) overload.

    • @p Value is a string with the category name.
    • @r A double with the display position in pixels.
  • getEndMargin ()

    Returns the end margin in pixels added after the last category.

    • @r A double with the end margin.
  • getStartMargin ()

    Returns the start margin in pixels added before the first category.

    • @r A double with the start margin.
  • getValueForDisplay (double Position)

    Returns the category value for a given display position.

    • @p Position is a double with the display position in pixels.
    • @r A string with the corresponding category name.
  • getZeroPosition ()

    Returns the display position in pixels of the zero line. For CategoryAxis this is normally Double.NaN since there is no zero.

    • @r A double with the zero-line position.
  • invalidateRange (object Values)

    Invalidates the axis range so it re-computes from the supplied list of category values.

    • @p Values is an AJO holding a java.util.List of String category names.
    • @r this object for chaining
  • isGapStartAndEnd ()

    Returns true when a gap is added before the first and after the last category.

    • @r A bool with the gap-start-and-end flag.
  • isValueOnAxis (string Value)

    Returns true if the supplied category value is currently on the axis. Wraps the (String) overload.

    • @p Value is a string with the category name.
    • @r A bool indicating whether the value is on the axis.
  • setCategories (object Categories)

    Replaces the axis categories with the supplied ObservableList.

    • @p Categories is an AJO holding an ObservableList of String values.
    • @r this object for chaining
  • setEndMargin (double Margin)

    Sets the end margin added after the last category.

    • @p Margin is a double with the margin in pixels.
    • @r this object for chaining
  • setGapStartAndEnd (bool Value)

    Sets the gap-start-and-end flag. When true, padding is added before the first and after the last category.

    • @p Value is a bool with the flag value.
    • @r this object for chaining
  • setStartMargin (double Margin)

    Sets the start margin added before the first category.

    • @p Margin is a double with the margin in pixels.
    • @r this object for chaining
  • startMarginProperty ()

    Returns the property that holds the start margin.

    • @r A DoubleProperty AJO holding the start margin.
  • toNumericValue (string Value)

    Returns the numeric position of the given category value on the axis. Wraps the (String) overload.

    • @p Value is a string with the category name.
    • @r A double with the numeric position.
  • toRealValue (double Position)

    Returns the category value for the given numeric position.

    • @p Position is a double with the numeric position.
    • @r A string with the matching category name.