Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions implot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ You can read releases logs https://github.com/epezent/implot/releases for more d
- 2020/09/07 (0.8) - Plotting functions which accept a custom getter function pointer have been post-fixed with a G (e.g. PlotLineG)
- 2020/09/06 (0.7) - Several flags under ImPlotFlags and ImPlotAxisFlags were inverted (e.g. ImPlotFlags_Legend -> ImPlotFlags_NoLegend) so that the default flagset
is simply 0. This more closely matches ImGui's style and makes it easier to enable non-default but commonly used flags (e.g. ImPlotAxisFlags_Time).
- 2020/08/28 (0.5) - ImPlotMarker_ can no longer be combined with bitwise OR, |. This features caused unecessary slow-down, and almost no one used it.
- 2020/08/28 (0.5) - ImPlotMarker_ can no longer be combined with bitwise OR, |. This features caused unnecessary slow-down, and almost no one used it.
- 2020/08/25 (0.5) - ImPlotAxisFlags_Scientific was removed. Logarithmic axes automatically uses scientific notation.
- 2020/08/17 (0.5) - PlotText was changed so that text is centered horizontally and vertically about the desired point.
- 2020/08/16 (0.5) - An ImPlotContext must be explicitly created and destroyed now with `CreateContext` and `DestroyContext`. Previously, the context was statically initialized in this source file.
Expand Down Expand Up @@ -315,7 +315,7 @@ static const ImPlotStyleVarInfo GPlotStyleVarInfo[] =
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, MajorGridSize) }, // ImPlotStyleVar_MajorGridSize
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, MinorGridSize) }, // ImPlotStyleVar_MinorGridSize
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, PlotPadding) }, // ImPlotStyleVar_PlotPadding
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, LabelPadding) }, // ImPlotStyleVar_LabelPaddine
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, LabelPadding) }, // ImPlotStyleVar_LabelPadding
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, LegendPadding) }, // ImPlotStyleVar_LegendPadding
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, LegendInnerPadding) }, // ImPlotStyleVar_LegendInnerPadding
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImPlotStyle, LegendSpacing) }, // ImPlotStyleVar_LegendSpacing
Expand Down Expand Up @@ -3632,7 +3632,7 @@ void EndSubplots() {
// remove items
if (gp.CurrentItems == &subplot.Items)
gp.CurrentItems = nullptr;
// reset the plot items for the next frame (TODO: put this elswhere)
// reset the plot items for the next frame (TODO: put this elsewhere)
for (int i = 0; i < subplot.Items.GetItemCount(); ++i) {
subplot.Items.GetItemByIndex(i)->SeenThisFrame = false;
}
Expand Down Expand Up @@ -5217,7 +5217,7 @@ void ShowAxisMetrics(const ImPlotPlot& plot, const ImPlotAxis& axis) {
ImGui::BulletText("Range: [%f,%f]",axis.Range.Min, axis.Range.Max);
ImGui::BulletText("Pixels: %f", axis.PixelSize());
ImGui::BulletText("Aspect: %f", axis.GetAspect());
ImGui::BulletText(axis.OrthoAxis == nullptr ? "OrtherAxis: NULL" : "OrthoAxis: 0x%08X", axis.OrthoAxis->ID);
ImGui::BulletText(axis.OrthoAxis == nullptr ? "OrthoAxis: NULL" : "OrthoAxis: 0x%08X", axis.OrthoAxis->ID);
ImGui::BulletText("LinkedMin: %p", (void*)axis.LinkedMin);
ImGui::BulletText("LinkedMax: %p", (void*)axis.LinkedMax);
ImGui::BulletText("HasRange: %s", axis.HasRange ? "true" : "false");
Expand Down
32 changes: 16 additions & 16 deletions implot.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
// Using ImPlot via a shared library is not recommended, because we don't guarantee
// backward nor forward ABI compatibility and also function call overhead. If you
// do use ImPlot as a DLL, be sure to call SetImGuiContext (see Miscellanous section).
// do use ImPlot as a DLL, be sure to call SetImGuiContext (see Miscellaneous section).
#ifndef IMPLOT_API
#define IMPLOT_API
#endif
Expand Down Expand Up @@ -123,14 +123,14 @@ enum ImAxis_ {
ImAxis_Y1, // enabled by default
ImAxis_Y2, // disabled by default
ImAxis_Y3, // disabled by default
// bookeeping
// bookkeeping
ImAxis_COUNT
};

// Options for plots (see BeginPlot).
enum ImPlotFlags_ {
ImPlotFlags_None = 0, // default
ImPlotFlags_NoTitle = 1 << 0, // the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot")
ImPlotFlags_NoTitle = 1 << 0, // the plot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. "##MyPlot")
ImPlotFlags_NoLegend = 1 << 1, // the legend will not be displayed
ImPlotFlags_NoMouseText = 1 << 2, // the mouse position, in plot coordinates, will not be displayed inside of the plot
ImPlotFlags_NoInputs = 1 << 3, // the user will not be able to interact with the plot
Expand Down Expand Up @@ -169,7 +169,7 @@ enum ImPlotAxisFlags_ {
// Options for subplots (see BeginSubplot)
enum ImPlotSubplotFlags_ {
ImPlotSubplotFlags_None = 0, // default
ImPlotSubplotFlags_NoTitle = 1 << 0, // the subplot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MySubplot")
ImPlotSubplotFlags_NoTitle = 1 << 0, // the subplot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. "##MySubplot")
ImPlotSubplotFlags_NoLegend = 1 << 1, // the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled)
ImPlotSubplotFlags_NoMenus = 1 << 2, // the user will not be able to open context menus with right-click
ImPlotSubplotFlags_NoResize = 1 << 3, // resize splitters between subplot cells will be not be provided
Expand Down Expand Up @@ -305,7 +305,7 @@ enum ImPlotHistogramFlags_ {
ImPlotHistogramFlags_Horizontal = 1 << 10, // histogram bars will be rendered horizontally (not supported by PlotHistogram2D)
ImPlotHistogramFlags_Cumulative = 1 << 11, // each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D)
ImPlotHistogramFlags_Density = 1 << 12, // counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set
ImPlotHistogramFlags_NoOutliers = 1 << 13, // exclude values outside the specifed histogram range from the count toward normalizing and cumulative counts
ImPlotHistogramFlags_NoOutliers = 1 << 13, // exclude values outside the specified histogram range from the count toward normalizing and cumulative counts
ImPlotHistogramFlags_ColMajor = 1 << 14 // data will be read in column major order (not supported by PlotHistogram)
};

Expand Down Expand Up @@ -355,7 +355,7 @@ enum ImPlotCol_ {
ImPlotCol_LegendText, // legend text color (defaults to ImPlotCol_InlayText)
ImPlotCol_TitleText, // plot title text color (defaults to ImGuiCol_Text)
ImPlotCol_InlayText, // color of text appearing inside of plots (defaults to ImGuiCol_Text)
ImPlotCol_AxisText, // axis label and tick lables color (defaults to ImGuiCol_Text)
ImPlotCol_AxisText, // axis label and tick labels color (defaults to ImGuiCol_Text)
ImPlotCol_AxisGrid, // axis grid color (defaults to 25% ImPlotCol_AxisText)
ImPlotCol_AxisTick, // axis tick color (defaults to AxisGrid)
ImPlotCol_AxisBg, // background color of axis hover region (defaults to transparent)
Expand Down Expand Up @@ -404,7 +404,7 @@ enum ImPlotStyleVar_ {
enum ImPlotScale_ {
ImPlotScale_Linear = 0, // default linear scale
ImPlotScale_Time, // date/time scale
ImPlotScale_Log10, // base 10 logartithmic scale
ImPlotScale_Log10, // base 10 logarithmic scale
ImPlotScale_SymLog, // symmetric log scale
};

Expand Down Expand Up @@ -645,7 +645,7 @@ IMPLOT_API void EndPlot();

// Starts a subdivided plotting context. If the function returns true,
// EndSubplots() MUST be called! Call BeginPlot/EndPlot AT MOST [rows*cols]
// times in between the begining and end of the subplot context. Plots are
// times in between the beginning and end of the subplot context. Plots are
// added in row major order.
//
// Example:
Expand Down Expand Up @@ -746,7 +746,7 @@ IMPLOT_API void SetupAxisTicks(ImAxis axis, const double* values, int n_ticks, c
IMPLOT_API void SetupAxisTicks(ImAxis axis, double v_min, double v_max, int n_ticks, const char* const labels[]=nullptr, bool keep_default=false);
// Sets an axis' scale using built-in options.
IMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotScale scale);
// Sets an axis' scale using user supplied forward and inverse transfroms.
// Sets an axis' scale using user supplied forward and inverse transforms.
IMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotTransform forward, ImPlotTransform inverse, void* data=nullptr);
// Sets an axis' limits constraints.
IMPLOT_API void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);
Expand Down Expand Up @@ -776,7 +776,7 @@ IMPLOT_API void SetupFinish();
// using a preceding button or slider widget to change the plot limits). In
// this case, you can use the `SetNext` API below. While this is not as feature
// rich as the Setup API, most common needs are provided. These functions can be
// called anwhere except for inside of `Begin/EndPlot`. For example:
// called anywhere except for inside of `Begin/EndPlot`. For example:

// if (ImGui::Button("Center Plot"))
// ImPlot::SetNextPlotLimits(-1,1,-1,1);
Expand Down Expand Up @@ -806,7 +806,7 @@ IMPLOT_API void SetNextAxesToFit();
// [SECTION] Plot Items
//-----------------------------------------------------------------------------

// The main plotting API is provied below. Call these functions between
// The main plotting API is provided below. Call these functions between
// Begin/EndPlot and after any Setup API calls. Each plots data on the current
// x and y axes, which can be changed with `SetAxis/Axes`.
//
Expand Down Expand Up @@ -978,7 +978,7 @@ IMPLOT_API ImVec2 PlotToPixels(double x, double y, ImAxis x_axis = IMPLOT_AUTO,

// Get the current Plot position (top-left) in pixels.
IMPLOT_API ImVec2 GetPlotPos();
// Get the curent Plot size in pixels.
// Get the current Plot size in pixels.
IMPLOT_API ImVec2 GetPlotSize();

// Returns the mouse position in x,y coordinates of the current plot. Passing IMPLOT_AUTO uses the current axes.
Expand Down Expand Up @@ -1084,7 +1084,7 @@ IMPLOT_API void EndDragDropSource();
// manually set these colors to whatever you like, and further can Push/Pop
// them around individual plots for plot-specific styling (e.g. coloring axes).

// Provides access to plot style structure for permanant modifications to colors, sizes, etc.
// Provides access to plot style structure for permanent modifications to colors, sizes, etc.
IMPLOT_API ImPlotStyle& GetStyle();

// Style plot colors for current ImGui style (default).
Expand Down Expand Up @@ -1191,11 +1191,11 @@ IMPLOT_API ImVec4 SampleColormap(float t, ImPlotColormap cmap = IMPLOT_AUTO);
IMPLOT_API void ColormapScale(const char* label, double scale_min, double scale_max, const ImVec2& size = ImVec2(0,0), const char* format = "%g", ImPlotColormapScaleFlags flags = 0, ImPlotColormap cmap = IMPLOT_AUTO);
// Shows a horizontal slider with a colormap gradient background. Optionally returns the color sampled at t in [0 1].
IMPLOT_API bool ColormapSlider(const char* label, float* t, ImVec4* out = nullptr, const char* format = "", ImPlotColormap cmap = IMPLOT_AUTO);
// Shows a button with a colormap gradient brackground.
// Shows a button with a colormap gradient background.
IMPLOT_API bool ColormapButton(const char* label, const ImVec2& size = ImVec2(0,0), ImPlotColormap cmap = IMPLOT_AUTO);

// When items in a plot sample their color from a colormap, the color is cached and does not change
// unless explicitly overriden. Therefore, if you change the colormap after the item has already been plotted,
// unless explicitly overridden. Therefore, if you change the colormap after the item has already been plotted,
// item colors will NOT update. If you need item colors to resample the new colormap, then use this
// function to bust the cached colors. If #plot_title_id is nullptr, then every item in EVERY existing plot
// will be cache busted. Otherwise only the plot specified by #plot_title_id will be busted. For the
Expand All @@ -1207,7 +1207,7 @@ IMPLOT_API void BustColorCache(const char* plot_title_id = nullptr);
// [SECTION] Input Mapping
//-----------------------------------------------------------------------------

// Provides access to input mapping structure for permanant modifications to controls for pan, select, etc.
// Provides access to input mapping structure for permanent modifications to controls for pan, select, etc.
IMPLOT_API ImPlotInputMap& GetInputMap();

// Default input mapping: pan = LMB drag, box select = RMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
Expand Down
6 changes: 3 additions & 3 deletions implot_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ void Demo_CustomDataAndGetters() {
ImPlot::PopStyleVar();

// you can also pass C++ lambdas:
// auto lamda = [](void* data, int idx) { ... return ImPlotPoint(x,y); };
// auto lambda = [](void* data, int idx) { ... return ImPlotPoint(x,y); };
// ImPlot::PlotLine("My Lambda", lambda, data, 1000);

ImPlot::EndPlot();
Expand Down Expand Up @@ -2399,11 +2399,11 @@ void StyleSeaborn() {
style.PlotMinSize = ImVec2(300,225);
}

} // namespaece MyImPlot
} // namespace MyImPlot

// WARNING:
//
// You can use "implot_internal.h" to build custom plotting fuctions or extend ImPlot.
// You can use "implot_internal.h" to build custom plotting functions or extend ImPlot.
// However, note that forward compatibility of this file is not guaranteed and the
// internal API is subject to change. At some point we hope to bring more of this
// into the public API and expose the necessary building blocks to fully support
Expand Down
4 changes: 2 additions & 2 deletions implot_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// Constants can be changed unless stated otherwise. We may move some of these
// to ImPlotStyleVar_ over time.

// Mimimum allowable timestamp value 01/01/1970 @ 12:00am (UTC) (DO NOT DECREASE THIS)
// Minimum allowable timestamp value 01/01/1970 @ 12:00am (UTC) (DO NOT DECREASE THIS)
#define IMPLOT_MIN_TIME 0
// Maximum allowable timestamp value 01/01/3000 @ 12:00am (UTC) (DO NOT INCREASE THIS)
#define IMPLOT_MAX_TIME 32503680000
Expand Down Expand Up @@ -198,7 +198,7 @@ static inline ImU32 ImMixU32(ImU32 a, ImU32 b, ImU32 s) {
#endif
}

// Lerp across an array of 32-bit collors given t in [0.0 1.0]
// Lerp across an array of 32-bit colors given t in [0.0 1.0]
static inline ImU32 ImLerpU32(const ImU32* colors, int size, float t) {
int i1 = (int)((size - 1 ) * t);
int i2 = i1 + 1;
Expand Down
2 changes: 1 addition & 1 deletion implot_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static IMPLOT_INLINE float ImInvSqrt(float x) { return 1.0f / sqrtf(x); }
#define IMPLOT_NUMERIC_TYPES (ImS8)(ImU8)(ImS16)(ImU16)(ImS32)(ImU32)(ImS64)(ImU64)(float)(double)
#endif

// CALL_INSTANTIATE_FOR_NUMERIC_TYPES will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types.
// CALL_INSTANTIATE_FOR_NUMERIC_TYPES will duplicate the template instantiation code `INSTANTIATE_MACRO(T)` on supported types.
#define _CAT(x, y) _CAT_(x, y)
#define _CAT_(x,y) x ## y
#define _INSTANTIATE_FOR_NUMERIC_TYPES(chain) _CAT(_INSTANTIATE_FOR_NUMERIC_TYPES_1 chain, _END)
Expand Down
Loading