Commit 1cdeee41 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add documentation for the 'chart/axis-*' elements

parent 0c3ca231
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -823,7 +823,6 @@ ReturnCode build(const Environment& env, const Expr* expr, ElementRef* elem) {
      {"limit-min", bind(&expr_to_float64_opt, _1, &config->scale.min)},
      {"limit-max", bind(&expr_to_float64_opt, _1, &config->scale.max)},
      {"scale", bind(&scale_configure_kind, _1, &config->scale)},
      {"scale-padding", bind(&expr_to_float64, _1, &config->scale.padding)},
      {"border", bind(&expr_to_stroke_style, _1, &config->border_style)},
      {"border-color", bind(&expr_to_color, _1, &config->border_style.color)},
      {"border-width", bind(&expr_to_measure, _1, &config->border_style.line_width)},
+25 −0
Original line number Diff line number Diff line
name: chart/axis-bottom
desc: |
  The chart/axis-bottom element is used to draw a labelled 'top axis'.

reference: |
  (chart/axis-bottom <options>)

option_summary: true

properties:
  - title: "Label Options"
    anchor: label-options
    inherit: ["elements/chart/axis", "label-options"]

  - title: "Scale Options"
    anchor: scale-options
    inherit: ["elements/chart/axis", "scale-options"]

  - title: "Title Options"
    anchor: title-options
    inherit: ["elements/chart/axis", "title-options"]

  - title: "Border Options"
    anchor: border-options
    inherit: ["elements/chart/axis", "border-options"]
+25 −0
Original line number Diff line number Diff line
name: chart/axis-left
desc: |
  The chart/axis-left element is used to draw a labelled 'top axis'.

reference: |
  (chart/axis-left <options>)

option_summary: true

properties:
  - title: "Label Options"
    anchor: label-options
    inherit: ["elements/chart/axis", "label-options"]

  - title: "Scale Options"
    anchor: scale-options
    inherit: ["elements/chart/axis", "scale-options"]

  - title: "Title Options"
    anchor: title-options
    inherit: ["elements/chart/axis", "title-options"]

  - title: "Border Options"
    anchor: border-options
    inherit: ["elements/chart/axis", "border-options"]
+181 −0
Original line number Diff line number Diff line
name: chart/axis
desc: |
  The chart/axis element is used to draw labelled 'axes'.

desc_detail: |
  Note that in most cases it's easier to use one of the convenience element instead of the `chart/axis` element:

    - [chart/axis-top](./axis-top)
    - [chart/axis-right](./axis-right)
    - [chart/axis-bottom](./axis-bottom)
    - [chart/axis-left](./axis-left)

reference: |
  (chart/axis <options>)

option_summary: true

properties:
  - title: "Label Options"
    anchor: label-options
    properties:
      - name: ticks
        desc: |
          The 'ticks' option controls the axis label placement.
        desc_code: |
          ticks <ticks>
        examples: |
          ;; subdivide the axis with 10 ticks
      - name: labels
        desc: |
          The 'labels' option controls how axis labels are formatted.
        desc_code: |
          labels <labels>
        examples: |
          ;; use scientific labels for the top/bottom axes
          labels (scientific)
      - name: label-font-size
        desc: |
          Set the label font size. See the [measure](#FIXME) page for more details on valid values.
        desc_code: |
          label-font-size <measure>
        examples: |
          ;; set the label font size to 14pt
          label-font-size 14pt
      - name: label-color
        desc: |
          Set the label color. See the [color](#FIXME) page for more details on valid values.
        desc_code: |
          label-color <color>
        examples: |
          ;; set the label color to grey
          label-color #eee
      - name: label-padding
        desc: |
          Set the label padding/spacing. See the [measure](#FIXME) page for more details on valid values.
        desc_code: |
          label-padding <measure>
        examples: |
          ;; set the label padding to 2em
          label-padding 2em
      - name: label-rotate
        desc: |
          Rotate the labels. Value is in degrees clockwise.
        desc_code: |
          label-rotate <value>
        examples: |
          ;; rotate the label by 45deg clockwise
          label-rotate 45
      - name: label-attach
        desc: |
          Controls how labels are attached to the axis. Useful in conjunction
          with the `label-rotate` option.
        desc_code: |
          label-attach [begin|center|end]
        examples: |
          ;; set label attach to center
          label-attach center

  - title: "Scale Options"
    anchor: scale-options
    properties:
      - name: limit
        desc: |
          Set the axis value range to the closed interval [min, max].
          If no explicit maximm is specified, the default interval is [0.0, 1.0].
        desc_code: |
          limit (<min> <max)
        examples: |
          ;; set the axis range to [1..10]
          limit (1 10)
      - name: limit-min
        desc: |
          Set the axis minimum value.
          If no explicit maximm is specified, the default maximum value is '0.0'.
        desc_code: |
          limit-min <min>
        examples: |
          ;; set the axis min value to 2
          limit-min 2
      - name: limit-max
        desc: |
          Set the axis maximum value.
          If no explicit maximm is specified, the default maximum value is '1.0'.
        desc_code: |
          limit-max <max>
        examples: |
          ;; set the axis max value to 20
          limit-max 20
      - name: scale
        desc: |
          Set the scale type.
        desc_code: |
          scale ([linear] [log] [logarithmic] [invert] [inverted])
        desc_detail: |
          List of scale types:

            - `linear` - Standard linear scale
            - `log`, `logarithmic` - Logarithmic (log10) scale
            - `invert`, `inverted` - Flip the scale

        examples: |
          ;; set the axis to logarithmic mode
          scale (log)

          ;; set the axis to inverted mode
          scale (invert)

  - title: "Title Options"
    anchor: title-options
    properties:
      - name: title
        desc: |
          Set the axis title
        desc_code: |
          title <title>
        examples: |
          ;; set the axis title to "Time"
          title "Time"
      - name: title-font-size
        desc: |
          Set the title font size. See the [measure](#FIXME) page for more details on valid values.
        desc_code: |
          title-font-size <measure>
        examples: |
          ;; set the title font size to 14pt
          title-font-size 14pt
      - name: title-color
        desc: |
          Set the title color. See the [color](#FIXME) page for more details on valid values.
        desc_code: |
          title-color <color>
        examples: |
          ;; set the title color to grey
          title-color #eee
      - name: title-padding
        desc: |
          Set the title padding/spacing. See the [measure](#FIXME) page for more details on valid values.
        desc_code: |
          title-padding <measure>
        examples: |
          ;; set the title padding to 2em
          title-padding 2em
      - name: title-rotate
        desc: |
          Rotate the title. Value is in degrees clockwise.
        desc_code: |
          title-rotate <value>
        examples: |
          ;; rotate the title by 45deg clockwise
          title-rotate 45


  - title: "Border Options"
    anchor: border-options
    properties:
      - name: border
        inherit: ["elements/layout/box", "border"]
      - name: border-width
        inherit: ["elements/layout/box", "border-width"]
      - name: border-color
        inherit: ["elements/layout/box", "border-color"]
+25 −0
Original line number Diff line number Diff line
name: chart/axis-right
desc: |
  The chart/axis-right element is used to draw a labelled 'top axis'.

reference: |
  (chart/axis-right <options>)

option_summary: true

properties:
  - title: "Label Options"
    anchor: label-options
    inherit: ["elements/chart/axis", "label-options"]

  - title: "Scale Options"
    anchor: scale-options
    inherit: ["elements/chart/axis", "scale-options"]

  - title: "Title Options"
    anchor: title-options
    inherit: ["elements/chart/axis", "title-options"]

  - title: "Border Options"
    anchor: border-options
    inherit: ["elements/chart/axis", "border-options"]
Loading