#sys #raw

sys implot-sys

Raw FFI bindings to implot

4 releases (breaking)

0.4.0 Feb 10, 2021
0.3.0 Nov 29, 2020
0.2.0 Nov 11, 2020
0.1.0 Oct 12, 2020

#95 in GUI

Download history 35/week @ 2021-04-11 36/week @ 2021-04-18 42/week @ 2021-04-25 37/week @ 2021-05-02 33/week @ 2021-05-09 38/week @ 2021-05-16 32/week @ 2021-05-23 43/week @ 2021-05-30 37/week @ 2021-06-06 8/week @ 2021-06-13 4/week @ 2021-06-20 7/week @ 2021-06-27 6/week @ 2021-07-04 5/week @ 2021-07-11 10/week @ 2021-07-18 13/week @ 2021-07-25

1,257 downloads per month
Used in implot

MIT/Apache

1.5MB
25K SLoC

Lua 12K SLoC // 0.0% comments C++ 8K SLoC // 0.1% comments Rust 5K SLoC // 0.0% comments Batch 3 SLoC // 0.8% comments Shell 1 SLoC // 0.9% comments

implot-rs

Rust bindings for ImPlot, built by running bindgen on cimplot.

The bindings are currently based on ImPlot version 0.9-WIP (see implot-sys/third-party for the exact commit currently pointed to). The status section below provides detailed information on implementation status.

Docs.rs documentation Tests

Important note: As long as the code is pre-1.0 release, the API is expected to have breaking changes between minor versions. Patch versions should be backwards compatible. After 1.0, semver will be followed more properly.

demo

Requirements

imgui-rs requires minimum Rust version 1.40, so this project requires at least that. The sys crate compiles implot, so a C++ compiler will also be required.

Examples

Examples are being built in the implot-examples crate in this repo. To try them out, clone the repo, change into the implot-examples directory and try for example

  cargo run --example line_plots

Documentation

For released versions, see Docs.rs documentation. Make sure to look at the right release, since the API is still changing. For the master branch, the docs can be built by cloning this repository and then running

  cargo doc --open

An effort is made to document everything as it is being added. Feel free to open an issue if documentation is unclear or lacking. Note that doc aliases are being added now, which means one should be able to look for things with the name they have in the C++ code and rustdoc should show the correspondingly-named item. Sometimes this is just a matter of changing camelcase to snake case, other times the idiomatic bindings do things a bit differently. These aliases only work with Rust 1.48 or newer.

Implementation status

Currently a work in progress, coverage of the C++ API is increased steadily. The author is open to collaboration, if you'd like to help, feel free to reach out via a Github issue.

At this point, raw bindings are working in implot-sys, and more idiomatic interfaces for plot creation as well a subset of the functionality for plots are implemented.

While the raw bindings have versions of most functions for different data types such as 32-bit or 64-bit floats and various integers, the higher-level bindings are currently only created for 64-bit floats.

  • "BeginPlot"
    • Basic hello world
    • Plot flags
  • Plotting functionality
    • Line plot
    • Text plot
    • Scatter plot
    • Bar plot
      • Vertical
      • Horizontal
    • Stairs plot
    • Heatmap
    • Shaded plot
    • Stem plots
    • Images
    • Error bar plot
      • Vertical
      • Horizontal
    • Pie chart
    • Digital data
    • Annotations
    • Dragline
    • Dragpoint
  • Plot customization
    • Axis flags
    • Styling colors
    • Styling variables
    • Colormaps
    • Legend locations
  • Plot querying
    • is hovered
    • mouse position in plot
    • plot limits
    • is queried
    • get plot query
    • are axes hovered
    • Choice of y axis
    • Are legend entries hovered
  • Utils
    • Plot limit setting
    • imgui-rs style safe push/pop stacks
    • Plot tick setting
    • Pixel to plot position
    • Plot to pixel position
    • Set Y axis setting for subsequent elements
    • Input remapping
    • Set non-default Y axis ticks and labels
    • Plot position and size reading
    • Push/pop plotclip rect (?)

Developer documentation

Design approach

This repo tries to follow the approaches and style used in imgui-rs somewhat closely, because implot is to be used within imgui programs, and hence keeping the interfaces and design philosophies close should make it easier to do that.

If you spot any design inconsistencies or paper cuts, feel free to open an issue.

Dependencies

~2MB
~40K SLoC