Commit 540b36eb authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add a new module system

- Add the new (class ...) statement
- Move the existing commands into the plot and draw namespaces
- Update the documentation
parent 312f9c1c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ add_dependencies(test test-extract-data)
# -----------------------------------------------------------------------------
add_custom_target(doc
    COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/wwwdocs
    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/doc/web/build.sh ${CMAKE_CURRENT_BINARY_DIR}/wwwdocs)
    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/doc/web/build.sh ${clip_VERSION} ${CMAKE_CURRENT_BINARY_DIR}/wwwdocs)

file(GLOB doc_figure_files "doc/**/*.clp")
foreach(doc_figure_path ${doc_figure_files})
+25 −29
Original line number Diff line number Diff line
<div align="center"><img src="./doc/logo.svg" alt="clip" width="160" /></div>
<h3>clip – The command line illustration processor</h3>
clip
====

clip (the _command line illustration processor_) is an open-source command line
program and software library for creating charts and other programmatic
illustrations. In essence, clip consists of a library of drawing commands. This
command library includes high-level building blocks for creating common chart
types as well as lower-level drawing primitives such as markers, arrows and lines.
program and software library for creating charts and other data-driven
illustrations.

<h4>
  <a href="https://clip-lang.org/getting-started">Getting Started</a> &middot;
@@ -17,29 +15,33 @@ types as well as lower-level drawing primitives such as markers, arrows and line
Introduction
------------

Being a highly visual tool, clip is best explained by example. So here is how to
draw a simple line chart using clip):
In essence, clip is an automated drawing program; it reads a text file containing
a description of the chart or diagram and produces an image from it. This is best
explained by example, so here is how to draw a simple line chart using clip:

    $ clip --export example_chart.svg example_chart.clp
    (class plot)

The command reads an input file (`example_chart.clp`) and produces an output SVG
file from it. This is the input file:
    (axes
        label-format-x (datetime "%H:%M:%S"))

    (figure/plot
        limit-x (0 7200)
        limit-y (0 100)
        lines (
    (grid
        stroke-color #333
        stroke-style dashed)

    (lines
        data-x (csv "measurement.csv" time)
        data-y (csv "measurement.csv" value)
        stroke-width 0.8pt)
        grid (
            stroke-color #333
            stroke-style dashed))

The resulting SVG file looks like this:
The input file from above (`example.clp`) can be processed with clip using the
following command:

    $ clip --export output.svg example.clp

This is the resulting SVG file (`output.svg`):

<div align="center">
  <a href="https://clip-lang.org/examples/charts-scientific/vectorfield">
  <a href="https://clip-lang.org/examples/charts-scientific/multiple_y_axes">
    <img src="/doc/demo.svg" width="80%" alt="Demo Chart" />
  </a>
</div>
@@ -59,12 +61,6 @@ You can find the full documentation and more examples at [clip-lang.org](https:/
Installation
------------

#### Using homebrew (macOS)

To install clip using homebrew, run the following command:

    $ brew install clip

#### Compile from source

To build clip, you need an up-to-date C++ compiler, cmake, fmtlib, libharfbuzz,
+4 −2
Original line number Diff line number Diff line
@@ -4,8 +4,10 @@ Colors
The `<color>` setting allows you to configure colors. The following ways to
specify colors are supported:

    ;; specify a color by hex code or reference a color from the color palette
    <color-code>
    ;; specify a color by hex code
    #rgb
    #rrggbb
    #rrggbbaa

    ;; specify a color by rgb. components should be in the range 0..1
    (rgb <r> <g> <b>)
+18 −17
Original line number Diff line number Diff line
(layer/resize 2048px 768px)
(layer/set-dpi 240)
(layer/set-font "Latin Modern Roman")
(size 2048px 768px)
(dpi 240)
(font "Latin Modern Roman")
(limit-x (0 7200))
(limit-y (0 100))

(figure/plot
    limit-x (0 7200)
    limit-y (0 100)
    axes (
(axes
    label-format-x (datetime "%H:%M:%S")
    label-placement-x (linear-interval 900 900 7000))
    grid (

(grid
    stroke-color (rgba 0 0 0 0.2)
    stroke-style dashed
    tick-placement-x (none))
    lines (

(lines
    data-x (csv "test/testdata/timeseries.csv" time)
    data-y (csv "test/testdata/timeseries.csv" value)
        stroke-width 0.8pt))
    stroke-width 0.8pt)
+8 −8
Original line number Diff line number Diff line
(figure/plot
    lines (

(lines
    data-x (100 200 300 400 500 600 700 800 900)
    data-y (1.2 1.8 1.3 1.6 1.5 1.3 1.8 1.9 2.0)
    limit-y (0 3)
    limit-x (0 1000)
    marker-shape (pentagon)
        marker-size 8pt))
    marker-size 8pt)
Loading