Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup API #294

Merged
merged 34 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7803008
add new padding algo
epezent Jul 30, 2021
3392dee
Merge branch 'master' into features/opposite
epezent Jul 31, 2021
851933a
opposite working for y and x
epezent Aug 1, 2021
dd8ee00
remove name axis colors
epezent Aug 1, 2021
79e54b4
move title label rendering
epezent Aug 1, 2021
848f082
axis dev
epezent Aug 2, 2021
ad61a0b
clean up
epezent Aug 3, 2021
ae22845
pre formatter
epezent Aug 4, 2021
da66d80
formatter
epezent Aug 4, 2021
30b0f06
changing over to multi x axes
epezent Aug 4, 2021
5b311bf
more multi x changes
epezent Aug 5, 2021
cb3b37f
more multi x changes
epezent Aug 5, 2021
f8f2cab
more multi x changes
epezent Aug 7, 2021
117a03f
setup 75% there
epezent Aug 8, 2021
d2c4f8e
85% there
epezent Aug 8, 2021
613c4df
85% there
epezent Aug 8, 2021
9fa4434
remove query
epezent Aug 9, 2021
ed6fe69
update input handling
epezent Aug 9, 2021
4e0eb49
input and dnd tweaking
epezent Aug 10, 2021
7678ebc
input testing
epezent Sep 8, 2021
eca71ce
Merge branch 'master' into features/setup
epezent Sep 8, 2021
2454c43
update demo
epezent Sep 19, 2021
f3fea3b
setup debug
epezent Oct 9, 2021
0f036b0
setup debug
epezent Oct 9, 2021
4e650b2
bug fixes
epezent Oct 10, 2021
2ed9b87
bug fixes
epezent Oct 10, 2021
d1cd171
more debug
epezent Oct 11, 2021
6a4e4e8
input
epezent Oct 11, 2021
a351a6b
more setup
epezent Oct 12, 2021
abc8aea
setup api almost complete
epezent Oct 13, 2021
de85605
setup api almost complete
epezent Oct 13, 2021
c9371a1
more clean up
epezent Oct 13, 2021
4c9542c
cleanup
epezent Oct 19, 2021
766a4f9
final commit before merge
epezent Oct 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ImPlot is an immediate mode, GPU accelerated plotting library for [Dear ImGui](h
- subplots
- time formatted x-axes (US formatted or ISO 8601)
- reversible and lockable axes
- up to three independent y-axes
- multiple x-axes and y-axes
- controls for zooming, panning, box selection, and auto-fitting data
- controls for creating persistent query ranges (see demo)
- several plot styling options: 10 marker types, adjustable marker sizes, line weights, outline colors, fill colors, etc.
Expand Down Expand Up @@ -110,20 +110,20 @@ A: ImGui is an incredibly powerful tool for rapid prototyping and development, b

**Q: Is ImPlot the right plotting library for me?**

A: If you're looking to generate publication quality plots and/or export plots to a file, ImPlot is NOT the library for you. ImPlot is geared toward plotting application data at realtime speeds. ImPlot does its best to create pretty plots (indeed, there are quite a few styling options available), but it will always favor function over form.
A: If you're looking to generate publication quality plots and/or export plots to a file, ImPlot is NOT the library for you! ImPlot is geared toward plotting application data at realtime speeds with high levels of interactivity. ImPlot does its best to create pretty plots (indeed, there are quite a few styling options available), but it will always favor function over form.

**Q: Where is the documentation?**

A: The API is thoroughly commented in `implot.h`, and the demo in `implot_demo.cpp` should be more than enough to get you started.
A: The API is thoroughly commented in `implot.h`, and the demo in `implot_demo.cpp` should be more than enough to get you started. Also take a look at the [implot_demos](https://github.com/epezent/implot_demos) repository.

**Q: Is ImPlot suitable for plotting large datasets?**

A: Yes, within reason. You can plot tens to hundreds of thousands of points without issue, but don't expect millions to be a buttery smooth experience. That said, you can always downsample extremely large datasets by telling ImPlot to stride your data at larger intervals if needed.
A: Yes, within reason. You can plot tens to hundreds of thousands of points without issue, but don't expect millions to be a buttery smooth experience. That said, you can always downsample extremely large datasets by telling ImPlot to stride your data at larger intervals if needed. Also try the experimental `backends` branch which aims to provide GPU acceleration support.

**Q: What data types can I plot?**

A: ImPlot plotting functions accept most scalar types:
`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built in striding features (see `implot.h` for documentation).
`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built in striding features (see `implot.h` for documentation), and many plotters provide a "getter" overload which accepts data generating callbacks.

**Q: Can plot styles be modified?**

Expand All @@ -135,7 +135,7 @@ A: Yep! Both logscale and timescale are supported.

**Q: Does ImPlot support multiple y-axes? x-axes?**

A: Yes. Up to three y-axes can be enabled. Multiple x-axes are not supported.
A: Yes. Up to three x-axes and three y-axes can be enabled.

**Q: Does ImPlot support [insert plot type]?**

Expand All @@ -157,9 +157,9 @@ A: Not exactly, but it does give you the ability to query plot sub-ranges, with

A: Not currently. Use your OS's screen capturing mechanisms if you need to capture a plot. ImPlot is not suitable for rendering publication quality plots; it is only intended to be used as a visualization tool. Post-process your data with MATLAB or matplotlib for these purposes.

**Q: Can a compile ImPlot as a dynamic library?**
**Q: Can I compile ImPlot as a dynamic library?**

A: Like ImGui, it is recommended that you compile and link ImPlot as a *static* library or directly as a part of your sources. However, if you are compiling ImPlot and ImGui as separate DLLs, make sure you set the current *ImGui* context with `ImPlot::SetImGuiContext(ImGuiContext* ctx)`. This ensures that global ImGui variables are correctly shared across the DLL boundary.
A: Like ImGui, it is recommended that you compile and link ImPlot as a *static* library or directly as a part of your sources. However, if you must and are compiling ImPlot and ImGui as separate DLLs, make sure you set the current *ImGui* context with `ImPlot::SetImGuiContext(ImGuiContext* ctx)`. This ensures that global ImGui variables are correctly shared across the DLL boundary.

**Q: Can ImPlot be used with other languages/bindings?**

Expand Down
51 changes: 37 additions & 14 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,69 @@
The list below represents a combination of high-priority work, nice-to-have features, and random ideas. We make no guarantees that all of this work will be completed or even started. If you see something that you need or would like to have, let us know, or better yet consider submitting a PR for the feature.

## Plots
## API

- remove axis-related args from signature of `BeginPlot` and add `SetupNextAxis` API
- add a few overloads of `BeginPlot` that bypass `SetupNextAxis` for common scenarios
- make current `BeginPlot` a wrapper to this API
- add shortcut/legacy overloads for BeginPlot

## Axes

- add support for multiple x-axes and don't limit count to 3
- will require `SetupNextAxis` API
- make axis side configurable (top/left, right/bottom) via new flag `ImPlotAxisFlags_Opposite`
- add support for setting tick label strings via callback
- add flag to remove weekends on Time axis
- pixel space scale (`ImPlotTransform_Display`), normalized space scale (`ImPlotTransform_Axes`), data space scale (`ImPloTransform_Data`)
- make ImPlotFlags_Equal not a flag -> `SetupEqual(ImPlotAxis x, ImPlotAxis y)`
- allow inverted arguments `SetAxes` to transpose data?
- `SetupAxisColors()`
- `SetupAxisConstraints()`
- `SetupAxisHome()`

## Plot Items

- add `ImPlotLineFlags`, `ImPlotBarsFlags`, etc. for each plot type
- add `PlotBarGroups` wrapper that makes rendering groups of bars easier
- add `PlotBarGroups` wrapper that makes rendering groups of bars easier, with stacked bar support
- add `PlotBubbles` (see MATLAB bubble chart)
- add non-zero references for `PlotBars` etc.

- add exploding to `PlotPieChart` (on hover-highlight?)

## Styling

- support gradient and/or colormap sampled fills (e.g. ImPlotFillStyle_)
- add hover/active color for plot
- add hover/active color for plot axes
- API for setting different fonts for plot elements

## Colormaps

- gradient editing tool
- `RemoveColormap`

## Legend

- change `SetLegendLocation` API to be more consistent, i.e. `SetNextLegendLocation`
- add legend scroll
- `ImPlotLegendFlags_SortItems`
- `ImPlotLegendFlags_Scroll`
- improve legend icons (e.g. adopt markers, gradients, etc)
- `ImPlotLegendFlags`
- make legend frame use ButtonBehavior (maybe impossible)

## Tools / Misc.

- add `IsPlotChanging` to detect change in limits
- add ability to extend plot/axis context menus
- add LTTB downsampling for lines
- add box selection to axes
- first frame render delay might fix "fit pop" effect
- move some code to new `implot_tools.cpp`

## Optimizations

- find faster way to buffer data into ImDrawList (very slow)
- reduce number of calls to `PushClipRect`
- explore SIMD operations for high density plot items

## Completed
- make BeginPlot take fewer args:
- make query a tool -> `DragRect`
- rework DragLine/Point to use ButtonBehavior
- add support for multiple x-axes and don't limit count to 3
- make axis side configurable (top/left, right/bottom) via new flag `ImPlotAxisFlags_Opposite`
- add support for setting tick label strings via callback
- give each axis an ID, remove ad-hoc DND solution
- allow axis to be drag to opposite side (ala ImGui Table headers)
- legend items can be hovered even if plot is not
- fix frame delay on DragX tools
- remove tag from drag line/point -> add `Tag` tool
Loading