Skip to content

Commit

Permalink
Support multiple Y axes simultaneously
Browse files Browse the repository at this point in the history
This allows up to 3 Y axes to be used, one on the left side, and up to
2 on the right.  To use multiple axes, one of the `ImPlotFlags_Y2Axis`
or `ImPlotFlags_Y3Axis` must be passed to `BeginPlot`.  Then, before
each Plot call, SetPlotYAxis may be used to set that plot on an
alternate axis.

An extra line and ticks are rendered off to the right if all 3 axes
are configured (although those ticks are always only 5 long,
regardless of major status).  Each of the axes, when present, has a
(possibly invisible if ticks and labels are disabled) hit target that
can be used to scroll and scale that axis independently.

Some other changes were required to make this happen:
 * Queries are now only in pixel coordinates
 * ImPlotRange has been renamed to ImPlotBounds (and correspondingly
   GetPlotRange is now GetPlotBounds)
 * All APIs which allow querying values in plot coordinates now have
   an optional "y_axis" argument, which can be -1 to use the currently
   selected axis, or non-negative to pick a specific axes.
 * BeginPlot used to lock all flags on the first call.  Now it only
   locks the axis flags, and not the primary plot flags.
 * The mouseover text now renders the 2nd and 3rd axis in parenthesis.
  • Loading branch information
jpieper committed May 11, 2020
1 parent 59bc426 commit 5eb4b71
Show file tree
Hide file tree
Showing 3 changed files with 796 additions and 466 deletions.

0 comments on commit 5eb4b71

Please sign in to comment.