├── .gitattributes ├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── NOTICE ├── README.md ├── doc ├── colors.md ├── command_line.md ├── commands.md ├── contributing.md ├── demo.clp ├── demo.svg ├── document_setup.md ├── download.md ├── example.tpl.html ├── faq.md ├── figures │ ├── quickstart1.clp │ ├── quickstart1.svg │ ├── quickstart2.clp │ ├── quickstart2.svg │ ├── quickstart3.clp │ └── quickstart3.svg ├── fonts.md ├── frontpage.md ├── frontpage.yaml ├── getting-started.md ├── installation.md ├── layer │ └── resize.yaml ├── license.md ├── logo.svg ├── marker-shapes.md ├── plot.md ├── plot │ ├── areas.yaml │ ├── axes.yaml │ ├── axis.yaml │ ├── bars.yaml │ ├── color-maps.md │ ├── errorbars.yaml │ ├── grid.yaml │ ├── labels.yaml │ ├── legend.yaml │ ├── lines.yaml │ ├── number-format.md │ ├── points.yaml │ ├── rectangles.yaml │ ├── scale-layout.md │ ├── scale-types.md │ ├── size-map.md │ ├── types │ │ ├── dataset-format.yaml │ │ ├── dataset-ref.yaml │ │ ├── dataset-x.yaml │ │ ├── dataset-y.yaml │ │ ├── dataset.yaml │ │ ├── dataset_ref.yaml │ │ ├── dataset_string.yaml │ │ ├── label_attach.yaml │ │ ├── label_format.yaml │ │ ├── label_offset.yaml │ │ ├── label_padding.yaml │ │ ├── label_placement.yaml │ │ ├── label_rotate.yaml │ │ ├── limit-max.yaml │ │ ├── limit.yaml │ │ ├── limit_min.yaml │ │ ├── padding.yaml │ │ ├── scale.yaml │ │ ├── scale_args.yaml │ │ ├── shape.yaml │ │ ├── tick_length.yaml │ │ ├── tick_offset.yaml │ │ ├── tick_placement.yaml │ │ ├── title.yaml │ │ ├── title_offset.yaml │ │ ├── title_padding.yaml │ │ └── title_rotate.yaml │ ├── usage.md │ └── vectors.yaml ├── reference.md ├── support.md ├── types │ ├── color.yaml │ ├── font_size.yaml │ ├── size.yaml │ ├── stroke_style.yaml │ └── stroke_width.yaml ├── typographic.md └── web │ ├── .gitignore │ ├── build.sh │ ├── build_examples.py │ ├── build_layout.py │ ├── build_pages.py │ ├── documentation.css │ ├── favicon.ico │ ├── redirects.txt │ ├── reference_detail.tpl.html │ ├── requirements.txt │ └── runtime.txt ├── extra ├── .gitignore └── cmake │ ├── FindCairo.cmake │ ├── FindFontconfig.cmake │ └── FindHarfBuzz.cmake ├── src ├── api.cc ├── api.h ├── arrows.cc ├── arrows.h ├── cli.cc ├── color_map.cc ├── color_map.h ├── color_palette.cc ├── color_palette.h ├── color_reader.cc ├── color_reader.h ├── config.h.in ├── context.cc ├── context.h ├── data.cc ├── data.h ├── data_impl.h ├── draw.cc ├── draw.h ├── draw │ ├── path.cc │ ├── path.h │ ├── rectangle.cc │ ├── rectangle.h │ ├── text.cc │ └── text.h ├── eval.cc ├── eval.h ├── figure │ ├── legend.cc │ ├── legend.h │ ├── legend_item.cc │ └── legend_item.h ├── format.cc ├── format.h ├── graphics │ ├── brush.cc │ ├── brush.h │ ├── color.cc │ ├── color.h │ ├── draw.cc │ ├── draw.h │ ├── draw_cmd.cc │ ├── draw_cmd.h │ ├── export_image.cc │ ├── export_image.h │ ├── export_svg.cc │ ├── export_svg.h │ ├── font_lookup.cc │ ├── font_lookup.h │ ├── geometry.cc │ ├── geometry.h │ ├── image.cc │ ├── image.h │ ├── intersect.cc │ ├── intersect.h │ ├── layout.cc │ ├── layout.h │ ├── measure.cc │ ├── measure.h │ ├── path.cc │ ├── path.h │ ├── png.cc │ ├── png.h │ ├── polygon.h │ ├── rasterize.cc │ ├── rasterize.h │ ├── shape_hatch.cc │ ├── shape_hatch.h │ ├── text.cc │ ├── text.h │ ├── text_backend.cc │ ├── text_backend.h │ ├── text_backend_freetype.cc │ ├── text_backend_freetype.h │ ├── text_layout.cc │ ├── text_layout.h │ ├── text_shaper.cc │ ├── text_shaper.h │ ├── text_support.cc │ └── text_support.h ├── layer.cc ├── layer.h ├── layout.h ├── legend │ └── item_ref.yaml ├── marker.cc ├── marker.h ├── plist_parser.cc ├── plist_parser.h ├── plot │ ├── areas.cc │ ├── areas.h │ ├── axis.cc │ ├── axis.h │ ├── bars.cc │ ├── bars.h │ ├── errorbars.cc │ ├── errorbars.h │ ├── grid.cc │ ├── grid.h │ ├── labels.cc │ ├── labels.h │ ├── lines.cc │ ├── lines.h │ ├── plotgen.cc │ ├── plotgen.h │ ├── points.cc │ ├── points.h │ ├── polygons.cc │ ├── polygons.h │ ├── rectangles.cc │ ├── rectangles.h │ ├── vectors.cc │ └── vectors.h ├── return_code.cc ├── return_code.h ├── scale.cc ├── scale.h ├── sexpr.cc ├── sexpr.h ├── sexpr_conv.cc ├── sexpr_conv.h ├── sexpr_conv_impl.h ├── sexpr_parser.cc ├── sexpr_parser.h ├── sexpr_util.cc ├── sexpr_util.h ├── sexpr_util_impl.h ├── style.cc ├── style.h ├── style_reader.cc ├── style_reader.h ├── style_util.cc ├── style_util.h ├── typographic_map.cc ├── typographic_map.h ├── typographic_reader.cc ├── typographic_reader.h ├── units.cc ├── units.h ├── utils │ ├── CivilTime.cc │ ├── CivilTime.h │ ├── CivilTime_impl.h │ ├── ISO8601.cc │ ├── ISO8601.h │ ├── UTF8.cc │ ├── UTF8.h │ ├── UnixTime.cc │ ├── UnixTime.h │ ├── UnixTime_impl.h │ ├── algo.cc │ ├── algo.h │ ├── algo_impl.h │ ├── buffer.cc │ ├── buffer.h │ ├── bufferutil.cc │ ├── bufferutil.h │ ├── csv.cc │ ├── csv.h │ ├── duration.cc │ ├── duration.h │ ├── duration_impl.h │ ├── exception.cc │ ├── exception.h │ ├── file.cc │ ├── file.h │ ├── fileutil.cc │ ├── fileutil.h │ ├── flagparser.cc │ ├── flagparser.h │ ├── geojson.cc │ ├── geojson.h │ ├── json.cc │ ├── json.h │ ├── option.h │ ├── option_impl.h │ ├── outputstream.cc │ ├── outputstream.h │ ├── random.cc │ ├── random.h │ ├── stdtypes.h │ ├── stringutil.cc │ ├── stringutil.h │ ├── stringutil_impl.h │ ├── time_constants.h │ ├── wallclock.cc │ └── wallclock.h ├── vmath.cc └── vmath.h └── test ├── .gitignore ├── draw ├── style_default.clp ├── style_default.svg ├── style_fill_hatch.clp ├── style_fill_hatch.svg ├── style_fill_hatch_custom.clp ├── style_fill_hatch_custom.svg ├── style_fill_hatch_zero.clp ├── style_fill_hatch_zero.svg ├── style_fill_multi.clp ├── style_fill_multi.svg ├── style_fill_solid.clp ├── style_fill_solid.svg ├── style_fill_solid_short.clp ├── style_fill_solid_short.svg ├── style_short.clp ├── style_short.svg ├── style_stroke_dash.clp ├── style_stroke_dash.svg ├── style_stroke_dash_custom.clp ├── style_stroke_dash_custom.svg ├── style_stroke_multi.clp ├── style_stroke_multi.svg ├── style_stroke_solid.clp ├── style_stroke_solid.svg ├── style_stroke_solid_custom.clp ├── style_stroke_solid_custom.svg ├── style_stroke_solid_short.clp ├── style_stroke_solid_short.svg ├── text_basic.clp ├── text_basic.svg ├── text_color.clp ├── text_color.svg ├── text_custom_font.clp ├── text_custom_font.svg ├── text_font_size.clp ├── text_font_size.svg ├── text_position.clp ├── text_position.svg ├── text_stroke.clp └── text_stroke.svg ├── examples ├── charts_basic_areachart.clp ├── charts_basic_areachart.svg ├── charts_basic_areas_and_lines.clp ├── charts_basic_areas_and_lines.svg ├── charts_basic_areas_vertical.clp ├── charts_basic_areas_vertical.svg ├── charts_basic_barchart_groups.clp ├── charts_basic_barchart_groups.svg ├── charts_basic_custom_font.clp ├── charts_basic_custom_font.svg ├── charts_basic_demo_timeseries.clp ├── charts_basic_demo_timeseries.svg ├── charts_basic_histogram.clp ├── charts_basic_histogram.svg ├── charts_basic_linechart_timeseries.clp ├── charts_basic_linechart_timeseries.svg ├── charts_basic_scatterplot.clp ├── charts_basic_scatterplot.svg ├── charts_custom_axis_titles.clp ├── charts_custom_axis_titles.svg ├── charts_custom_custom_color_palette.clp ├── charts_custom_custom_color_palette.svg ├── charts_custom_inverted_scale.clp ├── charts_custom_inverted_scale.svg ├── charts_custom_irregular_data.clp ├── charts_custom_irregular_data.svg ├── charts_custom_logarithmic_scale.clp ├── charts_custom_logarithmic_scale.svg ├── charts_custom_rotate_labels.clp ├── charts_custom_rotate_labels.svg ├── charts_custom_text_i18n.clp ├── charts_custom_text_i18n.svg ├── charts_editorial_barchart_horizontal.clp ├── charts_editorial_barchart_horizontal.svg ├── charts_editorial_barchart_with_labels.clp ├── charts_editorial_barchart_with_labels.svg ├── charts_editorial_chart_i18n.clp ├── charts_editorial_chart_i18n.svg ├── charts_editorial_linechart_with_labels.clp ├── charts_editorial_linechart_with_labels.svg ├── charts_editorial_stacked_areas.clp ├── charts_editorial_stacked_areas.svg ├── charts_editorial_stacked_bars.clp ├── charts_editorial_stacked_bars.svg ├── charts_reference_format_base.clp ├── charts_reference_format_base.svg ├── charts_reference_format_datetime.clp ├── charts_reference_format_datetime.svg ├── charts_reference_format_fixed.clp ├── charts_reference_format_fixed.svg ├── charts_reference_format_integer.clp ├── charts_reference_format_integer.svg ├── charts_reference_format_scientific.clp ├── charts_reference_format_scientific.svg ├── charts_reference_scale_categorical.clp ├── charts_reference_scale_categorical.svg ├── charts_reference_scale_inverted.clp ├── charts_reference_scale_inverted.svg ├── charts_reference_scale_layout_categorical.clp ├── charts_reference_scale_layout_categorical.svg ├── charts_reference_scale_layout_categorical_bounds.clp ├── charts_reference_scale_layout_categorical_bounds.svg ├── charts_reference_scale_layout_exponential.clp ├── charts_reference_scale_layout_exponential.svg ├── charts_reference_scale_layout_exponential_steps.clp ├── charts_reference_scale_layout_exponential_steps.svg ├── charts_reference_scale_layout_linear.clp ├── charts_reference_scale_layout_linear.svg ├── charts_reference_scale_layout_linear_align.clp ├── charts_reference_scale_layout_linear_align.svg ├── charts_reference_scale_layout_linear_alignat.clp ├── charts_reference_scale_layout_linear_alignat.svg ├── charts_reference_scale_layout_linear_interval.clp ├── charts_reference_scale_layout_linear_interval.svg ├── charts_reference_scale_layout_subdivide.clp ├── charts_reference_scale_layout_subdivide.svg ├── charts_reference_scale_linear.clp ├── charts_reference_scale_linear.svg ├── charts_reference_scale_logarithmic.clp ├── charts_reference_scale_logarithmic.svg ├── charts_scientific_barchart_ranges.clp ├── charts_scientific_barchart_ranges.svg ├── charts_scientific_errorbars_log.clp ├── charts_scientific_errorbars_log.svg ├── charts_scientific_line_markers.clp ├── charts_scientific_line_markers.svg ├── charts_scientific_multiple_y_axes.clp ├── charts_scientific_multiple_y_axes.svg ├── charts_scientific_scalarfield.clp ├── charts_scientific_scalarfield.svg ├── charts_scientific_scatterplot_colors.clp ├── charts_scientific_scatterplot_colors.svg ├── charts_scientific_scatterplot_with_labels.clp ├── charts_scientific_scatterplot_with_labels.svg ├── charts_scientific_streamgraph.clp ├── charts_scientific_streamgraph.svg ├── charts_scientific_vectorfield.clp ├── charts_scientific_vectorfield.svg ├── maps_gulf_of_mexico.clp └── maps_gulf_of_mexico.svg ├── general ├── nomodule.clp └── nomodule.svg ├── layer ├── resize_a4.clp ├── resize_a4.svg ├── resize_a4_dpi.clp ├── resize_a4_dpi.svg ├── resize_a4_landscape.clp ├── resize_a4_landscape.svg ├── resize_mm.clp ├── resize_mm.svg ├── resize_mm_dpi.clp ├── resize_mm_dpi.svg ├── resize_px.clp ├── resize_px.svg ├── resize_px_dpi.clp └── resize_px_dpi.svg ├── legend ├── legend_default.clp ├── legend_default.svg ├── legend_flow.clp ├── legend_flow.svg ├── legend_flow_small.clp ├── legend_flow_small.svg ├── legend_flow_valign.clp ├── legend_flow_valign.svg ├── legend_i18n.clp ├── legend_i18n.svg ├── legend_item_default.clp ├── legend_item_default.svg ├── legend_position_bottom_center.clp ├── legend_position_bottom_center.svg ├── legend_position_bottom_left.clp ├── legend_position_bottom_left.svg ├── legend_position_bottom_right.clp ├── legend_position_bottom_right.svg ├── legend_position_center_center.clp ├── legend_position_center_center.svg ├── legend_position_center_left.clp ├── legend_position_center_left.svg ├── legend_position_center_right.clp ├── legend_position_center_right.svg ├── legend_position_top_center.clp ├── legend_position_top_center.svg ├── legend_position_top_left.clp ├── legend_position_top_left.svg ├── legend_position_top_right.clp └── legend_position_top_right.svg ├── plot-areas ├── areas_basic.clp ├── areas_basic.svg ├── areas_csv.clp ├── areas_csv.svg ├── areas_vertical.clp └── areas_vertical.svg ├── plot-axis ├── axes_categorical.clp ├── axes_categorical.svg ├── axis_bottom_default.clp ├── axis_bottom_default.svg ├── axis_bottom_label_begin.clp ├── axis_bottom_label_begin.svg ├── axis_bottom_label_begin45.clp ├── axis_bottom_label_begin45.svg ├── axis_bottom_label_beginn45.clp ├── axis_bottom_label_beginn45.svg ├── axis_bottom_label_center.clp ├── axis_bottom_label_center.svg ├── axis_bottom_label_center180.clp ├── axis_bottom_label_center180.svg ├── axis_bottom_label_end135.clp ├── axis_bottom_label_end135.svg ├── axis_bottom_label_end180.clp ├── axis_bottom_label_end180.svg ├── axis_bottom_label_end225.clp ├── axis_bottom_label_end225.svg ├── axis_bottom_title.clp ├── axis_bottom_title.svg ├── axis_bottom_title_rotate.clp ├── axis_bottom_title_rotate.svg ├── axis_left_default.clp ├── axis_left_default.svg ├── axis_left_label_center.clp ├── axis_left_label_center.svg ├── axis_left_label_center180.clp ├── axis_left_label_center180.svg ├── axis_left_label_flip.clp ├── axis_left_label_flip.svg ├── axis_left_label_flip135.clp ├── axis_left_label_flip135.svg ├── axis_left_label_flip225.clp ├── axis_left_label_flip225.svg ├── axis_left_label_rotate45.clp ├── axis_left_label_rotate45.svg ├── axis_left_label_rotaten45.clp ├── axis_left_label_rotaten45.svg ├── axis_left_title.clp ├── axis_left_title.svg ├── axis_left_title_rotate.clp ├── axis_left_title_rotate.svg ├── axis_right_default.clp ├── axis_right_default.svg ├── axis_right_label_center.clp ├── axis_right_label_center.svg ├── axis_right_label_center180.clp ├── axis_right_label_center180.svg ├── axis_right_label_flip.clp ├── axis_right_label_flip.svg ├── axis_right_label_flip135.clp ├── axis_right_label_flip135.svg ├── axis_right_label_flip225.clp ├── axis_right_label_flip225.svg ├── axis_right_label_rotate45.clp ├── axis_right_label_rotate45.svg ├── axis_right_label_rotaten45.clp ├── axis_right_label_rotaten45.svg ├── axis_right_title.clp ├── axis_right_title.svg ├── axis_right_title_rotate.clp ├── axis_right_title_rotate.svg ├── axis_scale_linear_linear.clp ├── axis_scale_linear_linear.svg ├── axis_scale_linear_linear_aligned.clp ├── axis_scale_linear_linear_aligned.svg ├── axis_scale_linear_subdivide.clp ├── axis_scale_linear_subdivide.svg ├── axis_scale_linear_subdivide_labels.clp ├── axis_scale_linear_subdivide_labels.svg ├── axis_top_default.clp ├── axis_top_default.svg ├── axis_top_label_begin135.clp ├── axis_top_label_begin135.svg ├── axis_top_label_begin180.clp ├── axis_top_label_begin180.svg ├── axis_top_label_begin225.clp ├── axis_top_label_begin225.svg ├── axis_top_label_center.clp ├── axis_top_label_center.svg ├── axis_top_label_center180.clp ├── axis_top_label_center180.svg ├── axis_top_label_end.clp ├── axis_top_label_end.svg ├── axis_top_label_end45.clp ├── axis_top_label_end45.svg ├── axis_top_label_endn45.clp ├── axis_top_label_endn45.svg ├── axis_top_title.clp ├── axis_top_title.svg ├── axis_top_title_rotate.clp ├── axis_top_title_rotate.svg ├── axis_vert_tick_center.clp ├── axis_vert_tick_center.svg ├── axis_vert_tick_left.clp ├── axis_vert_tick_left.svg ├── axis_vert_tick_right.clp └── axis_vert_tick_right.svg ├── plot-bars ├── barchart_horizontal.clp ├── barchart_horizontal.svg ├── barchart_ranges.clp ├── barchart_ranges.svg ├── barchart_with_labels.clp ├── barchart_with_labels.svg ├── bars_basic.clp ├── bars_basic.svg ├── bars_negative_values.clp ├── bars_negative_values.svg ├── histogram.clp └── histogram.svg ├── plot-grid ├── gridlines_basic.clp └── gridlines_basic.svg ├── plot-lines ├── lines_basic.clp ├── lines_basic.svg ├── lines_csv.clp ├── lines_csv.svg ├── lines_err_inconsistent_data.clp ├── lines_err_inconsistent_data.err ├── lines_geojson.clp ├── lines_geojson.svg ├── lines_geojson_data.geojson ├── lines_inverted.clp ├── lines_inverted.svg ├── lines_logscale.clp ├── lines_logscale.svg ├── lines_stroke_style_dash_pattern.clp ├── lines_stroke_style_dash_pattern.svg ├── lines_stroke_style_dashed.clp ├── lines_stroke_style_dashed.svg ├── lines_with_labels.clp └── lines_with_labels.svg ├── plot-points ├── marker_circle_default.clp ├── marker_circle_default.svg ├── marker_circle_width.clp ├── marker_circle_width.svg ├── marker_disk.clp ├── marker_disk.svg ├── markers_unicode.clp ├── markers_unicode.svg ├── markers_unicode_customfont.clp ├── markers_unicode_customfont.svg ├── plot_log10.clp ├── plot_log10.svg ├── plot_log10_lt1.clp ├── plot_log10_lt1.svg ├── plot_log2.clp ├── plot_log2.svg ├── points_basic.clp ├── points_basic.svg ├── points_categorical.clp ├── points_categorical.svg ├── points_categorical_err_value.clp ├── points_categorical_err_value.err ├── points_categorical_err_wrongscale.clp ├── points_categorical_err_wrongscale.err ├── points_color_steps.clp ├── points_color_steps.svg ├── points_colors.clp ├── points_colors.svg ├── points_geojson.clp ├── points_geojson.svg ├── points_geojson_data.geojson ├── points_size_map.clp └── points_size_map.svg ├── plot-vectors ├── vectors_basic.clp └── vectors_basic.svg ├── test_runner.sh ├── testdata ├── .gitignore ├── areadata.csv ├── areadata2.csv ├── bardata.csv ├── bardata_quoted.csv ├── city_temperatures.csv ├── city_temperatures_london.csv ├── errorbars.csv ├── extract_testdata.sh ├── field2d.csv ├── field2d.py ├── fonts │ ├── LiberationSans-Regular.ttf │ └── Roboto-Medium.ttf ├── gauss2d.csv ├── gauss2d.py ├── gauss3d.csv ├── gbp_per_country.csv ├── gbp_per_country_simple.csv ├── gbp_per_country_simple_noheaders.csv ├── gdp_bar_chart.sql ├── gdp_per_capita.csv ├── gdp_per_capita_2010.csv ├── gdp_per_capita_small.csv ├── gulf_of_mexico.geojson.gz ├── histogram.csv ├── irregular_data.csv ├── irregular_data1.csv ├── irregular_data2.csv ├── log_example.csv ├── measurement.csv ├── measurement2.csv ├── point_example.csv ├── simple.csv ├── stacked.csv ├── stacked.py ├── timeseries.csv ├── timeseries.py ├── vectorfield.csv └── vectorfield.py └── unit ├── test_csv_parser.cc ├── test_graphics_box_layout.cc ├── test_graphics_intersect.cc ├── test_graphics_pattern_hatch.cc ├── test_graphics_text_align.cc ├── test_graphics_text_glyph_export.cc ├── test_graphics_text_rotate.cc ├── test_graphics_vmath.cc ├── test_sexpr_parser.cc └── unittest.h /.gitattributes: -------------------------------------------------------------------------------- 1 | extra/* linguist-documentation 2 | manual/* linguist-documentation 3 | examples/* linguist-documentation=false 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .DS_Store 3 | CMakeFiles 4 | CMakeCache.txt 5 | Makefile 6 | cmake_install.cmake 7 | *.a 8 | *.so 9 | *.dll 10 | *.dylib 11 | /clip 12 | /clip_config.h 13 | /.ninja_deps 14 | /.ninja_log 15 | /*.ninja 16 | /test_*.png 17 | /test_* 18 | CTestTestfile.cmake 19 | Testing 20 | install_manifest.txt 21 | wwwdocs 22 | config.h 23 | test-results 24 | 25 | # Local Netlify folder 26 | .netlify -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | 4 | before_install: 5 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo apt-get update -qq; fi 6 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo apt-get install -y cmake libfreetype6-dev libharfbuzz-dev libfribidi-dev libcairo2-dev libfmt-dev; fi 7 | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew update; fi 8 | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew install freetype harfbuzz fribidi cairo cppformat clip; fi 9 | 10 | script: 11 | - cmake . 12 | - make all 13 | 14 | jobs: 15 | include: 16 | - os: linux 17 | dist: bionic 18 | compiler: gcc 19 | - os: linux 20 | dist: bionic 21 | compiler: clang 22 | - os: osx 23 | osx_image: xcode9.4 24 | - os: osx 25 | osx_image: xcode11 26 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | clip -- The command line illustration processor 2 | https://clip-lang.org 3 | 4 | Copyright (c) 2018 Paul Asmuth, Laura Schlimmer 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /doc/contributing.md: -------------------------------------------------------------------------------- 1 | Contributing to clip 2 | ====================== 3 | 4 | To contribute, please fork the github repository, make your changes and run the 5 | specs, commit them to your github repository and send me a pull request. 6 | Need help, head on over to our [Google Groups][1] page to discuss any ideas 7 | that you might have. 8 | 9 | Here are some ways to contribute to clip: 10 | 11 | + Report bugs or suggest new features 12 | + Suggest or implement new options for existing charts or new chart types 13 | + Improve the documentation 14 | + Publish howtos, tutorials and videos 15 | 16 | ### Individual Contributors to clip 17 | 18 | [View the list of individual contributors on Github](http://github.com/asmuth/clip/graphs/contributors) 19 | 20 | 21 | -------------------------------------------------------------------------------- /doc/demo.clp: -------------------------------------------------------------------------------- 1 | class: plot; 2 | size: 1750px 500px; 3 | 4 | limit-x: 0 7200; 5 | limit-y: 0 100; 6 | 7 | axes { 8 | font: "Roboto"; 9 | position: left bottom; 10 | label-placement-x: linear-interval(900 900 7000); 11 | label-format-x: datetime("%H:%M:%S"); 12 | } 13 | 14 | lines { 15 | data: "test/testdata/timeseries.csv"; 16 | stroke-width: 0.8pt; 17 | color: #06c; 18 | } 19 | -------------------------------------------------------------------------------- /doc/download.md: -------------------------------------------------------------------------------- 1 | Download 2 | ======== 3 | 4 | There are a number of ways to obtain the clip sources: 5 | 6 | ### Source Code (Github) 7 | 8 | You can find the complete [source code on Github](http://github.com/asmuth/clip) 9 | 10 | -------------------------------------------------------------------------------- /doc/example.tpl.html: -------------------------------------------------------------------------------- 1 |

Example: {{example_url}}

2 | 3 |

Output File:

4 |

5 | 6 |

7 | 8 |

Source File:

9 |
{{example_src}}
10 | 11 |

Run this example:

12 |
$ clip --export output.svg {{example_file}}
13 | -------------------------------------------------------------------------------- /doc/faq.md: -------------------------------------------------------------------------------- 1 | Frequently Asked Questions 2 | ========================== 3 | 4 | ### I'm getting build errors when compiling the code 5 | 6 | clip needs a reasonably modern C++ compiler and standard library. In most 7 | cases where the code doesn't build it's due to some problem with the local build 8 | environment. We always appreciate bug reports so we improve our build system, but 9 | often the best workaround for the moment is to download a binary release from the 10 | downloads page. 11 | 12 | 13 | ### The test suite fails on my machine because text placement is slightly offset 14 | 15 | The test suite requires that you have the original Microsoft Arial TTF files 16 | installed on your machine. To verify that this is the case, run `fc-match 17 | 'Arial,Helvetica,Helvetica Neue:style=Regular,Roman'` and check that it returns 18 | the correct 'arial.ttf' file. 19 | 20 | 21 | -------------------------------------------------------------------------------- /doc/figures/quickstart1.clp: -------------------------------------------------------------------------------- 1 | lines { 2 | data-x: list(100 200 300 400 500 600 700 800 900); 3 | data-y: list(1.2 1.8 1.3 1.6 1.5 1.3 1.8 1.9 2.0); 4 | limit-y: 0 3; 5 | limit-x: 0 1000; 6 | marker-shape: pentagon; 7 | marker-size: 8pt; 8 | } 9 | -------------------------------------------------------------------------------- /doc/figures/quickstart1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/figures/quickstart2.clp: -------------------------------------------------------------------------------- 1 | axes { 2 | limit-y: 0 3; 3 | limit-x: 0 1000; 4 | label-format-x: scientific(); 5 | label-placement-x: linear-interval(100 100 900); 6 | } 7 | 8 | lines { 9 | data-x: list(100 200 300 400 500 600 700 800 900); 10 | data-y: list(1.2 1.8 1.3 1.6 1.5 1.3 1.8 1.9 2.0); 11 | limit-y: 0 3; 12 | limit-x: 0 1000; 13 | marker-shape: pentagon; 14 | marker-size: 8pt; 15 | } 16 | -------------------------------------------------------------------------------- /doc/figures/quickstart3.clp: -------------------------------------------------------------------------------- 1 | axes { 2 | limit-y: 0 3; 3 | limit-x: 0 1000; 4 | label-format-x: scientific(); 5 | label-placement-x: linear-interval(100 100 900); 6 | } 7 | 8 | lines { 9 | data-x: list(100 200 300 400 500 600 700 800 900); 10 | data-y: list(1.2 1.8 1.3 1.6 1.5 1.3 1.8 1.9 2.0); 11 | limit-y: 0 3; 12 | limit-x: 0 1000; 13 | marker-shape: pentagon; 14 | marker-size: 8pt; 15 | } 16 | 17 | legend { 18 | position: bottom left; 19 | 20 | item { 21 | label: "Example Data"; 22 | marker-shape: pentagon; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /doc/frontpage.yaml: -------------------------------------------------------------------------------- 1 | url: / 2 | file: frontpage.md 3 | title: "clip - The command line illustration processor" 4 | -------------------------------------------------------------------------------- /doc/installation.md: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | clip is written in C++. You can either install a binary release or compile 5 | from source. Once the installation is complete, you will have a `clip` binary 6 | on your system. 7 | 8 | You can find the complete [source code on Github](http://github.com/asmuth/clip) 9 | 10 | 11 | ### Compile from source 12 | 13 | To build clip, you need an up-to-date C++ compiler, cmake, libharfbuzz and 14 | libfreetype. To install these dependencies, run the following command: 15 | 16 | # Ubuntu 17 | $ apt-get install cmake libfreetype6-dev libharfbuzz-dev libfribidi-dev libcairo2-dev libfmt-dev 18 | 19 | # Fedora 20 | $ dnf install cmake freetype-devel harfbuzz-devel fribidi-devel cairo-devel fmt-devel 21 | 22 | # OSX 23 | $ brew install cmake freetype harfbuzz fribidi cairo cppformat 24 | 25 | To compile `clip`, Run: 26 | 27 | $ git clone git@github.com:asmuth/clip.git 28 | $ cd clip 29 | $ cmake . 30 | $ make -j 31 | 32 | To install the `clip` binary into your system, run `make install`: 33 | 34 | $ make install 35 | 36 | To run the test suite, run `make test`: 37 | 38 | $ make test 39 | 40 | -------------------------------------------------------------------------------- /doc/license.md: -------------------------------------------------------------------------------- 1 | License 2 | ======= 3 | 4 | clip -- Open-Source Data Visualization Toolkit 5 | https://clip.org 6 | 7 | Copyright (c) 2018, Paul Asmuth, Laura Schlimmer 8 | All rights reserved. 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | -------------------------------------------------------------------------------- /doc/plot/color-maps.md: -------------------------------------------------------------------------------- 1 | Color Maps 2 | ========== 3 | 4 | The `` setting allows you to map input data to colors. These are the 5 | currently implemented mapping methods: 6 | 7 | - `steps` -- Map values in [0..1] to a set of discrete colors 8 | - `gradient` -- Map values in [0..1] to a linear color gradient 9 | 10 | ### Syntax: 11 | 12 | ;; a 'step' color map 13 | (steps ( )...) 14 | 15 | ;; a 'gradient' color map 16 | (gradient ( )...) 17 | 18 | 19 | ### Example 20 | 21 | Below you can see simple scatter plot that uses a red to blue color map to display a third 22 | data dimension. The full source for this example is at: 23 | [`examples/charts-scientific/scatterplot_colors`](/examples/charts-scientific/scatterplot_colors) 24 | 25 | [![scatterplot_colors.svg](/examples/charts-scientific/scatterplot_colors.svg)](/examples/charts-scientific/scatterplot_colors) 26 | 27 | The color map specification used in the example is: 28 | 29 | ;; gradient from gray to black 30 | color-map (gradient (0 #aaa) (1.0 #000)) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /doc/plot/grid.yaml: -------------------------------------------------------------------------------- 1 | title: plot/grid 2 | tpl: cmdref 3 | name: grid 4 | desc: The `plot/grid` element draws a background grid. 5 | 6 | properties: 7 | - title: "Grid Options" 8 | anchor: grid-options 9 | properties: 10 | 11 | 12 | arguments: 13 | 14 | - name: tick-placement-x 15 | desc: | 16 | The 'tick-placement-x' option controls the x grid placement. 17 | desc_code: | 18 | tick-placement-x 19 | examples: | 20 | ;; subdivide the axis with 10 tick-placement 21 | 22 | - name: tick-placement-y 23 | desc: | 24 | The 'tick-placement-y' option controls the y grid placement. 25 | desc_code: | 26 | tick-placement-y 27 | examples: | 28 | ;; subdivide the axis with 10 tick-placement 29 | 30 | - name: stroke-style 31 | type: stroke_style 32 | desc: Set the grid's stroke style. 33 | 34 | - name: stroke-width 35 | type: stroke_width 36 | desc: Set the grid's stroke width. 37 | 38 | - name: stroke-color 39 | type: color 40 | desc: Set the grid's stroke color. 41 | 42 | - name: color 43 | alias: stroke-color 44 | 45 | - include: types/scale_args 46 | -------------------------------------------------------------------------------- /doc/plot/labels.yaml: -------------------------------------------------------------------------------- 1 | title: Text Labels 2 | tpl: cmdref 3 | name: labels 4 | desc: | 5 | The `labels` command takes an input data table, transforms it according 6 | to a user-provided scale configuration and then plots the data as text labels. 7 | 8 | 9 | arguments: 10 | - name: data 11 | type: dataset 12 | 13 | - name: data-format 14 | type: dataset-format 15 | 16 | - name: data-x 17 | type: dataset-x 18 | 19 | - name: data-y 20 | type: dataset-y 21 | 22 | - name: labels 23 | type: dataset_string 24 | desc: | 25 | Set the labels dataset. A label will be drawn for each 26 | point in the dataset at the corresponding (x, y) coordinate. The number of 27 | entries in the 'labels' dataset must match the number of entries in the 28 | 'x' and 'y' datasets exactly. 29 | 30 | - name: label-font-size 31 | type: font_size 32 | desc: Set the label font size. 33 | 34 | - name: label-color 35 | type: color 36 | desc: Set the label color. 37 | 38 | - name: label-padding 39 | type: padding 40 | desc: Set the label padding/spacing. 41 | 42 | - include: types/scale_args 43 | 44 | examples: 45 | - charts-scientific/scatterplot_with_labels 46 | -------------------------------------------------------------------------------- /doc/plot/size-map.md: -------------------------------------------------------------------------------- 1 | Mapping input data to typographic units 2 | --------------------------------------- 3 | 4 | Sometimes you may want to map input data to typographic units. Once instance where 5 | this is useful is when creating a scatterplot where the point size depends on 6 | some input datum. Mapping from input data to typographic units is accomplished 7 | using the `` construct. The following mappings are currently 8 | supported: 9 | 10 | ;; map a value in the range [0..1] linearly to min..max 11 | (linear ) 12 | 13 | #### Examples 14 | 15 | ;; map 0..1 to 12pt..20pt 16 | (linear 12pt 20pt) 17 | 18 | -------------------------------------------------------------------------------- /doc/plot/types/dataset-format.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}}: ; 3 | desc: | 4 | Explicitly set the dataset format. This is usually not required, since the 5 | format should, in most cases, be detected automatically. 6 | examples: | 7 | // set the format to CSV 8 | {{name}}: csv; 9 | 10 | // set the format to geojson 11 | {{name}}: geojson; 12 | -------------------------------------------------------------------------------- /doc/plot/types/dataset-ref.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}}: ; 3 | {{name}}: list(...); 4 | examples: | 5 | ;; reference the "mycolumn" column (CSV) 6 | {{name}}: mycolumn; 7 | 8 | ;; list of static values 9 | {{name}}: list(10 20 30); 10 | -------------------------------------------------------------------------------- /doc/plot/types/dataset-x.yaml: -------------------------------------------------------------------------------- 1 | name: data-x 2 | desc: 3 | This parameter controls how the X position of geometry is retrieved from the 4 | dataset. For CSV files, the parameter controls the name of the column that 5 | is displayed on the X axis. The default value is `"x"`. 6 | You can also use this parameter to declare an "inline" data list. 7 | desc_code: | 8 | data-x: ; 9 | data-x: list(...); 10 | examples: | 11 | // reference the "mycolumn" column 12 | data-x: mycolumn; 13 | 14 | // list of static values 15 | data-x: list(10 20 30); 16 | -------------------------------------------------------------------------------- /doc/plot/types/dataset-y.yaml: -------------------------------------------------------------------------------- 1 | name: data-y 2 | desc: | 3 | This parameter controls how the Y position of geometry is retrieved from the 4 | dataset. For CSV files, the parameter controls the name of the column that 5 | is displayed on the Y axis. The default value is `"y"`. 6 | You can also use this parameter to declare an "inline" data list. 7 | desc_code: | 8 | data-y: ; 9 | data-y: list(...); 10 | examples: | 11 | // reference the "mycolumn" column 12 | data-y: mycolumn; 13 | 14 | // list of static values 15 | data-y: list(10 20 30); 16 | -------------------------------------------------------------------------------- /doc/plot/types/dataset.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}}: ; 3 | desc: | 4 | Set the dataset for the current element. The dataset should be a valid CSV 5 | (RFC4180) or GeoJSON file. 6 | examples: | 7 | // load a csv file 8 | {{name}}: "myfile.csv"; 9 | 10 | // load a geojson file 11 | {{name}}: "myfile.geojson"; 12 | -------------------------------------------------------------------------------- /doc/plot/types/dataset_ref.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} 3 | examples: | 4 | ;; load a csv file 5 | {{name}} "myfile.csv" 6 | 7 | ;; load a geojson file 8 | {{name}} "myfile.geojson" 9 | -------------------------------------------------------------------------------- /doc/plot/types/dataset_string.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} (...) 3 | {{name}} (csv ) 4 | examples: | 5 | ;; list of static values 6 | {{name}} ("A" "B" "C") 7 | 8 | ;; load a csv file 9 | {{name}} (csv myfile.csv mycolumn) 10 | -------------------------------------------------------------------------------- /doc/plot/types/label_attach.yaml: -------------------------------------------------------------------------------- 1 | desc_append: | 2 | The label 'attachment' controls how labels are oriented when placing them on the 3 | axis. Useful in conjunction with the `label-rotate` option. 4 | desc_code: | 5 | label-attach [top|right|bottom|left] 6 | examples: | 7 | ;; set label attach to left 8 | label-attach left 9 | -------------------------------------------------------------------------------- /doc/plot/types/label_format.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | labels 3 | examples: | 4 | ;; use scientific labels for the top/bottom axes 5 | label-format (scientific) 6 | -------------------------------------------------------------------------------- /doc/plot/types/label_offset.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Controls to which side of the axis the labels are placed. Value is 3 | clamped to [-1, 1]. 4 | desc_code: | 5 | label-offset 6 | examples: | 7 | ;; center the labels 8 | label-offset 0 9 | -------------------------------------------------------------------------------- /doc/plot/types/label_padding.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Set the label padding/spacing. See the [measure](#FIXME) page for more details on valid values. 3 | desc_code: | 4 | label-padding 5 | examples: | 6 | ;; set the label padding to 2em 7 | label-padding 2em 8 | -------------------------------------------------------------------------------- /doc/plot/types/label_placement.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | label-placement 3 | examples: | 4 | ;; subdivide the axis with 10 label-placement 5 | -------------------------------------------------------------------------------- /doc/plot/types/label_rotate.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Rotate the labels. Value is in degrees clockwise. 3 | desc_code: | 4 | label-rotate 5 | examples: | 6 | ;; rotate the label by 45deg clockwise 7 | label-rotate 45 8 | -------------------------------------------------------------------------------- /doc/plot/types/limit-max.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} 3 | examples: | 4 | ;; set the upper limit to 20 5 | {{name}} 20 6 | -------------------------------------------------------------------------------- /doc/plot/types/limit.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} ( 3 | examples: | 4 | ;; set the lower limit to 2 5 | {{name}} 2 6 | -------------------------------------------------------------------------------- /doc/plot/types/padding.yaml: -------------------------------------------------------------------------------- 1 | desc_append: | 2 | See the [measure](#FIXME) page for more details on valid values. 3 | desc_code: | 4 | {{name}} 5 | examples: | 6 | ;; set the padding to 2em 7 | {{name}} 2em 8 | -------------------------------------------------------------------------------- /doc/plot/types/scale.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} ([linear] [log] [logarithmic] [invert] [inverted]) 3 | desc_detail: | 4 | List of scale types: 5 | 6 | - `linear` - Standard linear scale 7 | - `log`, `logarithmic` - Logarithmic (log10) scale 8 | - `invert`, `inverted` - Flip the scale 9 | 10 | examples: | 11 | ;; set the scale to logarithmic mode 12 | {{name}} (log) 13 | 14 | ;; set the scale to inverted mode 15 | {{name}} (invert) 16 | -------------------------------------------------------------------------------- /doc/plot/types/scale_args.yaml: -------------------------------------------------------------------------------- 1 | arguments: 2 | 3 | - name: scale-x 4 | type: scale 5 | desc: Set the type of the 'x' (horizontal) scale. 6 | 7 | - name: scale-y 8 | type: scale 9 | desc: Set the type of the 'y' (vertical) scale. 10 | 11 | - name: limit-x 12 | type: limit 13 | desc: Set the limits (minimum and maximum values) for the 'x' (horizontal) scale. 14 | 15 | - name: limit-x-min 16 | type: limit_min 17 | desc: Set the minimum value (lower limit) for the 'x' (horizontal) scale. 18 | 19 | - name: limit-x-max 20 | type: limit-max 21 | desc: Set the maximum value (upper limit) for the 'x' (horizontal) scale. 22 | 23 | - name: limit-y 24 | type: limit 25 | desc: Set the limits (minimum and maximum values) for the 'y' (vertical) scale. 26 | 27 | - name: limit-y-min 28 | type: limit_min 29 | desc: Set the minimum value (lower limit) for the 'y' (vertical) scale. 30 | 31 | - name: limit-y-max 32 | type: limit-max 33 | desc: Set the maximum value (upper limit) for the 'y' (vertical) scale. 34 | -------------------------------------------------------------------------------- /doc/plot/types/shape.yaml: -------------------------------------------------------------------------------- 1 | desc: Set the marker/point shape. 2 | desc_code: | 3 | shape () 4 | examples: | 5 | ;; set marker shape to 'hexagon' 6 | shape (hexagon) 7 | -------------------------------------------------------------------------------- /doc/plot/types/tick_length.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Controls the length of the ticks 3 | desc_code: | 4 | tick-length 5 | examples: | 6 | ;; set tick length to 1em 7 | ticks-length 1em 8 | -------------------------------------------------------------------------------- /doc/plot/types/tick_offset.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Controls to which side of the axis the ticks are drawn. Value is 3 | clamped to [-1, 1]. 4 | desc_code: | 5 | tick-offset 6 | examples: | 7 | ;; center the ticks 8 | ticks-offset 0 9 | -------------------------------------------------------------------------------- /doc/plot/types/tick_placement.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | The 'tick-placement' option controls where on the axis the "ticks" are 3 | placed. 4 | desc_code: | 5 | tick-placement 6 | examples: | 7 | ;; subdivide the axis into 10 parts 8 | -------------------------------------------------------------------------------- /doc/plot/types/title.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Set the axis title 3 | desc_code: | 4 | title 5 | examples: | 6 | ;; set the axis title to "Time" 7 | title "Time" 8 | -------------------------------------------------------------------------------- /doc/plot/types/title_offset.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Controls to which side of the axis the title is placed. Value is 3 | clamped to [-1, 1]. 4 | desc_code: | 5 | title-offset <value> 6 | examples: | 7 | ;; center the title 8 | title-offset 0 9 | -------------------------------------------------------------------------------- /doc/plot/types/title_padding.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Set the title padding/spacing. See the [measure](#FIXME) page for more details on valid values. 3 | desc_code: | 4 | title-padding <measure> 5 | examples: | 6 | ;; set the title padding to 2em 7 | title-padding 2em 8 | -------------------------------------------------------------------------------- /doc/plot/types/title_rotate.yaml: -------------------------------------------------------------------------------- 1 | desc: | 2 | Rotate the title. Value is in degrees clockwise. 3 | desc_code: | 4 | title-rotate <value> 5 | examples: | 6 | ;; rotate the title by 45deg clockwise 7 | title-rotate 45 8 | -------------------------------------------------------------------------------- /doc/reference.md: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | 4 | This page lists all available configuration options grouped by the scope ("element") 5 | in which they are defined. Please follow the respective links for more details 6 | on individual configuration options. 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/support.md: -------------------------------------------------------------------------------- 1 | Support 2 | ======= 3 | 4 | There are various ways to get support for clip: 5 | 6 | + [The clip Google Group](http://groups.google.com/group/clip) 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/types/color.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} <color> 3 | examples: | 4 | ;; set the color to grey 5 | {{name}} #eee 6 | 7 | ;; set the color to red, 50% transparent 8 | {{name}} (rgba 1 0 0 .5) 9 | -------------------------------------------------------------------------------- /doc/types/font_size.yaml: -------------------------------------------------------------------------------- 1 | desc_append: | 2 | See the [measure](#FIXME) page for more details on valid values. 3 | desc_code: | 4 | {{name}} <measure> 5 | examples: | 6 | ;; set the font size to 14pt 7 | {{name}} 14pt 8 | -------------------------------------------------------------------------------- /doc/types/size.yaml: -------------------------------------------------------------------------------- 1 | desc_code: | 2 | {{name}} <measure> 3 | examples: | 4 | ;; set size to 2pt 5 | {{name}} 2pt 6 | -------------------------------------------------------------------------------- /doc/types/stroke_style.yaml: -------------------------------------------------------------------------------- 1 | desc_append: See the [stroke-style](#FIXME) page for more details on valid values. 2 | desc_code: | 3 | {{name}} (<stroke-style>) 4 | examples: | 5 | ;; set the stroke to dashed 6 | {{name}} dashed 7 | -------------------------------------------------------------------------------- /doc/types/stroke_width.yaml: -------------------------------------------------------------------------------- 1 | desc_append: | 2 | See the [Typographic Units](#FIXME) page for more details on valid values. 3 | desc_code: | 4 | {{name}} <measure> 5 | examples: | 6 | ;; set the stroke width to 2pt 7 | {{name}} 2pt 8 | -------------------------------------------------------------------------------- /doc/typographic.md: -------------------------------------------------------------------------------- 1 | Typographic Units 2 | ================= 3 | 4 | A number of options take a typographic unit as an argument. These options are 5 | marked with the type `<measure>`. 6 | 7 | The following typographic units are currently accepted. Users are encouraged to 8 | specify typographic measurements using the "em" or "pt" units. Doing so will 9 | allow you to scale the output resolution of the chart using the global `dpi` 10 | option. 11 | 12 | - `px` – Pixels 13 | - `mm` – Millimeters 14 | - `pt` – Typographic points 15 | - `em` – Typographic "em" size 16 | - `%` – Relative to the enclosing element 17 | 18 | #### Examples 19 | 20 | ;; 10 pixels 21 | 10px 22 | 23 | ;; 40mm 24 | 40mm 25 | 26 | ;; 16 points 27 | 16pt 28 | 29 | ;; 2 "em" 30 | 2em 31 | 32 | ;; 50% of the parent 33 | 50% 34 | -------------------------------------------------------------------------------- /doc/web/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /doc/web/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ue 3 | 4 | if [[ ! $# -eq 2 ]]; then 5 | echo "usage: $0 <version> <output_dir>" >&2 6 | exit 1 7 | fi 8 | 9 | export CLIP_VERSION="$1" 10 | export output_dir="$(readlink -f $2)" 11 | 12 | if [[ ! -d "${output_dir}" ]]; then 13 | echo "error: directory does not exist: ${output_dir}" >&2 14 | exit 1 15 | fi 16 | 17 | cd "$(dirname "$0")/../" 18 | 19 | cp web/documentation.css "${output_dir}" 20 | cp logo.svg "${output_dir}" 21 | cp web/redirects.txt "${output_dir}/_redirects" 22 | cp web/favicon.ico "${output_dir}" 23 | mkdir -p "${output_dir}/figures" 24 | cp figures/*.svg "${output_dir}/figures/" 25 | ./web/build_pages.py 26 | ./web/build_examples.py 27 | -------------------------------------------------------------------------------- /doc/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/doc/web/favicon.ico -------------------------------------------------------------------------------- /doc/web/requirements.txt: -------------------------------------------------------------------------------- 1 | pystache 2 | pyyaml 3 | markdown 4 | -------------------------------------------------------------------------------- /doc/web/runtime.txt: -------------------------------------------------------------------------------- 1 | 3.6 2 | -------------------------------------------------------------------------------- /extra/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/extra/.gitignore -------------------------------------------------------------------------------- /src/arrows.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <unordered_map> 16 | 17 | 18 | #include "graphics/color.h" 19 | #include "graphics/draw.h" 20 | #include "graphics/geometry.h" 21 | #include "return_code.h" 22 | #include "sexpr.h" 23 | 24 | namespace clip { 25 | 26 | using Arrow = std::function< 27 | ReturnCode ( 28 | Context* ctx, 29 | const Point& from, 30 | const Point& to, 31 | const Number& size, 32 | const Color& color)>; 33 | 34 | Arrow arrow_create_default(); 35 | 36 | } // namespace clip 37 | 38 | -------------------------------------------------------------------------------- /src/color_map.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "graphics/color.h" 16 | #include "return_code.h" 17 | 18 | namespace clip { 19 | 20 | using ColorMap = std::function<ReturnCode (const std::string& v, Color* c)>; 21 | 22 | ColorMap color_map_gradient(std::vector<std::pair<double, Color>> gradient); 23 | 24 | ColorMap color_map_steps(std::vector<std::pair<double, Color>> steps); 25 | 26 | } // namespace clip 27 | 28 | -------------------------------------------------------------------------------- /src/color_palette.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "graphics/color.h" 16 | #include "return_code.h" 17 | 18 | #include <vector> 19 | 20 | namespace clip { 21 | 22 | using ColorPalette = std::vector<Color>; 23 | 24 | ColorPalette color_palette_default(); 25 | 26 | ReturnCode color_palette_default(const std::string& name, ColorPalette* colors); 27 | 28 | } // namespace clip 29 | -------------------------------------------------------------------------------- /src/config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine01 CLIP_TEXT_ENABLE_BIDI 2 | #define CLIP_TEXT_BACKEND "${CLIP_TEXT_BACKEND}" 3 | #define CLIP_VERSION "${PROJECT_VERSION}" 4 | -------------------------------------------------------------------------------- /src/context.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "context.h" 15 | #include "sexpr_conv.h" 16 | #include "sexpr_util.h" 17 | #include "typographic_reader.h" 18 | #include "color_reader.h" 19 | #include "style_reader.h" 20 | 21 | using namespace std::placeholders; 22 | 23 | namespace clip { 24 | 25 | Context::Context() : 26 | layer(new Layer()), 27 | font_defaults(true) {} 28 | 29 | ReturnCode context_setup_defaults(Context* ctx) { 30 | return layer_create(ctx, &ctx->layer); 31 | } 32 | 33 | } // namespace clip 34 | 35 | -------------------------------------------------------------------------------- /src/context.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "return_code.h" 16 | #include "graphics/draw.h" 17 | #include "graphics/geometry.h" 18 | #include "color_palette.h" 19 | #include "scale.h" 20 | #include "layer.h" 21 | 22 | namespace clip { 23 | 24 | struct Context { 25 | Context(); 26 | std::unique_ptr<Layer> layer; 27 | bool font_defaults; 28 | std::vector<std::string> font_load; 29 | }; 30 | 31 | ReturnCode context_setup_defaults(Context* ctx); 32 | 33 | } // namespace clip 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/data_impl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | 16 | namespace clip { 17 | 18 | template <typename T> 19 | ReturnCode data_load_as( 20 | const Expr* expr, 21 | std::function<ReturnCode (const std::string&, T*)> conv, 22 | std::vector<T>* dst) { 23 | std::vector<std::string> data; 24 | if (auto rc = data_load_strings(expr, &data); !rc) { 25 | return rc; 26 | } 27 | 28 | for (const auto& d : data) { 29 | T v; 30 | if (auto rc = conv(d, &v); !rc) { 31 | return rc; 32 | } 33 | 34 | dst->emplace_back(std::move(v)); 35 | } 36 | 37 | return OK; 38 | } 39 | 40 | } // namespace clip 41 | 42 | -------------------------------------------------------------------------------- /src/draw.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "draw.h" 15 | #include "draw/text.h" 16 | #include "draw/rectangle.h" 17 | #include "sexpr_util.h" 18 | 19 | using namespace std::placeholders; 20 | 21 | namespace clip { 22 | 23 | ReturnCode draw_eval( 24 | Context* ctx, 25 | const Expr* expr) { 26 | const auto& layer = *layer_get(ctx); 27 | 28 | ExprStorage unparsed; 29 | return expr_walk_map(expr, nullptr, { 30 | {"text", std::bind(&draw::text_eval, ctx, _1)}, 31 | {"rectangle", std::bind(&draw::rectangle, ctx, _1)}, 32 | }); 33 | 34 | return OK; 35 | } 36 | 37 | } // namespace clip 38 | 39 | -------------------------------------------------------------------------------- /src/draw.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | #include "sexpr.h" 17 | #include "return_code.h" 18 | 19 | namespace clip { 20 | 21 | ReturnCode draw_eval( 22 | Context* ctx, 23 | const Expr* expr); 24 | 25 | } // namespace clip 26 | 27 | -------------------------------------------------------------------------------- /src/draw/path.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "path.h" 15 | #include "style_util.h" 16 | 17 | namespace clip::draw { 18 | 19 | ReturnCode path(const path_op& op, Layer* layer) { 20 | DrawCommand shape; 21 | shape.path = op.path; 22 | shape.style = op.style; 23 | 24 | if (!style_is_visible(shape.style)) { 25 | shape.style = layer->draw_default_style; 26 | } 27 | 28 | layer->drawlist.emplace_back(std::move(shape)); 29 | return OK; 30 | } 31 | 32 | } // namespace clip::draw 33 | 34 | -------------------------------------------------------------------------------- /src/draw/path.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <stdlib.h> 16 | #include <string> 17 | #include <vector> 18 | 19 | #include "layer.h" 20 | #include "graphics/path.h" 21 | #include "style.h" 22 | 23 | namespace clip::draw { 24 | 25 | struct path_op { 26 | Path path; 27 | draw_style::compound style; 28 | Option<AntialiasingMode> antialiasing_mode; 29 | }; 30 | 31 | /** 32 | * Draw a path 33 | */ 34 | ReturnCode path(const path_op& op, Layer* l); 35 | 36 | } // namespace clip::draw 37 | 38 | -------------------------------------------------------------------------------- /src/draw/rectangle.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | 17 | namespace clip::draw { 18 | 19 | ReturnCode rectangle( 20 | Context* ctx, 21 | const Expr* expr); 22 | 23 | } // namespace clip::elements::plot::points 24 | 25 | -------------------------------------------------------------------------------- /src/draw/text.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | 17 | namespace clip::draw { 18 | 19 | struct TextPlacement { 20 | vec2 position; 21 | HAlign align_x; 22 | VAlign align_y; 23 | }; 24 | 25 | struct text_op { 26 | std::string text; 27 | TextPlacement placement; 28 | TextStyle text_style; 29 | draw_style::compound draw_style; 30 | Option<mat3> transform; 31 | }; 32 | 33 | ReturnCode text( 34 | Context* ctx, 35 | const text_op& op); 36 | 37 | // DEPRECATED 38 | ReturnCode text( 39 | Context* ctx, 40 | const std::string& text, 41 | const TextPlacement& placement, 42 | TextStyle style); 43 | 44 | ReturnCode text_eval( 45 | Context* ctx, 46 | const Expr* expr); 47 | 48 | } // namespace clip::draw 49 | 50 | -------------------------------------------------------------------------------- /src/eval.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | #include "sexpr.h" 17 | #include "return_code.h" 18 | 19 | namespace clip { 20 | 21 | enum class OutputFormat { SVG, PNG }; 22 | 23 | ReturnCode eval( 24 | Context* ctx, 25 | const Expr* expr); 26 | 27 | ReturnCode eval( 28 | Context* ctx, 29 | const std::string& input); 30 | 31 | } // namespace clip 32 | 33 | -------------------------------------------------------------------------------- /src/figure/legend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plot/plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode plot_legend( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | } // namespace clip::plotgen 25 | 26 | -------------------------------------------------------------------------------- /src/figure/legend_item.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | #include "marker.h" 17 | 18 | namespace clip::plotgen { 19 | 20 | struct LegendItem { 21 | std::string label; 22 | HAlign label_align; 23 | Number label_margin; 24 | Color label_color; 25 | FontInfo label_font; 26 | Number label_font_size; 27 | Marker marker; 28 | HAlign marker_align; 29 | Number marker_margin; 30 | Color marker_color; 31 | Number marker_size; 32 | }; 33 | 34 | ReturnCode legend_item_configure( 35 | Context* ctx, 36 | const Expr* expr, 37 | LegendItem* config); 38 | 39 | ReturnCode legend_item_calculate_size( 40 | Context* ctx, 41 | LegendItem* config, 42 | double* min_width, 43 | double* min_height); 44 | 45 | ReturnCode legend_item_draw( 46 | Context* ctx, 47 | LegendItem* config, 48 | const Rectangle& bbox); 49 | 50 | } // namespace clip::plotgen 51 | 52 | -------------------------------------------------------------------------------- /src/format.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <unordered_map> 16 | 17 | #include <sexpr.h> 18 | #include "return_code.h" 19 | 20 | namespace clip { 21 | 22 | using Formatter = std::function<std::string (size_t idx, const std::string&)>; 23 | 24 | Formatter format_decimal_fixed(size_t precision); 25 | Formatter format_decimal_scientific(size_t precision); 26 | Formatter format_datetime(const std::string& fmt); 27 | Formatter format_base_fixed(unsigned base, size_t precision); 28 | Formatter format_integer(); 29 | Formatter format_custom(const std::vector<std::string>& values); 30 | Formatter format_noop(); 31 | 32 | ReturnCode format_configure( 33 | const Expr* expr, 34 | Formatter* formatter); 35 | 36 | } // namespace clip 37 | 38 | -------------------------------------------------------------------------------- /src/graphics/brush.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include <iostream> 15 | #include "brush.h" 16 | #include "graphics/draw.h" 17 | 18 | namespace clip { 19 | 20 | } // namespace clip 21 | 22 | -------------------------------------------------------------------------------- /src/graphics/draw.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "context.h" 15 | #include "draw.h" 16 | 17 | namespace clip { 18 | 19 | } // namespace clip 20 | 21 | -------------------------------------------------------------------------------- /src/graphics/export_image.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "export_image.h" 15 | #include "rasterize.h" 16 | 17 | using std::bind; 18 | using namespace std::placeholders; 19 | 20 | namespace clip { 21 | 22 | struct DrawOp { 23 | std::function<ReturnCode (Rasterizer*)> draw_fn; 24 | uint32_t draw_idx; 25 | }; 26 | 27 | ReturnCode page_export_png( 28 | const Page& page, 29 | const DrawCommandList& drawlist, 30 | std::string* buffer) { 31 | Rasterizer rasterizer(page.width, page.height, page.dpi); 32 | rasterizer.clear(page.background_color); 33 | 34 | for (const auto& c : drawlist) { 35 | if (auto rc = rasterizer.drawShape(c.path, c.stroke_style, c.fill_style); !rc) { 36 | return rc; 37 | } 38 | } 39 | 40 | *buffer = rasterizer.to_png(); // TODO 41 | return OK; 42 | } 43 | 44 | } // namespace clip 45 | 46 | -------------------------------------------------------------------------------- /src/graphics/export_image.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <iostream> 16 | #include <sstream> 17 | #include "graphics/draw.h" 18 | #include "utils/outputstream.h" 19 | 20 | namespace clip { 21 | 22 | ReturnCode page_export_png( 23 | const Page& page, 24 | const DrawCommandList& drawlist, 25 | std::string* buffer); 26 | 27 | } // namespace clip 28 | 29 | -------------------------------------------------------------------------------- /src/graphics/export_svg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <iostream> 16 | #include <sstream> 17 | #include "graphics/draw.h" 18 | #include "utils/outputstream.h" 19 | 20 | namespace clip { 21 | 22 | ReturnCode export_svg( 23 | const Layer* layer, 24 | std::string* buffer); 25 | 26 | } // namespace clip 27 | 28 | -------------------------------------------------------------------------------- /src/graphics/font_lookup.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <memory> 16 | #include "return_code.h" 17 | #include "path.h" 18 | #include "units.h" 19 | 20 | namespace clip { 21 | 22 | struct FontStorage; 23 | using FontRef = std::shared_ptr<FontStorage>; 24 | 25 | struct FontInfo { 26 | std::vector<FontRef> fonts; 27 | std::string font_family_css; 28 | double font_weight_css; 29 | }; 30 | 31 | ReturnCode font_load( 32 | const std::string& font_file, 33 | FontRef* font); 34 | 35 | ReturnCode font_load_defaults(FontInfo* font_info); 36 | 37 | ReturnCode font_load_best( 38 | const std::string& font_pattern, 39 | FontInfo* font_info); 40 | 41 | ReturnCode font_get_glyph_path( 42 | FontRef font, 43 | NumberPT font_size, 44 | double dpi, 45 | uint32_t codepoint, 46 | Path* path); 47 | 48 | void* font_get_freetype(FontRef font); 49 | 50 | } // namespace clip 51 | 52 | -------------------------------------------------------------------------------- /src/graphics/png.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <stdlib.h> 16 | #include <string> 17 | #include <vector> 18 | 19 | #include "graphics/image.h" 20 | #include "return_code.h" 21 | 22 | namespace clip { 23 | 24 | Status pngWriteImageFile( 25 | const Image& image, 26 | const std::string& filename); 27 | 28 | } // namespace clip 29 | 30 | -------------------------------------------------------------------------------- /src/graphics/polygon.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <assert.h> 16 | #include <stdlib.h> 17 | #include <stdint.h> 18 | #include <iostream> 19 | #include "geometry.h" 20 | 21 | namespace clip { 22 | 23 | /** 24 | * A polygon in 2D space defined by its vertices. A polygon is always closed; 25 | * for N vertices in the polygon, the polygon has N edges where one edge goes 26 | * from the last vertex in the list to the first vertex in the list. 27 | * 28 | * Note that polygons can be given in clockwise or counter-clockwise winding 29 | * order and that they may or may not self-intersect. Methods that work on 30 | * polygons will usually accept only a subset of these cases. 31 | */ 32 | struct Polygon2 { 33 | std::vector<vec2> vertices; 34 | }; 35 | 36 | std::ostream& operator <<(std::ostream& os, const Polygon2& p); 37 | 38 | } // namespace clip 39 | 40 | -------------------------------------------------------------------------------- /src/graphics/shape_hatch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <unordered_map> 16 | 17 | 18 | #include "graphics/color.h" 19 | #include "graphics/draw.h" 20 | #include "graphics/geometry.h" 21 | #include "return_code.h" 22 | #include "sexpr.h" 23 | 24 | namespace clip { 25 | 26 | /** 27 | * Generate a "hatch" pattern of lines in direction `angle_deg` starting from 28 | * `origin` with successive lines offset by `stride` units perpendicular to 29 | * `angle_deg`. 30 | */ 31 | Path shape_hatch( 32 | const Polygon2& clip, 33 | double angle_deg, 34 | double offset, 35 | double stride, 36 | double width); 37 | 38 | } // namespace clip 39 | 40 | -------------------------------------------------------------------------------- /src/graphics/text_backend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <string> 16 | #include <unordered_map> 17 | #include <functional> 18 | 19 | #include "text.h" 20 | #include "text_layout.h" 21 | 22 | namespace clip::text { 23 | 24 | /** 25 | * Analyze a UTF-8 input string in logical character order and produce a list 26 | * of text runs where each run has the same writing order as well as the bidi 27 | * embedding levels of each text run as defined by unicode. 28 | */ 29 | ReturnCode text_analyze_bidi_line( 30 | const TextSpan* text_begin, 31 | const TextSpan* text_end, 32 | TextDirection text_direction_base, 33 | std::vector<TextSpan>* runs, 34 | std::vector<int>* run_bidi_levels); 35 | 36 | } // namespace clip::text 37 | 38 | -------------------------------------------------------------------------------- /src/graphics/text_backend_freetype.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <string> 16 | #include <unordered_map> 17 | #include <functional> 18 | 19 | #include "text.h" 20 | #include "text_layout.h" 21 | 22 | namespace clip::text::backend_freetype { 23 | 24 | /** 25 | * Analyze a UTF-8 input string in logical character order and produce a list 26 | * of text runs where each run has the same writing order as well as the bidi 27 | * embedding levels of each text run as defined by unicode. 28 | */ 29 | ReturnCode text_analyze_bidi_line( 30 | const TextSpan* text_begin, 31 | const TextSpan* text_end, 32 | TextDirection text_direction_base, 33 | std::vector<TextSpan>* runs, 34 | std::vector<int>* run_bidi_levels); 35 | 36 | } // namespace clip::text::backend_freetype 37 | 38 | -------------------------------------------------------------------------------- /src/graphics/text_support.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <graphics/text_layout.h> 16 | 17 | namespace clip::text { 18 | 19 | /** 20 | * Itemize the spans in a line by text directionality and reorder them into 21 | * "visual order" according to the unicode bidi algorithm. Note that only 22 | * the spans are re-ordered into visual order; text within spans stays in logical 23 | * order. 24 | */ 25 | ReturnCode text_reorder_bidi_line(TextLine* line); 26 | 27 | } // namespace clip::text 28 | 29 | -------------------------------------------------------------------------------- /src/layout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "graphics/geometry.h" 16 | #include "graphics/draw.h" 17 | #include "graphics/measure.h" 18 | 19 | #include <assert.h> 20 | #include <stdlib.h> 21 | #include <stdint.h> 22 | 23 | 24 | namespace clip { 25 | 26 | enum class Position { 27 | RELATIVE, 28 | ABSOLUTE, 29 | TOP, 30 | RIGHT, 31 | BOTTOM, 32 | LEFT 33 | }; 34 | 35 | } // namespace clip 36 | 37 | -------------------------------------------------------------------------------- /src/marker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <unordered_map> 16 | 17 | 18 | #include "graphics/color.h" 19 | #include "graphics/draw.h" 20 | #include "graphics/geometry.h" 21 | #include "return_code.h" 22 | #include "sexpr.h" 23 | 24 | namespace clip { 25 | 26 | using Marker = std::function< 27 | ReturnCode ( 28 | Context* ctx, 29 | const Point& pos, 30 | const Number& size, 31 | const Color& color)>; 32 | 33 | Marker marker_create_circle(double border_width); 34 | Marker marker_create_disk(); 35 | Marker marker_create_unicode(const std::string& u); 36 | 37 | ReturnCode marker_configure( 38 | const Expr* expr, 39 | Marker* marker); 40 | 41 | ReturnCode marker_configure_list( 42 | const Expr* expr, 43 | std::vector<Marker>* markers); 44 | 45 | } // namespace clip 46 | 47 | -------------------------------------------------------------------------------- /src/plot/areas.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode areas_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode areas_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/axis.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen{ 18 | 19 | ReturnCode plot_axis( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode plot_axes( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/bars.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode bars_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode bars_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/errorbars.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode errorbars_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode errorbars_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/grid.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen{ 18 | 19 | ReturnCode plot_grid( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | } // namespace clip::plotgen 25 | 26 | -------------------------------------------------------------------------------- /src/plot/labels.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode labels_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode labels_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/lines.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode lines_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode lines_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/plotgen.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "context.h" 16 | #include "sexpr.h" 17 | #include "return_code.h" 18 | 19 | namespace clip { 20 | 21 | struct PlotConfig { 22 | ScaleConfig scale_x; 23 | ScaleConfig scale_y; 24 | 25 | std::array<Number, 4> margins; 26 | std::vector<Rectangle> layout_stack; 27 | }; 28 | 29 | ReturnCode plot_eval( 30 | Context* ctx, 31 | const Expr* expr); 32 | 33 | Rectangle plot_get_clip(const PlotConfig* plot, const Layer* layer); 34 | 35 | ReturnCode plot_set_background( 36 | Context* ctx, 37 | const PlotConfig* plot, 38 | const Expr* expr); 39 | 40 | } // namespace clip 41 | 42 | -------------------------------------------------------------------------------- /src/plot/points.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode points_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode points_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/polygons.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode polygons_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode polygons_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | 30 | } // namespace clip::plotgen 31 | 32 | -------------------------------------------------------------------------------- /src/plot/rectangles.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode rectangles_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode rectangles_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/plot/vectors.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "plotgen.h" 16 | 17 | namespace clip::plotgen { 18 | 19 | ReturnCode vectors_draw( 20 | Context* ctx, 21 | PlotConfig* plot, 22 | const Expr* expr); 23 | 24 | ReturnCode vectors_autorange( 25 | Context* ctx, 26 | PlotConfig* plot, 27 | const Expr* expr); 28 | 29 | } // namespace clip::plotgen 30 | 31 | -------------------------------------------------------------------------------- /src/sexpr_parser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <atomic> 16 | #include <memory> 17 | #include <string> 18 | #include "sexpr.h" 19 | #include "return_code.h" 20 | 21 | namespace clip { 22 | 23 | ReturnCode expr_parse( 24 | const char* input, 25 | size_t input_len, 26 | ExprStorage* expr); 27 | 28 | } // namespace clip 29 | 30 | -------------------------------------------------------------------------------- /src/style.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "style.h" 15 | #include "graphics/brush.h" 16 | #include "graphics/shape_hatch.h" 17 | 18 | namespace clip { 19 | 20 | FillStyle::FillStyle() : 21 | hatch(false), 22 | hatch_angle_deg(0), 23 | hatch_offset(0), 24 | hatch_stride(0), 25 | hatch_width(0) {} 26 | 27 | StrokeStyle::StrokeStyle() : 28 | color(Color::fromRGB(0, 0, 0)), 29 | dash_type(SOLID) {} 30 | 31 | } // namespace clip 32 | 33 | -------------------------------------------------------------------------------- /src/style_util.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "style_util.h" 15 | 16 | #include <functional> 17 | 18 | namespace clip { 19 | 20 | bool style_is_visible(const draw_style::compound& style) { 21 | return 22 | style.fill_solid.size() > 0 || 23 | style.fill_hatch.size() > 0 || 24 | style.stroke_solid.size() > 0 || 25 | style.stroke_dash.size() > 0; 26 | } 27 | 28 | } // namespace clip 29 | 30 | -------------------------------------------------------------------------------- /src/style_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "style.h" 16 | 17 | namespace clip { 18 | 19 | bool style_is_visible(const draw_style::compound& style); 20 | 21 | } // namespace clip 22 | 23 | -------------------------------------------------------------------------------- /src/typographic_map.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "typographic_map.h" 15 | 16 | namespace clip { 17 | 18 | MeasureMap measure_map_linear(const Measure& min, const Measure& max) { 19 | return [min, max] (const std::string& value, Measure* measure) -> ReturnCode { 20 | double value_num = 0.0; 21 | try { 22 | value_num = std::clamp(std::stod(value), 0.0, 1.0); 23 | } catch (...) { 24 | return errorf( 25 | ERROR, 26 | "invalid data; can't map '{}' to a typographic unit", 27 | value); 28 | } 29 | 30 | *measure = from_unit(double(min) + (double(max) - double(min)) * value_num); 31 | return OK; 32 | }; 33 | } 34 | 35 | } // namespace clip 36 | 37 | -------------------------------------------------------------------------------- /src/typographic_map.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "graphics/measure.h" 16 | #include "graphics/color.h" 17 | #include "return_code.h" 18 | 19 | namespace clip { 20 | 21 | using MeasureMap = std::function<ReturnCode (const std::string& v, Measure* m)>; 22 | 23 | MeasureMap measure_map_linear(const Measure& min, const Measure& max); 24 | 25 | } // namespace clip 26 | 27 | -------------------------------------------------------------------------------- /src/utils/CivilTime_impl.h: -------------------------------------------------------------------------------- 1 | inline constexpr CivilTime::CivilTime() : 2 | year_(0), 3 | month_(0), 4 | day_(0), 5 | hour_(0), 6 | minute_(0), 7 | second_(0), 8 | millisecond_(0), 9 | offset_(0) {} 10 | 11 | inline constexpr CivilTime::CivilTime(std::nullptr_t) : 12 | CivilTime() { 13 | } 14 | 15 | inline constexpr uint16_t CivilTime::year() const { 16 | return year_; 17 | } 18 | 19 | inline constexpr uint8_t CivilTime::month() const { 20 | return month_; 21 | } 22 | 23 | inline constexpr uint8_t CivilTime::day() const { 24 | return day_; 25 | } 26 | 27 | inline constexpr uint8_t CivilTime::hour() const { 28 | return hour_; 29 | } 30 | 31 | inline constexpr uint8_t CivilTime::minute() const { 32 | return minute_; 33 | } 34 | 35 | inline constexpr uint8_t CivilTime::second() const { 36 | return second_; 37 | } 38 | 39 | inline constexpr uint16_t CivilTime::millisecond() const { 40 | return millisecond_; 41 | } 42 | 43 | inline constexpr int32_t CivilTime::offset() const { 44 | return offset_; 45 | } 46 | -------------------------------------------------------------------------------- /src/utils/ISO8601.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth, Laura Schlimmer 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include "stdtypes.h" 16 | #include "option.h" 17 | #include "CivilTime.h" 18 | 19 | class ISO8601 { 20 | public: 21 | 22 | static Option<CivilTime> parse(const String& str); 23 | 24 | static bool isLeapYear(uint16_t year); 25 | 26 | static uint8_t daysInMonth(uint16_t year, uint8_t month); 27 | 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /src/utils/UTF8.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <stdlib.h> 16 | #include <stdint.h> 17 | #include <string> 18 | #include <vector> 19 | #include <locale> 20 | #include "stdtypes.h" 21 | 22 | namespace clip { 23 | 24 | class UTF8 { 25 | public: 26 | 27 | static char32_t nextCodepoint(const char** cur, const char* end); 28 | 29 | static void encodeCodepoint(char32_t codepoint, String* target); 30 | 31 | static bool isValidUTF8(const String& str); 32 | static bool isValidUTF8(const char* str, size_t size); 33 | 34 | }; 35 | 36 | } // namespace clip 37 | -------------------------------------------------------------------------------- /src/utils/algo.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #include "algo.h" 15 | 16 | namespace clip { 17 | 18 | double parse_f64(const std::string& s) { 19 | try { 20 | return std::stod(s); 21 | } catch (...) { 22 | return std::nan(""); 23 | } 24 | } 25 | 26 | } // namespace clip 27 | 28 | -------------------------------------------------------------------------------- /src/utils/csv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <string> 16 | #include <vector> 17 | #include "return_code.h" 18 | 19 | namespace clip { 20 | 21 | using CSVData = std::vector<std::vector<std::string>>; 22 | 23 | // Parse a RFC4180 compliant CSV file 24 | // https://tools.ietf.org/html/rfc4180 25 | ReturnCode csv_parse( 26 | std::string input, 27 | CSVData* output); 28 | 29 | ReturnCode csv_extract_column( 30 | const CSVData& data, 31 | const std::string& column, 32 | std::function<void (const std::string&)> fn); 33 | 34 | } // namespace clip 35 | 36 | -------------------------------------------------------------------------------- /src/utils/geojson.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <string> 16 | #include <vector> 17 | #include "return_code.h" 18 | #include "utils/json.h" 19 | #include "graphics/polygon.h" 20 | 21 | namespace clip { 22 | 23 | struct GeoJSONReader { 24 | std::function<ReturnCode (const vec3*, size_t)> on_points; 25 | std::function<ReturnCode (const PolyLine3*, size_t)> on_lines; 26 | std::function<ReturnCode (const Poly3*, size_t)> on_polygons; 27 | }; 28 | 29 | // Parse a RFC7946 compliant GEOJSON file 30 | // https://tools.ietf.org/html/rfc4180 31 | ReturnCode geojson_read_file( 32 | const std::string& path, 33 | const GeoJSONReader& reader); 34 | 35 | } // namespace clip 36 | 37 | -------------------------------------------------------------------------------- /src/utils/json.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2020 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #pragma once 15 | #include <functional> 16 | #include <memory> 17 | #include <set> 18 | #include <stack> 19 | #include <string> 20 | #include <vector> 21 | #include "return_code.h" 22 | 23 | namespace clip { 24 | 25 | enum TokenType { 26 | JSON_OBJECT_BEGIN, 27 | JSON_OBJECT_END, 28 | JSON_ARRAY_BEGIN, 29 | JSON_ARRAY_END, 30 | JSON_STRING, 31 | JSON_NUMBER, 32 | JSON_TRUE, 33 | JSON_FALSE, 34 | JSON_NULL 35 | }; 36 | 37 | ReturnCode json_parse( 38 | std::istream* input, 39 | TokenType* token_type, 40 | std::string* token_data); 41 | 42 | ReturnCode json_read_array_begin( 43 | std::istream* input); 44 | 45 | ReturnCode json_read_object_begin( 46 | std::istream* input); 47 | 48 | ReturnCode json_read_string( 49 | std::istream* input, 50 | std::string* value); 51 | 52 | ReturnCode json_skip(std::istream* input); 53 | 54 | } // namespace clip 55 | 56 | -------------------------------------------------------------------------------- /src/utils/wallclock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the "clip" project 3 | * Copyright (c) 2018 Paul Asmuth 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | #ifndef _libstx_UTIL_WALLCLOCK_H 15 | #define _libstx_UTIL_WALLCLOCK_H 16 | #include <stdlib.h> 17 | #include <stdint.h> 18 | #include "UnixTime.h" 19 | 20 | class WallClock { 21 | public: 22 | static UnixTime now(); 23 | static uint64_t unixSeconds(); 24 | static uint64_t getUnixMillis(); 25 | static uint64_t unixMillis(); 26 | static uint64_t getUnixMicros(); 27 | static uint64_t unixMicros(); 28 | }; 29 | 30 | class MonotonicClock { 31 | public: 32 | static uint64_t now(); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | *.actual.png 2 | -------------------------------------------------------------------------------- /test/draw/style_default.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | } 8 | -------------------------------------------------------------------------------- /test/draw/style_default.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: hatch; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M73.114 25 L75 26.886 L26.886 75 L25 73.114 M61.801 25 L65.572 25 L25 65.572 L25 61.801 M75 34.428 L75 38.199 L38.199 75 L34.428 75 M50.487 25 L54.258 25 L25 54.258 L25 50.487 M75 45.742 L75 49.513 L49.513 75 L45.742 75 M39.173 25 L42.944 25 L25 42.944 L25 39.173 M75 57.056 L75 60.827 L60.827 75 L57.056 75 M27.860 25 L31.631 25 L25 31.631 L25 27.860 M75 68.369 L75 72.140 L72.140 75 L68.369 75"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch_custom.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: hatch(color(#06c) width(2pt) stride(4pt) angle(45) offset(10pt)); 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch_custom.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M25 45.742 L25 41.971 L58.029 75 L54.258 75 M25 38.199 L25 34.428 L65.572 75 L61.801 75 M25 53.284 L25 49.513 L50.487 75 L46.716 75 M25 30.657 L25 26.886 L73.114 75 L69.343 75 M25 60.827 L25 57.056 L42.944 75 L39.173 75 M26.886 25 L30.657 25 L75 69.343 L75 73.114 M25 68.369 L25 64.598 L35.402 75 L31.631 75 M34.428 25 L38.199 25 L75 61.801 L75 65.572 M41.971 25 L45.742 25 L75 54.258 L75 58.029 M49.513 25 L53.284 25 L75 46.716 L75 50.487 M57.056 25 L60.827 25 L75 39.173 L75 42.944 M64.598 25 L68.369 25 L75 31.631 L75 35.402" fill="#0066cc"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch_zero.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: hatch(width(0) stride(0)); 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_fill_hatch_zero.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d=""/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_fill_multi.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: #000; 8 | fill: hatch(color(#f00)); 9 | } 10 | -------------------------------------------------------------------------------- /test/draw/style_fill_multi.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z"/> 6 | <path d="M73.114 25 L75 26.886 L26.886 75 L25 73.114 M61.801 25 L65.572 25 L25 65.572 L25 61.801 M75 34.428 L75 38.199 L38.199 75 L34.428 75 M50.487 25 L54.258 25 L25 54.258 L25 50.487 M75 45.742 L75 49.513 L49.513 75 L45.742 75 M39.173 25 L42.944 25 L25 42.944 L25 39.173 M75 57.056 L75 60.827 L60.827 75 L57.056 75 M27.860 25 L31.631 25 L25 31.631 L25 27.860 M75 68.369 L75 72.140 L72.140 75 L68.369 75" fill="#ff0000"/> 7 | </svg> 8 | -------------------------------------------------------------------------------- /test/draw/style_fill_solid.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: solid(#06c); 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_fill_solid.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="#0066cc"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_fill_solid_short.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: #0c0; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_fill_solid_short.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="#00cc00"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_short.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | fill: #06c; 8 | stroke: 2pt #000; 9 | } 10 | -------------------------------------------------------------------------------- /test/draw/style_short.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="#0066cc" stroke="#000000" stroke-width="2.667"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_stroke_dash.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: dash; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_stroke_dash.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#000000" stroke-width="1.333" stroke-dasharray="5.333 5.333" stroke-dashoffset="0"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_stroke_dash_custom.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: dash(color(#06c) width(2px) pattern(6px 4px) offset(10px)); 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_stroke_dash_custom.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#0066cc" stroke-width="2" stroke-dasharray="6 4" stroke-dashoffset="10"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_stroke_multi.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: solid(color(#000) width(3pt)); 8 | stroke: dash(color(#fff) width(1pt)); 9 | } 10 | -------------------------------------------------------------------------------- /test/draw/style_stroke_multi.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#000000" stroke-width="4"/> 6 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#ffffff" stroke-width="1.333" stroke-dasharray="5.333 5.333" stroke-dashoffset="0"/> 7 | </svg> 8 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: solid; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#000000" stroke-width="1.333"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid_custom.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: solid(width(5px) color(#000)); 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid_custom.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#000000" stroke-width="5"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid_short.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: 100px 100px; 4 | 5 | rectangle { 6 | size: 50px 50px; 7 | stroke: 3pt #06c; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/style_stroke_solid_short.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 4 | <rect width="100" height="100" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M75 25 L75 75 L25 75 L25 25 Z" fill="none" stroke="#0066cc" stroke-width="4"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/draw/text_basic.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "hello world"; 7 | } 8 | -------------------------------------------------------------------------------- /test/draw/text_color.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "TEST"; 7 | font-size: 48pt; 8 | color: #06c; 9 | } 10 | -------------------------------------------------------------------------------- /test/draw/text_custom_font.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "TEST"; 7 | font: "Roboto Slab"; 8 | font-size: 48pt; 9 | } 10 | -------------------------------------------------------------------------------- /test/draw/text_font_size.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "TEST"; 7 | font-size: 48pt; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/text_position.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "hello world"; 7 | position: 50% 20mm; 8 | } 9 | -------------------------------------------------------------------------------- /test/draw/text_stroke.clp: -------------------------------------------------------------------------------- 1 | class: draw; 2 | dpi: 96; 3 | size: A6*; 4 | 5 | text { 6 | text: "TEST"; 7 | font-size: 48pt; 8 | stroke: 1pt #000; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_basic_areachart.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-y: 0 20000000; 4 | limit-x: 1404278100 1404299700; 5 | 6 | axes { 7 | position: bottom left; 8 | label-format-y: scientific(); 9 | label-format-x: datetime("%H:%M:%S"); 10 | } 11 | 12 | grid { 13 | color: #fff; 14 | } 15 | 16 | areas { 17 | data-x: csv("test/testdata/measurement.csv" time); 18 | data-y: csv("test/testdata/measurement.csv" value1); 19 | color: #888; 20 | } 21 | -------------------------------------------------------------------------------- /test/examples/charts_basic_areas_and_lines.clp: -------------------------------------------------------------------------------- 1 | size: 1200px 480px; 2 | dpi: 96; 3 | limit-y: -50 50; 4 | 5 | axes { 6 | position: bottom top; 7 | limit-x: 0 1; 8 | } 9 | 10 | areas { 11 | data-x: csv("test/testdata/areadata2.csv" x); 12 | data-y: csv("test/testdata/areadata2.csv" z); 13 | data-y-low: csv("test/testdata/areadata2.csv" y); 14 | color: #ccc; 15 | } 16 | 17 | areas { 18 | data-x: csv("test/testdata/areadata2.csv" x); 19 | data-y: csv("test/testdata/areadata2.csv" z2); 20 | data-y-low: csv("test/testdata/areadata2.csv" y2); 21 | color: #888; 22 | } 23 | 24 | lines { 25 | data-x: list(10 20 30 40 50); 26 | data-y: list(1.23 10.32 -6.23 4.43 3.45); 27 | marker-size: 4pt; 28 | } 29 | 30 | legend { 31 | position: bottom right; 32 | item-flow: on; 33 | 34 | item { 35 | label: "Series A"; 36 | color: #ccc; 37 | } 38 | 39 | item { 40 | label: "Series B"; 41 | color: #888; 42 | } 43 | 44 | item { 45 | label: "Combined"; 46 | color: #000; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /test/examples/charts_basic_areas_vertical.clp: -------------------------------------------------------------------------------- 1 | size: 1200px 480px; 2 | dpi: 96; 3 | limit-x: 0 150; 4 | limit-y: 1404278100 1404299700; 5 | 6 | axes { 7 | position: left bottom; 8 | label-format-y: datetime("%H:%M:%S"); 9 | } 10 | 11 | areas { 12 | data-x: csv("test/testdata/measurement.csv" value2); 13 | data-y: csv("test/testdata/measurement.csv" time); 14 | direction: horizontal; 15 | color: #999; 16 | } 17 | -------------------------------------------------------------------------------- /test/examples/charts_basic_barchart_groups.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 512px; 2 | dpi: 240; 3 | scale-x: categorical(A B C D E F); 4 | limit-y: 0 80; 5 | 6 | axes { 7 | label-placement-y: linear-interval(10 10 70); 8 | } 9 | 10 | grid { 11 | color: rgba(0 0 0 0.05); 12 | stroke-style: dashed; 13 | tick-placement-x: none; 14 | } 15 | 16 | bars { 17 | data-x: csv("test/testdata/bardata.csv" var3); 18 | data-y: csv("test/testdata/bardata.csv" var1); 19 | width: 1em; 20 | offset: -.8em; 21 | color: #444; 22 | } 23 | 24 | bars { 25 | data-x: csv("test/testdata/bardata.csv" var3); 26 | data-y: csv("test/testdata/bardata.csv" var2); 27 | width: 1em; 28 | offset: .8em; 29 | color: #999; 30 | } 31 | -------------------------------------------------------------------------------- /test/examples/charts_basic_custom_font.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 512px; 2 | dpi: 240; 3 | font: "Comic Sans MS"; 4 | limit-x: 1404278100 1404299700; 5 | limit-y: 0 120; 6 | 7 | grid { 8 | color: #fff; 9 | } 10 | 11 | axes { 12 | position: bottom left; 13 | label-format-y: fixed(2); 14 | label-format-x: datetime("%H:%M:%S"); 15 | label-placement-x: linear(2400); 16 | label-placement-y: linear(20); 17 | } 18 | 19 | lines { 20 | data-x: csv("test/testdata/measurement.csv" time); 21 | data-y: csv("test/testdata/measurement.csv" value2); 22 | } 23 | 24 | legend { 25 | position: top right; 26 | border: none; 27 | margin: 0.5em; 28 | item-flow: on; 29 | 30 | item { 31 | label: "A very serious measurement"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/examples/charts_basic_demo_timeseries.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 512px; 2 | dpi: 180; 3 | limit-x: 1404278100 1404299700; 4 | limit-y: 6000000 10000000; 5 | 6 | axes { 7 | position: bottom left; 8 | label-format-y: scientific(); 9 | label-format-x: datetime("%H:%M:%S"); 10 | label-placement-x: linear-align(1800); 11 | } 12 | 13 | lines { 14 | data-x: csv("test/testdata/measurement.csv" time); 15 | data-y: csv("test/testdata/measurement.csv" value1); 16 | color: #06c; 17 | } 18 | 19 | legend { 20 | position: top right; 21 | 22 | item { 23 | label: "Random Data"; 24 | color: #06c; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/examples/charts_basic_histogram.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 240; 3 | limit-x: 0 7; 4 | limit-y: 0 10000; 5 | scale-y: log; 6 | 7 | axes { 8 | position: left bottom; 9 | label-placement-x: linear-interval(1 1 6); 10 | } 11 | 12 | bars { 13 | data-x: csv("test/testdata/histogram.csv" var0); 14 | data-y: csv("test/testdata/histogram.csv" var1); 15 | width: 1.8em; 16 | color: #666; 17 | } 18 | -------------------------------------------------------------------------------- /test/examples/charts_basic_linechart_timeseries.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 512px; 2 | dpi: 240; 3 | limit-x: 0 7200; 4 | limit-y: -5 5; 5 | 6 | axes { 7 | position: bottom left; 8 | label-format-y: scientific(); 9 | label-format-x: datetime("%H:%M:%S"); 10 | label-placement-x: linear-interval(900 900 7200); 11 | } 12 | 13 | lines { 14 | data-x: csv("test/testdata/measurement2.csv" time); 15 | data-y: csv("test/testdata/measurement2.csv" value3); 16 | color: #06c; 17 | } 18 | 19 | legend { 20 | position: top right; 21 | 22 | item { 23 | label: "Random Data"; 24 | color: #06c; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/examples/charts_basic_scatterplot.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | limit-x: 0 400; 4 | limit-y: 0 200; 5 | 6 | axes { 7 | position: bottom left; 8 | label-placement-y: subdivide(4); 9 | } 10 | 11 | points { 12 | data-x: csv(test/testdata/gauss2d.csv x); 13 | data-y: csv(test/testdata/gauss2d.csv y); 14 | } 15 | -------------------------------------------------------------------------------- /test/examples/charts_custom_axis_titles.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | limit-x: 1404278100 1404299700; 4 | 5 | axes { 6 | label-format-left: scientific(); 7 | title-left: "Value"; 8 | title-font-size-left: 14pt; 9 | label-format-right: scientific(); 10 | title-right: "Value"; 11 | title-rotate-right: 90; 12 | title-font-size-right: 14pt; 13 | label-format-top: datetime("%H:%M"); 14 | title-top: "Time"; 15 | title-font-size-top: 14pt; 16 | label-format-bottom: datetime("%H:%M"); 17 | title-bottom: "Time"; 18 | title-font-size-bottom: 14pt; 19 | } 20 | 21 | lines { 22 | data-x: csv("test/testdata/measurement.csv" time); 23 | data-y: csv("test/testdata/measurement.csv" value1); 24 | } 25 | -------------------------------------------------------------------------------- /test/examples/charts_custom_custom_color_palette.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | 4 | legend { 5 | 6 | item { 7 | label: "Test Color 1"; 8 | color: 1; 9 | } 10 | 11 | item { 12 | label: "Test Color 2"; 13 | color: 2; 14 | } 15 | 16 | item { 17 | label: "Test Color 3"; 18 | color: 3; 19 | } 20 | 21 | item { 22 | label: "Test Color 4"; 23 | color: 4; 24 | } 25 | 26 | item { 27 | label: "Test Color 5"; 28 | color: 5; 29 | } 30 | 31 | item { 32 | label: "Test Color 6"; 33 | color: 6; 34 | } 35 | 36 | item { 37 | label: "Test Color 7"; 38 | color: 7; 39 | } 40 | 41 | item { 42 | label: "Test Color 8"; 43 | color: 8; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test/examples/charts_custom_inverted_scale.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 800px; 2 | dpi: 240; 3 | scale-y: inverted; 4 | limit-y: 0 140; 5 | limit-x: 1404278100 1404299700; 6 | 7 | axes { 8 | position: bottom left; 9 | label-placement-x: subdivide(6); 10 | label-placement-y: linear-alignat(20 0); 11 | label-format-x: datetime("%H:%M:%S"); 12 | } 13 | 14 | lines { 15 | data-x: csv("test/testdata/measurement.csv" time); 16 | data-y: csv("test/testdata/measurement.csv" value2); 17 | color: #06c; 18 | } 19 | -------------------------------------------------------------------------------- /test/examples/charts_custom_irregular_data.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 800px; 2 | dpi: 240; 3 | limit-x: -12 22; 4 | limit-y: -35 55; 5 | 6 | axes { 7 | position: bottom left; 8 | } 9 | 10 | lines { 11 | data-x: csv("test/testdata/irregular_data1.csv" x); 12 | data-y: csv("test/testdata/irregular_data1.csv" y); 13 | color: 4; 14 | marker-size: 3pt; 15 | } 16 | 17 | lines { 18 | data-x: csv("test/testdata/irregular_data2.csv" x); 19 | data-y: csv("test/testdata/irregular_data2.csv" y); 20 | color: 6; 21 | marker-size: 3pt; 22 | } 23 | 24 | legend { 25 | position: bottom left; 26 | background: #fff; 27 | 28 | item { 29 | label: "Series A"; 30 | color: 4; 31 | } 32 | 33 | item { 34 | label: "Series B"; 35 | color: 6; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/examples/charts_custom_logarithmic_scale.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1200px; 2 | dpi: 240; 3 | limit-x: 1 5; 4 | limit-y: 0 10000; 5 | scale-y: log; 6 | 7 | axes { 8 | label-format-y: base(10); 9 | } 10 | 11 | grid { 12 | color: rgba(0 0 0 0.05); 13 | } 14 | 15 | lines { 16 | data-x: csv("test/testdata/log_example.csv" x); 17 | data-y: csv("test/testdata/log_example.csv" y); 18 | } 19 | -------------------------------------------------------------------------------- /test/examples/charts_custom_rotate_labels.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1200px; 2 | dpi: 240; 3 | limit-x: 1404278100 1404299700; 4 | limit-y: 0 1; 5 | 6 | axes { 7 | label-placement-left: subdivide(4); 8 | label-format-left: scientific(); 9 | label-attach-left: bottom; 10 | label-rotate-left: -90; 11 | label-format-bottom: datetime("%H:%M:%S"); 12 | label-attach-bottom: left; 13 | label-rotate-bottom: 45; 14 | } 15 | 16 | lines { 17 | data-x: csv("test/testdata/measurement.csv" time); 18 | data-y: csv("test/testdata/measurement.csv" value1); 19 | } 20 | -------------------------------------------------------------------------------- /test/examples/charts_custom_text_i18n.clp: -------------------------------------------------------------------------------- 1 | size: 3600px 1920px; 2 | dpi: 400; 3 | 4 | legend { 5 | border: none; 6 | margin: 0; 7 | 8 | item { 9 | label: "北京市 (Beijing)"; 10 | color: #06c; 11 | } 12 | 13 | item { 14 | label: "תל אביב (Tel Aviv)"; 15 | color: #c06; 16 | } 17 | 18 | item { 19 | label: "القاهرة‎ (Cairo)"; 20 | color: #c06; 21 | } 22 | 23 | item { 24 | label: "Москва"; 25 | color: #60c; 26 | } 27 | 28 | item { 29 | label: "東京都 (Tokyo)"; 30 | color: #6c0; 31 | } 32 | 33 | item { 34 | label: "서울 (Seoul)"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/examples/charts_editorial_barchart_horizontal.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 800px; 2 | dpi: 240; 3 | limit-x: 0 24; 4 | scale-y: categorical(csv("test/testdata/gdp_per_capita_2010.csv" country)); 5 | 6 | axes { 7 | position: left; 8 | } 9 | 10 | bars { 11 | data-x: csv("test/testdata/gdp_per_capita_2010.csv" gdp); 12 | data-y: csv("test/testdata/gdp_per_capita_2010.csv" country); 13 | labels: csv("test/testdata/gdp_per_capita_2010.csv" gdp_label); 14 | direction: horizontal; 15 | width: 1.4em; 16 | color: #4c7bb0; 17 | } 18 | -------------------------------------------------------------------------------- /test/examples/charts_editorial_barchart_with_labels.clp: -------------------------------------------------------------------------------- 1 | size: 960px 280px; 2 | dpi: 96; 3 | limit-x: 0 13; 4 | limit-y: 0 23; 5 | 6 | axes { 7 | position: bottom; 8 | label-placement-x: linear-interval(1 1 12); 9 | label-placement-x: linear-interval(1 1 12); 10 | label-format-x: custom("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"); 11 | } 12 | 13 | bars { 14 | data-x: csv("test/testdata/city_temperatures_london.csv" month); 15 | data-y: csv("test/testdata/city_temperatures_london.csv" temperature); 16 | labels: csv("test/testdata/city_temperatures_london.csv" temperature_str); 17 | width: 2em; 18 | color: 2; 19 | } 20 | 21 | legend { 22 | position: top left; 23 | border: none; 24 | 25 | item { 26 | label: "London - Average Monthly Temperature"; 27 | color: 2; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/examples/charts_editorial_chart_i18n.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 800px; 2 | dpi: 240; 3 | limit-y: -15 35; 4 | limit-x: 0.5 12.5; 5 | 6 | axes { 7 | position: bottom left; 8 | label-placement-x: linear-alignat(1 1); 9 | label-format-x: custom("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"); 10 | label-placement-y: linear-interval(5 -10 35); 11 | title-left: "Temperature (°C)"; 12 | title-rotate-left: -90; 13 | } 14 | 15 | lines { 16 | data-x: csv("test/testdata/city_temperatures.csv" month); 17 | data-y: csv("test/testdata/city_temperatures.csv" temp_beijing); 18 | color: #aa4643; 19 | marker-size: 4pt; 20 | } 21 | 22 | lines { 23 | data-x: csv("test/testdata/city_temperatures.csv" month); 24 | data-y: csv("test/testdata/city_temperatures.csv" temp_moscow); 25 | color: #89a54e; 26 | marker-size: 4pt; 27 | } 28 | 29 | lines { 30 | data-x: csv("test/testdata/city_temperatures.csv" month); 31 | data-y: csv("test/testdata/city_temperatures.csv" temp_telaviv); 32 | color: #4572a7; 33 | marker-size: 4pt; 34 | } 35 | 36 | legend { 37 | position: bottom center; 38 | border: none; 39 | margin: 0.5em; 40 | item-flow: on; 41 | 42 | item { 43 | label: "Москва"; 44 | color: #89a54e; 45 | } 46 | 47 | item { 48 | label: "תל אביב"; 49 | color: #4572a7; 50 | } 51 | 52 | item { 53 | label: "北京市"; 54 | color: #aa4643; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /test/examples/charts_editorial_linechart_with_labels.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 800px; 2 | dpi: 240; 3 | scale-x-padding: 0.6; 4 | limit-x: 0.5 12.5; 5 | limit-y: 0 25; 6 | 7 | axes { 8 | position: bottom; 9 | label-placement-x: linear-alignat(1 1); 10 | label-format-x: custom("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"); 11 | label-placement-y: linear-alignat(5 -10); 12 | } 13 | 14 | lines { 15 | data-x: csv("test/testdata/city_temperatures_london.csv" month); 16 | data-y: csv("test/testdata/city_temperatures_london.csv" temperature); 17 | labels: csv("test/testdata/city_temperatures_london.csv" temperature_str); 18 | label-font-size: 10pt; 19 | color: 1; 20 | marker-size: 5pt; 21 | } 22 | 23 | legend { 24 | 25 | item { 26 | label: "London - Average Temperature"; 27 | color: 1; 28 | } 29 | item-flow: on; 30 | border: none; 31 | } 32 | -------------------------------------------------------------------------------- /test/examples/charts_editorial_stacked_bars.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 800px; 2 | dpi: 240; 3 | limit-y: 0 70; 4 | limit-x: -0.05 2.05; 5 | 6 | axes { 7 | position: bottom; 8 | label-placement-x: linear-interval(0.2 0 2.1); 9 | } 10 | 11 | bars { 12 | data-x: csv("test/testdata/stacked.csv" x); 13 | data-y: csv("test/testdata/stacked.csv" y4); 14 | width: 1em; 15 | color: #9fc3f5; 16 | } 17 | 18 | bars { 19 | data-x: csv("test/testdata/stacked.csv" x); 20 | data-y: csv("test/testdata/stacked.csv" y3); 21 | width: 1em; 22 | color: #88ade0; 23 | } 24 | 25 | bars { 26 | data-x: csv("test/testdata/stacked.csv" x); 27 | data-y: csv("test/testdata/stacked.csv" y2); 28 | width: 1em; 29 | color: #6393c9; 30 | } 31 | 32 | bars { 33 | data-x: csv("test/testdata/stacked.csv" x); 34 | data-y: csv("test/testdata/stacked.csv" y1); 35 | width: 1em; 36 | color: #4c7bb0; 37 | } 38 | 39 | legend { 40 | 41 | item { 42 | label: "Variable D"; 43 | color: #9fc3f5; 44 | } 45 | 46 | item { 47 | label: "Variable C"; 48 | color: #88ade0; 49 | } 50 | 51 | item { 52 | label: "Variable B"; 53 | color: #6393c9; 54 | } 55 | 56 | item { 57 | label: "Variable A"; 58 | color: #4c7bb0; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /test/examples/charts_reference_format_base.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 80px; 2 | dpi: 96; 3 | margin: 2em; 4 | 5 | axis { 6 | scale: logarithmic(2); 7 | label-format: base(2); 8 | limit: 0 4096; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_format_datetime.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 80px; 2 | dpi: 96; 3 | margin: 2em; 4 | 5 | axis { 6 | label-format: datetime("%H:%M:%S"); 7 | label-placement: linear(7200); 8 | limit: 0 79200; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_format_fixed.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 80px; 2 | dpi: 96; 3 | margin: 2em; 4 | 5 | axis { 6 | label-format: fixed 1; 7 | limit: 1 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_format_integer.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-format: integer; 7 | label-placement: linear(1); 8 | limit: 1 16; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_format_scientific.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 80px; 2 | dpi: 96; 3 | margin: 2em; 4 | 5 | axis { 6 | label-format: scientific(); 7 | label-placement: linear(500); 8 | limit: 0 3500; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_categorical.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: categorical(A B C D E F); 7 | } 8 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_inverted.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: invert; 7 | label-placement: linear(1); 8 | limit: 1 16; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_categorical.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: categorical(A B C D E F G H); 7 | tick-placement: categorical; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_categorical_bounds.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: categorical(A B C D E F G H); 7 | tick-placement: categorical-bounds; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_exponential.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: logarithmic(2); 7 | limit: 0 1024; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_exponential_steps.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: logarithmic(10); 7 | tick-placement: exponential-steps(10 10); 8 | label-format: base(10); 9 | limit: 0 10000; 10 | } 11 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_linear.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-placement: linear(1); 7 | limit: 1 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_linear_align.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-placement: linear-align(1); 7 | limit: -0.5 16.5; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_linear_alignat.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-placement: linear-alignat(1 0.5); 7 | limit: 0 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_linear_interval.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-placement: linear-interval(1 2 14); 7 | limit: 0 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_layout_subdivide.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | label-placement: subdivide(10); 7 | limit: 1 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_linear.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: linear; 7 | label-placement: linear(1); 8 | limit: 1 16; 9 | } 10 | -------------------------------------------------------------------------------- /test/examples/charts_reference_scale_logarithmic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 60px; 2 | dpi: 96; 3 | margin: 1em; 4 | 5 | axis { 6 | scale: log(2); 7 | limit: 0 4096; 8 | } 9 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_barchart_ranges.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 900px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | scale-x: categorical(A B C D E F); 5 | limit-y: -10 70; 6 | 7 | legend { 8 | position: bottom center; 9 | margin-bottom: 1em; 10 | item-flow: on; 11 | 12 | item { 13 | label: "Series A"; 14 | marker-shape: custom "▢"; 15 | } 16 | 17 | item { 18 | label: "Series B"; 19 | marker-shape: square-hatch-diag-right; 20 | } 21 | } 22 | 23 | axes { 24 | margin-bottom: 3.6em; 25 | label-placement-bottom: none; 26 | label-placement-y: linear-interval(10 0 60); 27 | } 28 | 29 | grid { 30 | stroke-color: #000; 31 | stroke-style: dashed; 32 | tick-placement-x: categorical-bounds; 33 | tick-placement-y: none; 34 | } 35 | 36 | bars { 37 | data-x: csv("test/testdata/bardata.csv" var3); 38 | data-y: csv("test/testdata/bardata.csv" var1); 39 | data-y-low: csv("test/testdata/bardata.csv" var2); 40 | width: 1em; 41 | offset: -.8em; 42 | stroke-width: .8pt; 43 | fill: none; 44 | } 45 | 46 | bars { 47 | data-x: csv("test/testdata/bardata.csv" var3); 48 | data-y: csv("test/testdata/bardata.csv" var4); 49 | data-y-low: csv("test/testdata/bardata.csv" var5); 50 | width: 1em; 51 | offset: .8em; 52 | stroke-width: .8pt; 53 | fill: hatch; 54 | } 55 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_errorbars_log.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 900px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-y: 0 1000; 5 | limit-x: 0 1000; 6 | scale-y: logarithmic; 7 | 8 | axes { 9 | } 10 | 11 | errorbars { 12 | data-x: csv("test/testdata/errorbars.csv" "x"); 13 | data-y-low: csv("test/testdata/errorbars.csv" "y_min"); 14 | data-y-high: csv("test/testdata/errorbars.csv" "y_max"); 15 | } 16 | 17 | points { 18 | data-x: csv("test/testdata/errorbars.csv" "x"); 19 | data-y: csv("test/testdata/errorbars.csv" "y"); 20 | } 21 | 22 | legend { 23 | 24 | item { 25 | label: "Random Data"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_line_markers.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-y: -4 5; 5 | limit-x: 0 1000; 6 | 7 | axes { 8 | label-format-x: scientific(); 9 | label-placement-x: linear-interval(100 100 900); 10 | } 11 | 12 | grid { 13 | stroke-color: rgba(0 0 0 0.2); 14 | stroke-style: dashed; 15 | tick-placement-y: none; 16 | } 17 | 18 | lines { 19 | data-x: list(100 200 300 400 500 600 700 800 900); 20 | data-y: list(-1.2 -1.8 -1.3 -1.6 -1.5 -1.3 -1.8 -1.9 -2.0); 21 | marker-shape: pentagon; 22 | marker-size: 8pt; 23 | } 24 | 25 | lines { 26 | data-x: list(100 200 300 400 500 600 700 800 900); 27 | data-y: list(1.2 1.8 1.3 0.6 1.5 1.3 1.8 1.7 1.9); 28 | marker-shape: square-bullet; 29 | marker-size: 8pt; 30 | } 31 | 32 | legend { 33 | background: #fff; 34 | item-flow: on; 35 | 36 | item { 37 | label: "Series A"; 38 | marker-shape: pentagon; 39 | } 40 | 41 | item { 42 | label: "Series B"; 43 | marker-shape: square-bullet; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_multiple_y_axes.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 768px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-x: 0 7200; 5 | 6 | axes { 7 | label-format-x: datetime("%H:%M:%S"); 8 | label-placement-x: linear-interval(900 900 7000); 9 | limit-left: 0 100; 10 | label-placement-left: linear-interval(10 10 50); 11 | limit-right: 0 1; 12 | label-placement-right: linear-interval(0.1 0.5 1.0); 13 | } 14 | 15 | grid { 16 | stroke-color: rgba(0 0 0 0.2); 17 | stroke-style: dashed; 18 | tick-placement-x: none; 19 | } 20 | 21 | lines { 22 | data-x: csv("test/testdata/measurement2.csv" time); 23 | data-y: csv("test/testdata/measurement2.csv" value3); 24 | limit-y: -4 10; 25 | stroke-width: 0.8pt; 26 | } 27 | 28 | lines { 29 | data-x: csv("test/testdata/measurement2.csv" time); 30 | data-y: csv("test/testdata/measurement2.csv" value3); 31 | limit-y: -16 6; 32 | stroke-width: 0.8pt; 33 | } 34 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_scalarfield.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-x: -500 500; 5 | limit-y: -200 200; 6 | 7 | axes { 8 | } 9 | 10 | rectangles { 11 | data-x: csv(test/testdata/field2d.csv x); 12 | data-y: csv(test/testdata/field2d.csv y); 13 | data-size: 10; 14 | colors: csv(test/testdata/field2d.csv a); 15 | color-map: gradient(0 #fff 1.0 #000); 16 | } 17 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_scatterplot_colors.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 900px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-x: 0 400; 5 | limit-y: 0 200; 6 | 7 | axes { 8 | label-placement-y: subdivide(5); 9 | } 10 | 11 | points { 12 | data-x: csv(test/testdata/gauss3d.csv x); 13 | data-y: csv(test/testdata/gauss3d.csv y); 14 | shape: circle-o; 15 | colors: csv(test/testdata/gauss3d.csv z); 16 | color-map: gradient(0 #aaa 1.0 #000); 17 | } 18 | 19 | legend { 20 | position: bottom left; 21 | 22 | item { 23 | label: "Random Data"; 24 | marker-shape: circle-o; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_scatterplot_with_labels.clp: -------------------------------------------------------------------------------- 1 | size: 1600px 900px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-x: 0 60; 5 | limit-y: -40 60; 6 | 7 | axes { 8 | } 9 | 10 | grid { 11 | color: rgba(0 0 0 0.05); 12 | stroke-style: dashed; 13 | tick-placement-x: none; 14 | } 15 | 16 | points { 17 | data-x: csv(test/testdata/point_example.csv x); 18 | data-y: csv(test/testdata/point_example.csv y); 19 | shape: circle-bullet; 20 | sizes: csv(test/testdata/point_example.csv z); 21 | size-map: linear(.4em 1.4em); 22 | labels: csv(test/testdata/point_example.csv z); 23 | } 24 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_streamgraph.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 768px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-y: -80 80; 5 | 6 | axes { 7 | limit-x: 0 1; 8 | } 9 | 10 | grid { 11 | color: rgba(0 0 0 0.05); 12 | stroke-style: dashed; 13 | tick-placement-y: none; 14 | } 15 | 16 | areas { 17 | data-x: csv("test/testdata/areadata2.csv" x); 18 | data-y: csv("test/testdata/areadata2.csv" z); 19 | data-y-low: csv("test/testdata/areadata2.csv" y); 20 | stroke-width: 1pt; 21 | fill: hatch(angle(65) width(.8pt) stride(3.5pt)); 22 | } 23 | 24 | areas { 25 | data-x: csv("test/testdata/areadata2.csv" x); 26 | data-y: csv("test/testdata/areadata2.csv" z2); 27 | data-y-low: csv("test/testdata/areadata2.csv" y2); 28 | stroke-width: 1pt; 29 | fill: #eee; 30 | } 31 | -------------------------------------------------------------------------------- /test/examples/charts_scientific_vectorfield.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-x: -4 4; 5 | limit-y: -2 2; 6 | 7 | axes { 8 | } 9 | 10 | vectors { 11 | size: 1pt; 12 | data-x: csv("test/testdata/vectorfield.csv" x); 13 | data-y: csv("test/testdata/vectorfield.csv" y); 14 | data-dx: csv("test/testdata/vectorfield.csv" dx); 15 | data-dy: csv("test/testdata/vectorfield.csv" dy); 16 | } 17 | -------------------------------------------------------------------------------- /test/examples/maps_gulf_of_mexico.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1536px; 2 | dpi: 320; 3 | limit-x: -100 -77; 4 | limit-y: 16 32; 5 | 6 | axes { 7 | label-placement-x: linear(5); 8 | label-placement-y: linear(1); 9 | title-bottom: "Longitude"; 10 | title-left: "Lattitude"; 11 | } 12 | background: fill(#eff7fe); 13 | 14 | grid { 15 | tick-placement-x: linear(5); 16 | tick-placement-y: linear(5); 17 | color: rgba(0 0 0 0.1); 18 | stroke-style: dashed; 19 | } 20 | 21 | polygons { 22 | data: geojson(test/testdata/gulf_of_mexico.geojson); 23 | fill: #ffefdb; 24 | stroke-color: #999187; 25 | stroke-width: .7pt; 26 | } 27 | 28 | labels { 29 | data-x: list(-90); 30 | data-y: list(23.5); 31 | label-font-size: 14pt; 32 | label-color: rgba(0 0 0 0.6); 33 | labels: "Gulf of Mexico"; 34 | } 35 | -------------------------------------------------------------------------------- /test/general/nomodule.clp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/test/general/nomodule.clp -------------------------------------------------------------------------------- /test/general/nomodule.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="800"> 4 | <rect width="1600" height="800" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_a4.clp: -------------------------------------------------------------------------------- 1 | size: A4; 2 | dpi: 96; 3 | -------------------------------------------------------------------------------- /test/layer/resize_a4.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="793.701" height="1122.520"> 4 | <rect width="793.701" height="1122.520" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_a4_dpi.clp: -------------------------------------------------------------------------------- 1 | size: A4; 2 | dpi: 240; 3 | -------------------------------------------------------------------------------- /test/layer/resize_a4_dpi.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1984.252" height="2806.299"> 4 | <rect width="1984.252" height="2806.299" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_a4_landscape.clp: -------------------------------------------------------------------------------- 1 | size: A4*; 2 | dpi: 96; 3 | -------------------------------------------------------------------------------- /test/layer/resize_a4_landscape.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1122.520" height="793.701"> 4 | <rect width="1122.520" height="793.701" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_mm.clp: -------------------------------------------------------------------------------- 1 | dpi: 96; 2 | size: 200mm 300mm; 3 | -------------------------------------------------------------------------------- /test/layer/resize_mm.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="755.906" height="1133.858"> 4 | <rect width="755.906" height="1133.858" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_mm_dpi.clp: -------------------------------------------------------------------------------- 1 | size: 200mm 300mm; 2 | dpi: 240; 3 | -------------------------------------------------------------------------------- /test/layer/resize_mm_dpi.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1889.764" height="2834.646"> 4 | <rect width="1889.764" height="2834.646" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_px.clp: -------------------------------------------------------------------------------- 1 | size: 1920px 1080px; 2 | -------------------------------------------------------------------------------- /test/layer/resize_px.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080"> 4 | <rect width="1920" height="1080" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/layer/resize_px_dpi.clp: -------------------------------------------------------------------------------- 1 | size: 1920px 1080px; 2 | dpi: 240; 3 | -------------------------------------------------------------------------------- /test/layer/resize_px_dpi.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080"> 4 | <rect width="1920" height="1080" fill="#ffffff" fill-opacity="1"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /test/legend/legend_default.clp: -------------------------------------------------------------------------------- 1 | size: 400px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | 6 | item { 7 | label: "Fnord Test 1"; 8 | color: #06c; 9 | } 10 | 11 | item { 12 | label: "Fnord Test 2"; 13 | color: #c06; 14 | } 15 | 16 | item { 17 | label: "Fnord Test 3"; 18 | color: #c06; 19 | } 20 | 21 | item { 22 | label: "Fnord Test 4"; 23 | color: #c06; 24 | } 25 | 26 | item { 27 | label: "Fnord Test 5"; 28 | color: #6c0; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/legend/legend_flow.clp: -------------------------------------------------------------------------------- 1 | size: 1200px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | item-flow: on; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #6c0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/legend/legend_flow_small.clp: -------------------------------------------------------------------------------- 1 | size: 500px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | item-flow: on; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c00; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_flow_valign.clp: -------------------------------------------------------------------------------- 1 | size: 500px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | item-flow: on; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | label-font-size: 20pt; 20 | color: #c06; 21 | } 22 | 23 | item { 24 | label: "Fnord Test 4"; 25 | color: #c00; 26 | } 27 | 28 | item { 29 | label: "Fnord Test 5"; 30 | color: #6c0; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/legend/legend_i18n.clp: -------------------------------------------------------------------------------- 1 | size: 2000px 2000px; 2 | dpi: 320; 3 | font-size: 14pt; 4 | 5 | legend { 6 | 7 | item { 8 | label: "i北京市 (Beijing)"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "תל אביב (Tel Aviv)"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "القاهرة‎ (Cairo)"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Москва"; 24 | color: #60c; 25 | } 26 | 27 | item { 28 | label: "New York City 🌭 🗽 🇺🇸"; 29 | color: #60c; 30 | } 31 | 32 | item { 33 | label: "東京都 (Tokyo)"; 34 | color: #6c0; 35 | } 36 | 37 | item { 38 | label: "서울 (Seoul)"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/legend/legend_item_default.clp: -------------------------------------------------------------------------------- 1 | size: 200px 60px; 2 | dpi: 96; 3 | 4 | legend { 5 | 6 | item { 7 | label: "Fnord Test"; 8 | color: #06c; 9 | marker-shape: hexagon; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/legend/legend_position_bottom_center.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: bottom center; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_bottom_left.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: bottom left; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_bottom_right.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: bottom right; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_center_center.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: center center; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_center_left.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: center left; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_center_right.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: center right; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_top_center.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: top center; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_top_left.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: top left; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/legend/legend_position_top_right.clp: -------------------------------------------------------------------------------- 1 | size: 900px 600px; 2 | dpi: 96; 3 | 4 | legend { 5 | position: top right; 6 | 7 | item { 8 | label: "Fnord Test 1"; 9 | color: #06c; 10 | } 11 | 12 | item { 13 | label: "Fnord Test 2"; 14 | color: #c06; 15 | } 16 | 17 | item { 18 | label: "Fnord Test 3"; 19 | color: #c06; 20 | } 21 | 22 | item { 23 | label: "Fnord Test 4"; 24 | color: #c06; 25 | } 26 | 27 | item { 28 | label: "Fnord Test 5"; 29 | color: #6c0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/plot-areas/areas_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-x: 0 1000; 4 | limit-y: 0 400; 5 | 6 | areas { 7 | data-x: list(100 300 500 700 900); 8 | data-y: list(200 300 200 300 100); 9 | color: #06c; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-areas/areas_basic.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M102.400 256 L307.200 128 L512 256 L716.800 128 L921.600 384 L921.600 512 L716.800 512 L512 512 L307.200 512 L102.400 512 Z" fill="#0066cc"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-areas/areas_csv.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | areas { 5 | data-x: csv("test/testdata/measurement.csv" time); 6 | data-y: csv("test/testdata/measurement.csv" value1); 7 | color: #888; 8 | } 9 | -------------------------------------------------------------------------------- /test/plot-areas/areas_vertical.clp: -------------------------------------------------------------------------------- 1 | size: 600px 900px; 2 | dpi: 96; 3 | 4 | areas { 5 | data-x: csv("test/testdata/measurement.csv" value2); 6 | data-y: csv("test/testdata/measurement.csv" time); 7 | direction: horizontal; 8 | color: #999; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axes_categorical.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | axes { 5 | scale-x: categorical(A B C D E F); 6 | scale-y: categorical(W X Y Z); 7 | } 8 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_default.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime("%H:%M:%S"); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_begin.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-attach: left; 11 | label-rotate: 90; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_begin45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 45; 11 | label-attach: left; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_beginn45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: -45; 11 | label-attach: left; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_center.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_center180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 180; 11 | label-attach: top; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_end135.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: -45; 11 | label-attach: right; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_end180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-attach: right; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_label_end225.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 45; 11 | label-attach: right; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_title.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-font-size: 16pt; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_bottom_title_rotate.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: bottom; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-rotate: 45; 11 | title-font-size: 16pt; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_default.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_center.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-attach: bottom; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_center180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 180; 11 | label-attach: top; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_flip.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-attach: left; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_flip135.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: -45; 10 | label-attach: left; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_flip225.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: 45; 10 | label-attach: left; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_rotate45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: 45; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_label_rotaten45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: -45; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_title.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-font-size: 16pt; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_left_title_rotate.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: left; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-rotate: 0; 11 | title-font-size: 16pt; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_default.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_center.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_center180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 180; 11 | label-attach: top; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_flip.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-attach: right; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_flip135.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: -45; 10 | label-attach: right; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_flip225.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: 45; 10 | label-attach: right; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_rotate45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: 45; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_label_rotaten45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime(); 9 | label-rotate: -45; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_title.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-font-size: 16pt; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_right_title_rotate.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: right; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-rotate: 45; 11 | title-font-size: 16pt; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_scale_linear_linear.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: x; 7 | label-placement: linear(1); 8 | tick-offset: 0; 9 | limit: 0 16; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_scale_linear_linear_aligned.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: x; 7 | label-placement: linear-alignat(1 0.5); 8 | limit: 0 16; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_scale_linear_subdivide.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: x; 7 | label-placement: subdivide(21); 8 | limit: -100 100; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_scale_linear_subdivide_labels.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: x; 7 | label-placement: subdivide(5); 8 | label-format: custom("-2σ" "-1σ" "0" "1σ" "2σ"); 9 | limit: -10 10; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_default.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-format: datetime("%H:%M:%S"); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_begin135.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: -45; 11 | label-attach: left; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_begin180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-attach: left; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_begin225.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 45; 11 | label-attach: left; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_center.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_center180.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 180; 11 | label-attach: bottom; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_end.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-attach: right; 11 | label-rotate: 90; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_end45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: 45; 11 | label-attach: right; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_label_endn45.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | limit: 1451606400 1451610000; 8 | label-placement: subdivide(4); 9 | label-format: datetime("%H:%M:%S"); 10 | label-rotate: -45; 11 | label-attach: right; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_title.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-font-size: 16pt; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-axis/axis_top_title_rotate.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: top; 7 | label-placement: linear(1); 8 | limit: 0 16; 9 | title: "Fnord (f/s)"; 10 | title-rotate: 45; 11 | title-font-size: 16pt; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-axis/axis_vert_tick_center.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: y; 7 | label-placement: linear(1); 8 | tick-offset: 0; 9 | limit: 0 16; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_vert_tick_left.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: y; 7 | label-placement: linear(1); 8 | tick-offset: -1; 9 | limit: 0 16; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-axis/axis_vert_tick_right.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | margin: 8em; 4 | 5 | axis { 6 | align: y; 7 | label-placement: linear(1); 8 | tick-offset: 1; 9 | limit: 0 16; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-bars/barchart_horizontal.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | bars { 5 | limit-x: 0 24; 6 | limit-y: 0 10; 7 | data-x: csv("test/testdata/gdp_per_capita_2010.csv" gdp); 8 | data-y: csv("test/testdata/gdp_per_capita_2010.csv" rank); 9 | labels: csv("test/testdata/gdp_per_capita_2010.csv" gdp_label); 10 | direction: horizontal; 11 | width: 1.2em; 12 | color: #666; 13 | } 14 | -------------------------------------------------------------------------------- /test/plot-bars/barchart_ranges.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-x: 0.5 6.5; 4 | limit-y: -20 70; 5 | 6 | bars { 7 | data-x: csv("test/testdata/bardata.csv" var0); 8 | data-y: csv("test/testdata/bardata.csv" var1); 9 | data-y-low: csv("test/testdata/bardata.csv" var2); 10 | width: 1em; 11 | offset: -.8em; 12 | color: #ccc; 13 | } 14 | 15 | bars { 16 | data-x: csv("test/testdata/bardata.csv" var0); 17 | data-y: csv("test/testdata/bardata.csv" var4); 18 | data-y-low: csv("test/testdata/bardata.csv" var5); 19 | width: 1em; 20 | offset: .8em; 21 | color: #666; 22 | } 23 | -------------------------------------------------------------------------------- /test/plot-bars/barchart_ranges.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M66.267 153.600 L66.267 204.800 L80.933 204.800 L80.933 153.600 Z" fill="#cccccc"/> 6 | <path d="M236.933 28.444 L236.933 182.044 L251.600 182.044 L251.600 28.444 Z" fill="#cccccc"/> 7 | <path d="M407.600 136.533 L407.600 153.600 L422.267 153.600 L422.267 136.533 Z" fill="#cccccc"/> 8 | <path d="M578.267 182.044 L578.267 210.489 L592.933 210.489 L592.933 182.044 Z" fill="#cccccc"/> 9 | <path d="M748.933 182.044 L748.933 278.756 L763.600 278.756 L763.600 182.044 Z" fill="#cccccc"/> 10 | <path d="M919.600 85.333 L919.600 210.489 L934.267 210.489 L934.267 85.333 Z" fill="#cccccc"/> 11 | <path d="M89.733 91.022 L89.733 369.778 L104.400 369.778 L104.400 91.022 Z" fill="#666666"/> 12 | <path d="M260.400 85.333 L260.400 329.956 L275.067 329.956 L275.067 85.333 Z" fill="#666666"/> 13 | <path d="M431.067 39.822 L431.067 398.222 L445.733 398.222 L445.733 39.822 Z" fill="#666666"/> 14 | <path d="M601.733 96.711 L601.733 301.511 L616.400 301.511 L616.400 96.711 Z" fill="#666666"/> 15 | <path d="M772.400 164.978 L772.400 295.822 L787.067 295.822 L787.067 164.978 Z" fill="#666666"/> 16 | <path d="M943.067 96.711 L943.067 398.222 L957.733 398.222 L957.733 96.711 Z" fill="#666666"/> 17 | </svg> 18 | -------------------------------------------------------------------------------- /test/plot-bars/barchart_with_labels.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | bars { 5 | limit-x: 0 13; 6 | limit-y: 0 25; 7 | data-x: csv("test/testdata/city_temperatures_london.csv" month); 8 | data-y: csv("test/testdata/city_temperatures_london.csv" temperature); 9 | labels: csv("test/testdata/city_temperatures_london.csv" temperature_str); 10 | width: 2em; 11 | color: #666; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-bars/bars_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-x: 0 1000; 4 | limit-y: 0 400; 5 | 6 | bars { 7 | data-x: list(100 300 500 700 900); 8 | data-y: list(200 300 200 300 100); 9 | color: #06c; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-bars/bars_basic.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M95.733 512 L95.733 256 L109.067 256 L109.067 512 Z" fill="#0066cc"/> 6 | <path d="M300.533 512 L300.533 128 L313.867 128 L313.867 512 Z" fill="#0066cc"/> 7 | <path d="M505.333 512 L505.333 256 L518.667 256 L518.667 512 Z" fill="#0066cc"/> 8 | <path d="M710.133 512 L710.133 128 L723.467 128 L723.467 512 Z" fill="#0066cc"/> 9 | <path d="M914.933 512 L914.933 384 L928.267 384 L928.267 512 Z" fill="#0066cc"/> 10 | </svg> 11 | -------------------------------------------------------------------------------- /test/plot-bars/bars_negative_values.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | bars { 5 | limit-x: 0 13; 6 | scale-y-padding: 5; 7 | data-x: csv("test/testdata/city_temperatures.csv" month); 8 | data-y: csv("test/testdata/city_temperatures.csv" temp_moscow); 9 | width: 2em; 10 | color: #666; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-bars/bars_negative_values.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M64.103 344.926 L64.103 444.632 L93.436 444.632 L93.436 344.926 Z" fill="#666666"/> 6 | <path d="M142.872 344.926 L142.872 423.074 L172.205 423.074 L172.205 344.926 Z" fill="#666666"/> 7 | <path d="M221.641 344.926 L221.641 346.274 L250.974 346.274 L250.974 344.926 Z" fill="#666666"/> 8 | <path d="M300.410 344.926 L300.410 249.263 L329.744 249.263 L329.744 344.926 Z" fill="#666666"/> 9 | <path d="M379.179 344.926 L379.179 146.863 L408.513 146.863 L408.513 344.926 Z" fill="#666666"/> 10 | <path d="M457.949 344.926 L457.949 106.442 L487.282 106.442 L487.282 344.926 Z" fill="#666666"/> 11 | <path d="M536.718 344.926 L536.718 67.368 L566.051 67.368 L566.051 344.926 Z" fill="#666666"/> 12 | <path d="M615.487 344.926 L615.487 91.621 L644.821 91.621 L644.821 344.926 Z" fill="#666666"/> 13 | <path d="M694.256 344.926 L694.256 175.158 L723.590 175.158 L723.590 344.926 Z" fill="#666666"/> 14 | <path d="M773.026 344.926 L773.026 262.737 L802.359 262.737 L802.359 344.926 Z" fill="#666666"/> 15 | <path d="M851.795 344.926 L851.795 330.105 L881.128 330.105 L881.128 344.926 Z" fill="#666666"/> 16 | <path d="M930.564 344.926 L930.564 393.432 L959.897 393.432 L959.897 344.926 Z" fill="#666666"/> 17 | </svg> 18 | -------------------------------------------------------------------------------- /test/plot-bars/histogram.clp: -------------------------------------------------------------------------------- 1 | size: 480px 380px; 2 | dpi: 96; 3 | 4 | bars { 5 | limit-x: 0 7; 6 | limit-y: 0 10000; 7 | scale-y: log; 8 | data-x: csv("test/testdata/histogram.csv" var0); 9 | data-y: csv("test/testdata/histogram.csv" var1); 10 | width: 1.8em; 11 | color: #666; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-bars/histogram.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="480" height="380"> 4 | <rect width="480" height="380" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M55.371 380 L55.371 29.054 L81.771 29.054 L81.771 380 Z" fill="#666666"/> 6 | <path d="M123.943 380 L123.943 222.945 L150.343 222.945 L150.343 380 Z" fill="#666666"/> 7 | <path d="M192.514 380 L192.514 306.076 L218.914 306.076 L218.914 380 Z" fill="#666666"/> 8 | <path d="M261.086 380 L261.086 322.804 L287.486 322.804 L287.486 380 Z" fill="#666666"/> 9 | <path d="M329.657 380 L329.657 351.402 L356.057 351.402 L356.057 380 Z" fill="#666666"/> 10 | <path d="M398.229 380 L398.229 380 L424.629 380 L424.629 380 Z" fill="#666666"/> 11 | </svg> 12 | -------------------------------------------------------------------------------- /test/plot-grid/gridlines_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | grid { 5 | tick-placement-x: linear(1); 6 | limit-x-min: 0; 7 | limit-x-max: 16; 8 | } 9 | -------------------------------------------------------------------------------- /test/plot-lines/lines_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: list(100 300 500 700 900); 6 | data-y: list(200 300 200 300 100); 7 | color: #06c; 8 | stroke-width: 2pt; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-lines/lines_basic.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M0 256 L256 0 L512 256 L768 0 L1024 512" fill="none" stroke="#0066cc" stroke-width="2.667"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_csv.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data: "test/testdata/measurement.csv"; 6 | data-x: time; 7 | data-y: value2; 8 | color: #000; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-lines/lines_csv.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M-2.095 380.651 L12.190 392.483 L26.476 487.404 L40.762 483.107 L55.048 463.108 L69.333 508.682 L83.619 512.000 L97.905 483.197 L112.190 456.133 L126.476 511.001 L140.762 477.732 L155.048 490.348 L169.333 418.009 L183.619 441.066 L197.905 471.650 L212.190 436.272 L226.476 477.484 L240.762 495.041 L255.048 509.486 L269.333 510.060 L283.619 509.988 L297.905 443.946 L312.190 191.951 L326.476 -0.000 L340.762 9.043 L355.048 25.524 L369.333 249.617 L383.619 309.455 L397.905 422.087 L412.190 480.497 L426.476 501.074 L440.762 495.669 L455.048 502.245 L469.333 495.708 L483.619 430.807 L497.905 425.128 L512.190 422.826 L526.476 397.513 L540.762 409.149 L555.048 429.114 L569.333 419.652 L583.619 387.328 L597.905 337.319 L612.190 342.983 L626.476 310.099 L640.762 361.966 L655.048 385.106 L669.333 438.675 L683.619 410.818 L697.905 318.531 L712.190 300.811 L726.476 345.232 L740.762 354.436 L755.048 341.734 L769.333 318.172 L783.619 411.679 L797.905 442.039 L812.190 358.478 L826.476 412.847 L840.762 473.519 L855.048 467.182 L869.333 404.306 L883.619 451.028 L897.905 456.014 L912.190 465.339 L926.476 455.463 L940.762 464.797 L955.048 429.862 L969.333 460.464 L983.619 441.358 L997.905 422.209 L1012.190 439.167 L1026.476 473.141" fill="none" stroke="#000000" stroke-width="2"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_err_inconsistent_data.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: list(100px 300px 500px 700px 900px); 6 | data-y: list(200px 300px 200px 300px); 7 | } 8 | -------------------------------------------------------------------------------- /test/plot-lines/lines_err_inconsistent_data.err: -------------------------------------------------------------------------------- 1 | ERROR: The length of the 'data-x' and 'data-y' lists must be equal 2 | -------------------------------------------------------------------------------- /test/plot-lines/lines_geojson.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data: "test/plot-lines/lines_geojson_data.geojson"; 6 | color: #06c; 7 | stroke-width: 2pt; 8 | } 9 | -------------------------------------------------------------------------------- /test/plot-lines/lines_geojson.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M0 201.732 L760.471 -0.000 L1024 204.971 L542.118 512.000 L308.706 228.043 L700.235 179.449 L670.118 262.199 L707.765 258.720" fill="none" stroke="#0066cc" stroke-width="2.667"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_geojson_data.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { 5 | "type": "Feature", 6 | "properties": {}, 7 | "geometry": { 8 | "type": "LineString", 9 | "coordinates": [ 10 | [ 11 | 37.6171875, 12 | 45.336701909968134 13 | ], 14 | [ 15 | 73.125, 16 | 60.75915950226991 17 | ], 18 | [ 19 | 85.4296875, 20 | 45.089035564831036 21 | ], 22 | [ 23 | 62.9296875, 24 | 21.616579336740603 25 | ], 26 | [ 27 | 52.03125, 28 | 43.32517767999296 29 | ], 30 | [ 31 | 70.3125, 32 | 47.040182144806664 33 | ], 34 | [ 35 | 68.90625, 36 | 40.713955826286046 37 | ], 38 | [ 39 | 70.6640625, 40 | 40.97989806962013 41 | ] 42 | ] 43 | } 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /test/plot-lines/lines_inverted.clp: -------------------------------------------------------------------------------- 1 | size: 1200px 480px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: csv("test/testdata/measurement.csv" time); 6 | data-y: csv("test/testdata/measurement.csv" value2); 7 | color: #06c; 8 | scale-y: inverted; 9 | limit-y: 0 140; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-lines/lines_inverted.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="480"> 4 | <rect width="1200" height="480" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M-2.455 107.965 L14.286 98.971 L31.027 26.822 L47.768 30.088 L64.509 45.289 L81.250 10.649 L97.991 8.127 L114.732 30.020 L131.473 50.591 L148.214 8.886 L164.955 34.174 L181.696 24.584 L198.438 79.569 L215.179 62.044 L231.920 38.796 L248.661 65.688 L265.402 34.362 L282.143 21.017 L298.884 10.038 L315.625 9.601 L332.366 9.656 L349.107 59.855 L365.848 251.395 L382.589 397.297 L399.330 390.423 L416.071 377.896 L432.812 207.563 L449.554 162.080 L466.295 76.470 L483.036 32.072 L499.777 16.431 L516.518 20.540 L533.259 15.541 L550 20.510 L566.741 69.841 L583.482 74.158 L600.223 75.907 L616.964 95.148 L633.705 86.303 L650.446 71.128 L667.188 78.320 L683.929 102.890 L700.670 140.902 L717.411 136.596 L734.152 161.591 L750.893 122.167 L767.634 104.579 L784.375 63.861 L801.116 85.035 L817.857 155.182 L834.598 168.651 L851.339 134.887 L868.080 127.891 L884.821 137.546 L901.562 155.455 L918.304 84.380 L935.045 61.304 L951.786 124.819 L968.527 83.492 L985.268 37.376 L1002.009 42.192 L1018.750 89.985 L1035.491 54.471 L1052.232 50.681 L1068.973 43.594 L1085.714 51.100 L1102.455 44.005 L1119.196 70.560 L1135.938 47.299 L1152.679 61.821 L1169.420 76.376 L1186.161 63.487 L1202.902 37.663" fill="none" stroke="#0066cc" stroke-width="2"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_logscale.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1200px; 2 | dpi: 240; 3 | limit-x: 1 5; 4 | limit-y: 0 10000; 5 | scale-y: log; 6 | 7 | lines { 8 | data-x: csv("test/testdata/log_example.csv" x); 9 | data-y: csv("test/testdata/log_example.csv" y); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-lines/lines_logscale.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="2048" height="1200"> 4 | <rect width="2048" height="1200" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M0 1200 L512 900 L1024 600 L1536 300.000 L2048 0" fill="none" stroke="#000000" stroke-width="5"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_stroke_style_dash_pattern.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: list(100 300 500 700 900); 6 | data-y: list(200 300 200 300 100); 7 | color: #06c; 8 | stroke-style: dash(pattern(.4em 1em)); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-lines/lines_stroke_style_dash_pattern.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M0 256 L256 0 L512 256 L768 0 L1024 512" fill="none" stroke="#0066cc" stroke-width="2" stroke-dasharray="5.867 14.667" stroke-dashoffset="0"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_stroke_style_dashed.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: list(100 300 500 700 900); 6 | data-y: list(200 300 200 300 100); 7 | color: #06c; 8 | stroke-style: dashed; 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-lines/lines_stroke_style_dashed.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M0 256 L256 0 L512 256 L768 0 L1024 512" fill="none" stroke="#0066cc" stroke-width="2" stroke-dasharray="2.667 2.667" stroke-dashoffset="0"/> 6 | </svg> 7 | -------------------------------------------------------------------------------- /test/plot-lines/lines_with_labels.clp: -------------------------------------------------------------------------------- 1 | size: 1200px 480px; 2 | dpi: 96; 3 | 4 | lines { 5 | data-x: csv("test/testdata/city_temperatures_london.csv" month); 6 | data-y: csv("test/testdata/city_temperatures_london.csv" temperature); 7 | labels: csv("test/testdata/city_temperatures_london.csv" temperature_str); 8 | color: #06c; 9 | marker-size: 3pt; 10 | scale-x-padding: 0.6; 11 | limit-y: -10 32; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-points/marker_circle_default.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/point_example.csv x); 6 | data-y: csv(test/testdata/point_example.csv y); 7 | scale-x-padding: 10; 8 | scale-y-padding: 20; 9 | shape: circle-o; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/marker_circle_width.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/point_example.csv x); 6 | data-y: csv(test/testdata/point_example.csv y); 7 | scale-x-padding: 10; 8 | scale-y-padding: 20; 9 | shape: circle-o 0.5; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/marker_disk.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/point_example.csv x); 6 | data-y: csv(test/testdata/point_example.csv y); 7 | scale-x-padding: 10; 8 | scale-y-padding: 20; 9 | shape: circle; 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/markers_unicode.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | limit-y: -4 5; 4 | limit-x: 0 1000; 5 | 6 | points { 7 | data-x: list(100 200 300 400 500 600 700 800 900); 8 | data-y: list(-1.2 -1.8 -1.3 -1.6 -1.5 -1.3 -1.8 -1.9 -2.0); 9 | shape: pentagon; 10 | size: 8pt; 11 | } 12 | 13 | points { 14 | data-x: list(100 200 300 400 500 600 700 800 900); 15 | data-y: list(1.2 1.8 1.3 0.6 1.5 1.3 1.8 1.7 1.9); 16 | shape: square-bullet; 17 | size: 8pt; 18 | } 19 | -------------------------------------------------------------------------------- /test/plot-points/markers_unicode_customfont.clp: -------------------------------------------------------------------------------- 1 | size: 2048px 1024px; 2 | dpi: 240; 3 | font: "Latin Modern Roman"; 4 | limit-y: -4 5; 5 | limit-x: 0 1000; 6 | 7 | points { 8 | data-x: list(100 200 300 400 500 600 700 800 900); 9 | data-y: list(-1.2 -1.8 -1.3 -1.6 -1.5 -1.3 -1.8 -1.9 -2.0); 10 | shape: pentagon; 11 | size: 8pt; 12 | } 13 | 14 | points { 15 | data-x: list(100 200 300 400 500 600 700 800 900); 16 | data-y: list(1.2 1.8 1.3 0.6 1.5 1.3 1.8 1.7 1.9); 17 | shape: square-bullet; 18 | size: 8pt; 19 | } 20 | -------------------------------------------------------------------------------- /test/plot-points/plot_log10.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | limit-x: 0 10; 6 | limit-y: 0 10000; 7 | scale-y: log; 8 | data-x: list(2 4 6 8); 9 | data-y: list(5 50 500 5000); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/plot_log10.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M204.800 425.199 C203.327 425.199 202.133 424.005 202.133 422.532 C202.133 421.059 203.327 419.865 204.800 419.865 C206.273 419.865 207.467 421.059 207.467 422.532 C207.467 424.005 206.273 425.199 204.800 425.199 Z"/> 6 | <path d="M409.600 297.199 C408.127 297.199 406.933 296.005 406.933 294.532 C406.933 293.059 408.127 291.865 409.600 291.865 C411.073 291.865 412.267 293.059 412.267 294.532 C412.267 296.005 411.073 297.199 409.600 297.199 Z"/> 7 | <path d="M614.400 169.199 C612.927 169.199 611.733 168.005 611.733 166.532 C611.733 165.059 612.927 163.865 614.400 163.865 C615.873 163.865 617.067 165.059 617.067 166.532 C617.067 168.005 615.873 169.199 614.400 169.199 Z"/> 8 | <path d="M819.200 41.199 C817.727 41.199 816.533 40.005 816.533 38.532 C816.533 37.059 817.727 35.865 819.200 35.865 C820.673 35.865 821.867 37.059 821.867 38.532 C821.867 40.005 820.673 41.199 819.200 41.199 Z"/> 9 | </svg> 10 | -------------------------------------------------------------------------------- /test/plot-points/plot_log10_lt1.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | limit-x: 0 20; 6 | limit-y: 0.0001 10000; 7 | scale-y: log; 8 | data-x: list(2 4 6 8 10 12 14 16); 9 | data-y: list(5 50 500 5000 0.5 0.05 0.005 0.0005); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/plot_log2.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | limit-x: 0 10; 6 | limit-y: 0 10000; 7 | scale-y: log(2); 8 | data-x: list(2 4 6 8); 9 | data-y: list(5 50 500 5000); 10 | } 11 | -------------------------------------------------------------------------------- /test/plot-points/plot_log2.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M204.800 425.199 C203.327 425.199 202.133 424.005 202.133 422.532 C202.133 421.059 203.327 419.865 204.800 419.865 C206.273 419.865 207.467 421.059 207.467 422.532 C207.467 424.005 206.273 425.199 204.800 425.199 Z"/> 6 | <path d="M409.600 297.199 C408.127 297.199 406.933 296.005 406.933 294.532 C406.933 293.059 408.127 291.865 409.600 291.865 C411.073 291.865 412.267 293.059 412.267 294.532 C412.267 296.005 411.073 297.199 409.600 297.199 Z"/> 7 | <path d="M614.400 169.199 C612.927 169.199 611.733 168.005 611.733 166.532 C611.733 165.059 612.927 163.865 614.400 163.865 C615.873 163.865 617.067 165.059 617.067 166.532 C617.067 168.005 615.873 169.199 614.400 169.199 Z"/> 8 | <path d="M819.200 41.199 C817.727 41.199 816.533 40.005 816.533 38.532 C816.533 37.059 817.727 35.865 819.200 35.865 C820.673 35.865 821.867 37.059 821.867 38.532 C821.867 40.005 820.673 41.199 819.200 41.199 Z"/> 9 | </svg> 10 | -------------------------------------------------------------------------------- /test/plot-points/points_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-x: 0 1000; 4 | limit-y: 0 400; 5 | 6 | points { 7 | data-x: list(100 500 700 900 300); 8 | data-y: list(200 300 200 300 100); 9 | labels: A B A B A; 10 | label-font-size: 18pt; 11 | size: 8px; 12 | } 13 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | scale-x: categorical("a" "b" "c" "d" "e"); 6 | limit-y: 0 6; 7 | data-x: list("a" "b" "c" "d" "e"); 8 | data-y: list(1 2 3 4 5); 9 | } 10 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M102.400 429.333 C100.927 429.333 99.733 428.139 99.733 426.667 C99.733 425.194 100.927 424 102.400 424 C103.873 424 105.067 425.194 105.067 426.667 C105.067 428.139 103.873 429.333 102.400 429.333 Z"/> 6 | <path d="M307.200 344 C305.727 344 304.533 342.806 304.533 341.333 C304.533 339.861 305.727 338.667 307.200 338.667 C308.673 338.667 309.867 339.861 309.867 341.333 C309.867 342.806 308.673 344 307.200 344 Z"/> 7 | <path d="M512 258.667 C510.527 258.667 509.333 257.473 509.333 256 C509.333 254.527 510.527 253.333 512 253.333 C513.473 253.333 514.667 254.527 514.667 256 C514.667 257.473 513.473 258.667 512 258.667 Z"/> 8 | <path d="M716.800 173.333 C715.327 173.333 714.133 172.139 714.133 170.667 C714.133 169.194 715.327 168 716.800 168 C718.273 168 719.467 169.194 719.467 170.667 C719.467 172.139 718.273 173.333 716.800 173.333 Z"/> 9 | <path d="M921.600 88 C920.127 88 918.933 86.806 918.933 85.333 C918.933 83.861 920.127 82.667 921.600 82.667 C923.073 82.667 924.267 83.861 924.267 85.333 C924.267 86.806 923.073 88 921.600 88 Z"/> 10 | </svg> 11 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical_err_value.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | scale-x: categorical("blah" "fu"); 6 | data-x: list("a" "b" "c" "d" "e"); 7 | data-y: list(200px 300px 200px 300px 100px); 8 | } 9 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical_err_value.err: -------------------------------------------------------------------------------- 1 | ERROR: the value 'a' is not part of the categories list 2 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical_err_wrongscale.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: list("a" "b" "c" "d" "e"); 6 | data-y: list(200px 300px 200px 300px 100px); 7 | } 8 | -------------------------------------------------------------------------------- /test/plot-points/points_categorical_err_wrongscale.err: -------------------------------------------------------------------------------- 1 | ERROR: data 'a' is not a valid number; if this is intentional, set 'scale-[x,y] to (categorical ...)' 2 | -------------------------------------------------------------------------------- /test/plot-points/points_color_steps.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/gauss3d.csv x); 6 | data-y: csv(test/testdata/gauss3d.csv y); 7 | limit-x: 0 400; 8 | limit-y: 0 200; 9 | colors: csv(test/testdata/gauss3d.csv z); 10 | color-map: steps(0 #f00 0.2 #0f0 0.4 #00f 0.6 #0f0 0.8 #f00 1.0 #00f); 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-points/points_colors.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/gauss3d.csv x); 6 | data-y: csv(test/testdata/gauss3d.csv y); 7 | limit-x: 0 400; 8 | limit-y: 0 200; 9 | colors: csv(test/testdata/gauss3d.csv z); 10 | color-map: gradient(0 #f00 1.0 #00f); 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-points/points_geojson.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data: "test/plot-points/points_geojson_data.geojson"; 6 | size: 8px; 7 | } 8 | -------------------------------------------------------------------------------- /test/plot-points/points_geojson.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M1024 4.000 C1021.791 4.000 1020 2.209 1020 -0.000 C1020 -2.209 1021.791 -4.000 1024 -4.000 C1026.209 -4.000 1028 -2.209 1028 -0.000 C1028 2.209 1026.209 4.000 1024 4.000 Z"/> 6 | <path d="M389.456 225.694 C387.247 225.694 385.456 223.903 385.456 221.694 C385.456 219.485 387.247 217.694 389.456 217.694 C391.665 217.694 393.456 219.485 393.456 221.694 C393.456 223.903 391.665 225.694 389.456 225.694 Z"/> 7 | <path d="M0 516.000 C-2.209 516.000 -4 514.209 -4 512.000 C-4 509.791 -2.209 508.000 0 508.000 C2.209 508.000 4 509.791 4 512.000 C4 514.209 2.209 516.000 0 516.000 Z"/> 8 | </svg> 9 | -------------------------------------------------------------------------------- /test/plot-points/points_geojson_data.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { 5 | "type": "Feature", 6 | "properties": {}, 7 | "geometry": { 8 | "type": "Point", 9 | "coordinates": [ 10 | 13.271484375, 11 | 52.61639023304539 12 | ] 13 | } 14 | }, 15 | { 16 | "type": "Feature", 17 | "properties": {}, 18 | "geometry": { 19 | "type": "Point", 20 | "coordinates": [ 21 | 4.9658203125, 22 | 52.16045455774706 23 | ] 24 | } 25 | }, 26 | { 27 | "type": "Feature", 28 | "properties": {}, 29 | "geometry": { 30 | "type": "Point", 31 | "coordinates": [ 32 | -0.1318359375, 33 | 51.56341232867588 34 | ] 35 | } 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /test/plot-points/points_size_map.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | 4 | points { 5 | data-x: csv(test/testdata/gauss3d.csv x); 6 | data-y: csv(test/testdata/gauss3d.csv y); 7 | sizes: csv(test/testdata/gauss3d.csv z); 8 | size-map: linear(2pt 6pt); 9 | limit-x: 0 400; 10 | limit-y: 0 200; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-vectors/vectors_basic.clp: -------------------------------------------------------------------------------- 1 | size: 1024px 512px; 2 | dpi: 96; 3 | limit-x: 0 1000; 4 | limit-y: 0 400; 5 | 6 | vectors { 7 | data-x: list(100 500 700 600 300); 8 | data-y: list(200 300 200 300 100); 9 | data-dx: 10 5 -30 -14 12; 10 | data-dy: 10 9 10 8 5; 11 | } 12 | -------------------------------------------------------------------------------- /test/plot-vectors/vectors_basic.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- Generated by clip v0.8.0 (clip-lang.org) --> 3 | <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="512"> 4 | <rect width="1024" height="512" fill="#ffffff" fill-opacity="1"/> 5 | <path d="M102.400 256 L112.640 243.200" fill="none" stroke="#000000" stroke-width="1.333"/> 6 | <path d="M114.722 244.866 L110.558 241.534 L115.972 239.035 Z"/> 7 | <path d="M512 128 L517.120 116.480" fill="none" stroke="#000000" stroke-width="1.333"/> 8 | <path d="M519.557 117.563 L514.683 115.397 L519.286 111.606 Z"/> 9 | <path d="M716.800 256 L686.080 243.200" fill="none" stroke="#000000" stroke-width="1.333"/> 10 | <path d="M687.106 240.738 L685.054 245.662 L681.157 241.149 Z"/> 11 | <path d="M614.400 128 L600.064 117.760" fill="none" stroke="#000000" stroke-width="1.333"/> 12 | <path d="M601.614 115.590 L598.514 119.930 L595.724 114.660 Z"/> 13 | <path d="M307.200 384 L319.488 377.600" fill="none" stroke="#000000" stroke-width="1.333"/> 14 | <path d="M320.720 379.965 L318.256 375.235 L324.218 375.136 Z"/> 15 | </svg> 16 | -------------------------------------------------------------------------------- /test/testdata/.gitignore: -------------------------------------------------------------------------------- 1 | *.geojson 2 | -------------------------------------------------------------------------------- /test/testdata/areadata.csv: -------------------------------------------------------------------------------- 1 | series,x,y,z,w 2 | series1,10,34,43,A 3 | series1,15,38,65,B 4 | series1,20,43,46,C 5 | series1,30,33,38,D 6 | series1,40,21,38,E 7 | series1,50,33,55,F 8 | -------------------------------------------------------------------------------- /test/testdata/areadata2.csv: -------------------------------------------------------------------------------- 1 | x,y,z,y2,z2 2 | 10,-34,34,-24,31 3 | 15,-30,38,-20,33 4 | 20,-20,43,-10,30 5 | 30,-24,33,-20,27 6 | 40,-18,21,-7,13 7 | 50,-32,33,-18,30 8 | -------------------------------------------------------------------------------- /test/testdata/bardata.csv: -------------------------------------------------------------------------------- 1 | var0,var1,var2,var3,var4,var5,var6 2 | 1,34,43,A,5,54,A 3 | 2,38,65,B,12,55,B 4 | 3,43,46,C,-0,63,C 5 | 4,33,38,D,17,53,D 6 | 5,21,38,E,18,41,E 7 | 6,33,55,F,0,53,F 8 | -------------------------------------------------------------------------------- /test/testdata/bardata_quoted.csv: -------------------------------------------------------------------------------- 1 | var0,var1,var2,var3,var4,var5,var6 2 | 1,34,43,A,5,54,"A" 3 | 2,38,65,B as in 'beans',12,55,B as in 'beans' 4 | 3,43,46,"C as in ""coffee""",-0,63,"C as in ""coffee""" 5 | 4,33,38,D,17,53,"D" 6 | 5,21,38,E,18,41,"E" 7 | 6,33,55,F,0,53,"F as in ""Fire!!!""" 8 | -------------------------------------------------------------------------------- /test/testdata/city_temperatures.csv: -------------------------------------------------------------------------------- 1 | month,month_name,temp_london,temp_nyc,temp_beijing,temp_moscow,temp_berlin,temp_telaviv 2 | 1,Jan,3.9,-0.2,-4,-7.4,-0.9,13 3 | 2,Feb,4.2,0.8,-1.4,-5.8,0.6,13 4 | 3,Mar,5.7,5.7,5.4,-0.1,3.5,15 5 | 4,Apr,8.5,11.3,13.5,7.1,8.4,19 6 | 5,May,11.9,17.0,19.9,14.7,13.5,24 7 | 6,Jun,15.2,22.0,23.3,17.7,17.0,26 8 | 7,Jul,17.0,24.8,24.3,20.6,18.6,28 9 | 8,Aug,16.6,24.1,23.9,18.8,17.9,28 10 | 9,Sep,14.2,20.1,19.9,12.6,14.3,25 11 | 10,Oct,10.3,14.1,13.1,6.1,9.0,23 12 | 11,Nov,6.6,8.6,4.7,1.1,3.9,18 13 | 12,Dec,4.8,2.5,-1.8,-3.6,1.0,14 14 | -------------------------------------------------------------------------------- /test/testdata/city_temperatures_london.csv: -------------------------------------------------------------------------------- 1 | month,month_name,temperature,temperature_str 2 | 1,Jan,3.9,3.9°C 3 | 2,Feb,4.2,4.2°C 4 | 3,Mar,5.7,5.7°C 5 | 4,Apr,8.5,8.5°C 6 | 5,May,11.9,11.9°C 7 | 6,Jun,15.2,15.2°C 8 | 7,Jul,17.0,17.0°C 9 | 8,Aug,16.6,16.6°C 10 | 9,Sep,14.2,14.2°C 11 | 10,Oct,10.3,10.3°C 12 | 11,Nov,6.6,6.6°C 13 | 12,Dec,4.8,4.8°C 14 | -------------------------------------------------------------------------------- /test/testdata/errorbars.csv: -------------------------------------------------------------------------------- 1 | x,y,y_min,y_max 2 | 100,10,5,20 3 | 150,18,8,28 4 | 200,40,20,50 5 | 250,45,25,55 6 | 300,80,60,110 7 | 350,70,50,100 8 | 400,30,20,70 9 | 450,20,10,30 10 | 500,50,40,110 11 | 550,90,70,110 12 | 600,60,30,90 13 | 650,60,30,90 14 | 700,40,20,60 15 | 750,40,20,60 16 | 800,180,70,220 17 | 850,200,100,400 18 | 900,50,30,70 19 | -------------------------------------------------------------------------------- /test/testdata/extract_testdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ue 3 | cd "$(dirname "$0")" 4 | 5 | for f in $(find -name "*.gz"); do 6 | if [[ ! -e "${f/.gz/}" ]]; then 7 | gunzip --k "$f" 8 | fi 9 | done 10 | -------------------------------------------------------------------------------- /test/testdata/field2d.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import math 3 | import numpy 4 | 5 | d=0.1 6 | print("x,y,a") 7 | for x in numpy.arange(-5, 5, d): 8 | for y in numpy.arange(-2, 2.0, d): 9 | a = min(abs(1 - ((x * 0.7)**2 + (y*0.9) ** 2)), 1.0) 10 | a -= (((x * 0.2)**2 + (y*0.2) ** 2)) * 0.8 11 | print("%f,%f,%f" % (x * 100 + 5, y * 100 + 5, a)) 12 | 13 | -------------------------------------------------------------------------------- /test/testdata/fonts/LiberationSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/test/testdata/fonts/LiberationSans-Regular.ttf -------------------------------------------------------------------------------- /test/testdata/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/test/testdata/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /test/testdata/gauss2d.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import random 3 | 4 | print("x,y,z") 5 | for i in range(0, 1000): 6 | x = random.gauss(200.0, 50.0) 7 | y = random.gauss(100.0, 20.0) 8 | z = min(1.0, max(0, (y - 60) / 60.0)) 9 | print("%f,%f,%f" % (x, y,z )) 10 | 11 | -------------------------------------------------------------------------------- /test/testdata/gdp_bar_chart.sql: -------------------------------------------------------------------------------- 1 | IMPORT TABLE gdp_per_country 2 | FROM 'csv:test/fixtures/gbp_per_country_simple.csv?headers=true'; 3 | 4 | DRAW BARCHART 5 | AXIS BOTTOM 6 | AXIS LEFT; 7 | 8 | SELECT 9 | 'gross domestic product per country' AS series, 10 | country AS x, 11 | gbp AS y 12 | FROM 13 | gdp_per_country 14 | LIMIT 30; 15 | -------------------------------------------------------------------------------- /test/testdata/gdp_per_capita_2010.csv: -------------------------------------------------------------------------------- 1 | rank,country,gdp,gdp_label 2 | 1,United States,18.624,"$18,624bln" 3 | 2,China,11.218,"$11,218bln" 4 | 3,Japan,4.936,"$11,218bln" 5 | 4,Germany,3.477,"$11,218bln" 6 | 5,United Kingdom,2.647,"$11,218bln" 7 | 6,France,2.465,"$2,465bln" 8 | 7,India,2.259,"$2.259bln" 9 | 8,Italy,1.858,"$1.858bln" 10 | 9,Brazil,1.795,"$1.795bln" 11 | -------------------------------------------------------------------------------- /test/testdata/gdp_per_capita_small.csv: -------------------------------------------------------------------------------- 1 | country,isocode,year,gdp 2 | France,FRA,2008,32172.476205 3 | France,FRA,2009,31012.113446 4 | France,FRA,2010,31299.299769 5 | Italy,ITA,2008,29901.461061 6 | Italy,ITA,2009,28007.831419 7 | Italy,ITA,2010,28380.923754 8 | Spain,ESP,2008,29145.141707 9 | Spain,ESP,2009,27664.418339 10 | Spain,ESP,2010,27332.007817 11 | Greece,GRC,2008,27425.860321 12 | Greece,GRC,2009,26159.719383 13 | Greece,GRC,2010,25225.515906 14 | -------------------------------------------------------------------------------- /test/testdata/gulf_of_mexico.geojson.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmuth/clip/5fca358e56e6334a22aa09264f2ccb7d41bd156f/test/testdata/gulf_of_mexico.geojson.gz -------------------------------------------------------------------------------- /test/testdata/histogram.csv: -------------------------------------------------------------------------------- 1 | var0,var1 2 | 1,4945 3 | 2,45 4 | 3,6 5 | 4,4 6 | 5,2 7 | 6,1 8 | -------------------------------------------------------------------------------- /test/testdata/irregular_data.csv: -------------------------------------------------------------------------------- 1 | series,x,y,z 2 | series1,-8,34,5 3 | series1,2,-18,23 4 | series1,12,43,11 5 | series1,14,-19,9 6 | series1,17,25,14 7 | series1,20,33,8 8 | series2,-10,34,5 9 | series2,-8,18,8 10 | series2,2,-4,23 11 | series2,9,19,2 12 | series2,10,-25,4 13 | series2,12,-23,17 14 | -------------------------------------------------------------------------------- /test/testdata/irregular_data1.csv: -------------------------------------------------------------------------------- 1 | x,y,z 2 | -10,34,5 3 | -8,18,8 4 | 2,-4,23 5 | 9,19,2 6 | 10,-25,4 7 | 12,-23,17 8 | -------------------------------------------------------------------------------- /test/testdata/irregular_data2.csv: -------------------------------------------------------------------------------- 1 | x,y,z 2 | -8,34,5 3 | 2,-18,23 4 | 12,43,11 5 | 14,-19,9 6 | 17,25,14 7 | 20,33,8 8 | -------------------------------------------------------------------------------- /test/testdata/log_example.csv: -------------------------------------------------------------------------------- 1 | x,y 2 | 1,0 3 | 2,10 4 | 3,100 5 | 4,1000 6 | 5,10000 7 | -------------------------------------------------------------------------------- /test/testdata/point_example.csv: -------------------------------------------------------------------------------- 1 | series,x,y,z 2 | series1,10,34,0.5 3 | series1,15,-18,0.23 4 | series1,20,40,0.11 5 | series1,30,-19,0.9 6 | series1,40,25,0.14 7 | series1,50,33,0.8 8 | series2,-10,34,0.5 9 | series2,-15,18,0.8 10 | series2,-20,-4,0.23 11 | series2,-30,19,0.2 12 | series2,-40,-25,0.4 13 | series2,-50,-23,0.17 14 | -------------------------------------------------------------------------------- /test/testdata/simple.csv: -------------------------------------------------------------------------------- 1 | var1,var2,var3 2 | 10,1.23,1.23, 3 | 20,4.32,-4.32, 4 | 30,3.23,-3.23, 5 | 40,6.43,-6.43, 6 | 50,3.45,3.45, 7 | 60,12.32,12.32, 8 | 70,8.14,8.14, 9 | 80,5.2,-5.2, 10 | 90,3.5,-3.5, 11 | 100,2.2,2.2, 12 | -------------------------------------------------------------------------------- /test/testdata/stacked.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import math 3 | 4 | n = 46 5 | print("x,y1,y2,y3,y4") 6 | for i in range(0, n): 7 | x = (i / float(n - 1)) * 2.0 8 | y1 = (3 + math.sin(x*1.5) + math.sin(x*1.5 - 2) * 4) * 2 + 4 9 | y2 = y1 + (3 + math.sin(x*1.2) + math.sin(x*2 - 1.8) * 3) * 2 10 | y3 = y2 + (3 + math.sin(x*1.5) + math.sin(x*1.5 - 2) * 4) * 2 + 4 11 | y4 = y3 + (3 + math.sin(x*1.5) + math.sin(x*1.5 - 2) * 4) * 2 + 4 12 | print("%f,%f,%f,%f,%f" % (x, y1, y2, y3, y4)) 13 | -------------------------------------------------------------------------------- /test/testdata/timeseries.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import math 3 | import random 4 | 5 | n = 400 6 | d = 0 7 | print("time,value") 8 | for i in range(0, n*2): 9 | x = i / float(n) 10 | x1 = (0.7 - x) * 80 11 | 12 | y0 = -.3 13 | y1 = (math.sin(x1) / x1 if x1 != 0 else 1) * 0.8 14 | 15 | x2 = (0.3 - x) * 90 16 | y2 = (math.sin(x2) / x2 if x2 != 0 else 1) * 0.4 17 | 18 | y3 = random.gauss(0, 0.03) 19 | 20 | y4 = x * 0.5 21 | y5 = min(0, 1.8 + ((1.0 - x) * -2)) 22 | 23 | x6 = (1.4 - x) * 50 24 | y6 = (math.sin(x6) / x6 if x6 != 0 else 1) * 0.9 25 | 26 | y = y0 + y1 + y2 + y3 + y4 + y5 + y6 27 | 28 | time = x * 3600 29 | value = (y * 32) + 32 30 | print("%f,%f" % (time, value)) 31 | -------------------------------------------------------------------------------- /test/testdata/vectorfield.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import math 3 | import numpy 4 | 5 | print("x,y,dx,dy") 6 | for x in numpy.arange(-3.8, 4.0, 0.2): 7 | for y in numpy.arange(-1.6, 2.0, 0.2): 8 | a = math.atan(y**2 - x); 9 | dx = math.sin(a) 10 | dy = math.cos(a) 11 | print("%f,%f,%f,%f" % (x , y - 0.14, max(dx, 0.0) * 0.1, dy * 0.08)) 12 | 13 | --------------------------------------------------------------------------------