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

add documentation for the 'chart/lines' element

parent 181cec98
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -190,6 +190,8 @@ ReturnCode build(
    {"marker-size", bind(&data_load, _1, &c->marker_sizes)},
    {"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) {
+124 −0
Original line number Diff line number Diff line
name: chart/lines
example: charts-basic/linechart_timeseries
desc: |
  The `chart/lines` element is used to create line charts.

reference: |
  (chart/lines <options>)

option_summary: true

properties:
  - title: "Line Options"
    anchor: line-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: stroke
        desc: |
          Set the line's stroke style. See the
          [stroke-style](#FIXME) page for more details on valid values.
        desc_code: |
          stroke (<stroke-style>)
        examples: |
          ;; set the stroke to 2px solid
          stroke (2px solid)
      - name: color
        alias: colors
      - name: colors
        desc: |
          Set the colors for the plot. If set, a label will be drawn for each
          point in the dataset at the points (x, y) coordinate,
        desc_code: |
          colors (<values>...)
          colors (csv <file> <column>)
        examples: |
          ;; list of static values
          colors (#0f0 #00f #f00)

          ;; load a csv file
          colors (csv myfile.csv mycolors)
      - name: marker-size
        alias: marker-sizes
      - name: marker-sizes
        desc: |
          Set the marker-sizes for the plot. If set, a marker will be drawn for each
          point in the dataset at the points (x, y) coordinate.
        desc_code: |
          marker-sizes (<values>...)
          marker-sizes (csv <file> <column>)
        examples: |
          ;; list of static values
          marker-sizes (2pt 4pt 2pt)

          ;; load a csv file
          marker-sizes (csv myfile.csv mysizes)

  - title: "Label Options"
    anchor: label-options
    properties:
      - 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"]
+2 −2
Original line number Diff line number Diff line
name: chart/points
example: charts-basic/scatterplot
desc: |
  The chart/points element is used to create point/scattercharts.
  The `chart/points` element is used to create point/scattercharts.

reference: |
  (chart/points <options>)
@@ -57,7 +57,7 @@ properties:
        alias: marker-sizes
      - name: marker-sizes
        desc: |
          Set the marker-sizes for the plot. If set, a label will be drawn for each
          Set the marker-sizes for the plot. If set, a marker will be drawn for each
          point in the dataset at the points (x, y) coordinate,
        desc_code: |
          marker-sizes (<values>...)
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ documentation:
      -
        title: "chart/axis-left"
        url: "/documentation/elements/chart/axis-left"
      -
        title: "chart/lines"
        url: "/documentation/elements/chart/lines"
      -
        title: "chart/points"
        url: "/documentation/elements/chart/points"
+3 −1
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@
{{#example}}
<h4>Example</h4>
<section class="info_box">
  <a href="/examples/{{example}}">
    <img src="{{example_img}}" />
  </a>
</section>
{{/example}}