Commit fda0534d authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add documentation for the 'chart/labels' element

parent c518227c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ ReturnCode build(
    {"scale-y-padding", bind(&expr_to_float64, _1, &c->scale_y.padding)},
    {"labels", bind(&data_load_strings, _1, &c->labels)},
    {"label-font-size", bind(&expr_to_measure, _1, &c->label_font_size)},
    {"label-color", bind(&expr_to_color, _1, &c->label_color)},
    {"label-padding", bind(&expr_to_measure, _1, &c->label_padding)},
  });

  if (!config_rc) {
+82 −0
Original line number Diff line number Diff line
name: chart/labels
example: charts-basic/scatterplot_with_labels
desc: |
  The `chart/labels` element is used to draw labels at arbitrary positions.

reference: |
  (chart/labels <options>)

option_summary: true

properties:
  - title: "Label Options"
    anchor: label-options
    properties:
      - name: data-x
        desc: |
          Set the 'x' dataset for the plot. The 'x' dataset will be used to
          calculate the horizontal position of geometry.
        desc_code: |
          data-x (<values>...)
          data-x (csv <file> <column>)
        examples: |
          ;; list of static values
          data-x (10px 20px 30px)

          ;; load a csv file
          data-x (csv myfile.csv mycolumn)
      - name: data-y
        desc: |
          Set the 'y' dataset for the plot. The 'y' dataset will be used to
          calculate the vertical position of geometry.
        desc_code: |
          data-y (<values>...)
          data-y (csv <file> <column>)
        examples: |
          ;; list of static values
          data-y (10px 20px 30px)

          ;; load a csv file
          data-y (csv myfile.csv mycolumn)

      - name: labels
        desc: |
          Set the labels for the plot. If set, a label will be drawn for each
          point in the dataset at the points (x, y) coordinate,
        desc_code: |
          labels (<values>...)
          labels (csv <file> <column>)
        examples: |
          ;; list of static values
          labels ("A" "B" "C")

          ;; load a csv file
          labels (csv myfile.csv mylabels)
      - 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

  - title: "Scale Options"
    anchor: scale-options
    inherit: ["elements/chart/layout", "scale-options"]
+3 −0
Original line number Diff line number Diff line
@@ -123,6 +123,9 @@ documentation:
      -
        title: "chart/bars"
        url: "/documentation/elements/chart/bars"
      -
        title: "chart/labels"
        url: "/documentation/elements/chart/labels"
      -
        title: "chart/lines"
        url: "/documentation/elements/chart/lines"