Skip to content

Commit

Permalink
feat (ImPlot): add new plot and several flags
Browse files Browse the repository at this point in the history
- added Infinite Line Series
- udpated todo
  • Loading branch information
SamuMazzi authored and hoffstadt committed Sep 17, 2024
1 parent 32fce63 commit b993316
Show file tree
Hide file tree
Showing 13 changed files with 392 additions and 195 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ __pycache__/
lib_location.txt
version_number.txt
dearpygui.egg-info/
build/
build/
# Ignore only subdirectories
sandbox/*/
src/CMakeFiles/
thirdparty/CMakeFiles/
thirdparty/Makefile
thirdparty/cmake_install.cmake
7 changes: 6 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
### TODO ImGui
- [ ] Generic:
- [ ] Fix `void ImGui::Shutdown(): Assertion '(g.IO.BackendPlatformUserData == __null) && "Forgot to shutdown Platform backend?"' failed.` error on shutdown.
- [ ] Enable control mods for plots
- [ ] Check if what you did with DragPoint value is okay or not
- [ ] Find out how py files are created
- [ ] Remove GetKeysConstants because it's deeply linked to new IO (also, I put it, so it can be removed without any worries)
- [ ] Make it work wihout obsolete functions (ImGui and ImPlot)
- [ ] V 1.83
- [ ] Tables: Expose `TableSetColumnEnabled()` in public api. (in the issue is explained that it's just Hide/Show)
- [ ] V 1.84 (https://github.com/ocornut/imgui/releases/tag/v1.84)
Expand Down Expand Up @@ -110,7 +115,7 @@ Take a look at implot.cpp to have a better changelog.
- [ ] Previously, users could define time and log scales with ImPlotAxisFlags_Log, and ImPlotAxisFlags_Time. These flags have been replaced with a more general system using a new the setup function SetupAxisScale
- [ ] You can now constrain axes limits so that users can't pan beyond a min or max value, or zoom beyond a min or max width/height
- [ ] You can now customize the supported types by defining IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list (probably not interesting for us)
- [ ] Line plots now honor ImGui's AntiAliasedLines and AntiAliasedLinesUseTex. That's right, ImPlot now uses texture based AA!
- [x] Line plots now honor ImGui's AntiAliasedLines and AntiAliasedLinesUseTex. That's right, ImPlot now uses texture based AA!
- [ ] Legend entries can be sorted using ImPlotLegendFlags_Sort
- [x] V 0.15 (https://github.com/epezent/implot/releases/tag/v0.15)
- [x] V 0.16 (https://github.com/epezent/implot/releases/tag/v0.16)
Expand Down
2 changes: 0 additions & 2 deletions dearpygui/_dearpygui.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dearpygui/_dearpygui_RTD.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dearpygui/dearpygui.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion sandbox/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions sandbox/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.13)
cmake_minimum_required (VERSION 3.13)

add_executable (DearSandbox)

Expand Down Expand Up @@ -83,4 +83,4 @@ else() # Linux
coreemb
python3.9d
)
endif()
endif()
57 changes: 26 additions & 31 deletions src/mvAppItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,7 @@ DearPyGui::GetEntityDesciptionFlags(mvAppItemType type)
case mvAppItemType::mvHeatSeries:
case mvAppItemType::mvHistogramSeries:
case mvAppItemType::mvImageSeries:
case mvAppItemType::mvVLineSeries:
case mvAppItemType::mvHLineSeries:
case mvAppItemType::mvInfLineSeries:
case mvAppItemType::mvLabelSeries:
case mvAppItemType::mvLineSeries:
case mvAppItemType::mvPieSeries:
Expand Down Expand Up @@ -1105,8 +1104,7 @@ DearPyGui::GetEntityValueType(mvAppItemType type)
case mvAppItemType::mvHeatSeries:
case mvAppItemType::mvHistogramSeries:
case mvAppItemType::mvImageSeries:
case mvAppItemType::mvVLineSeries:
case mvAppItemType::mvHLineSeries:
case mvAppItemType::mvInfLineSeries:
case mvAppItemType::mvLabelSeries:
case mvAppItemType::mvLineSeries:
case mvAppItemType::mvPieSeries:
Expand Down Expand Up @@ -1370,8 +1368,7 @@ DearPyGui::GetAllowableParents(mvAppItemType type)
case mvAppItemType::mvHeatSeries:
case mvAppItemType::mvHistogramSeries:
case mvAppItemType::mvImageSeries:
case mvAppItemType::mvVLineSeries:
case mvAppItemType::mvHLineSeries:
case mvAppItemType::mvInfLineSeries:
case mvAppItemType::mvLabelSeries:
case mvAppItemType::mvLineSeries:
case mvAppItemType::mvPieSeries:
Expand Down Expand Up @@ -3898,6 +3895,11 @@ DearPyGui::GetEntityParser(mvAppItemType type)

args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::DoubleList, "y" });
args.push_back({ mvPyDataType::Bool, "segments", mvArgType::KEYWORD_ARG, "False", "a line segment will be rendered from every two consecutive points" });
args.push_back({ mvPyDataType::Bool, "loop", mvArgType::KEYWORD_ARG, "False", "the last and first point will be connected to form a closed loop" });
args.push_back({ mvPyDataType::Bool, "skip_nan", mvArgType::KEYWORD_ARG, "False", "NaNs values will be skipped instead of rendered as missing data" });
args.push_back({ mvPyDataType::Bool, "no_clip", mvArgType::KEYWORD_ARG, "False", "markers (if displayed) on the edge of a plot will not be clipped" });
args.push_back({ mvPyDataType::Bool, "shaded", mvArgType::KEYWORD_ARG, "False", "a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases" });

setup.about = "Adds a line series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand All @@ -3915,6 +3917,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)

args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::DoubleList, "y" });
args.push_back({ mvPyDataType::Bool, "no_clip", mvArgType::KEYWORD_ARG, "False", "markers on the edge of a plot will not be clipped" });

setup.about = "Adds a scatter series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand All @@ -3933,6 +3936,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)

args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::DoubleList, "y" });
args.push_back({ mvPyDataType::Bool, "horizontal", mvArgType::KEYWORD_ARG, "False", "stems will be rendered horizontally on the current y-axis" });

setup.about = "Adds a stem series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand All @@ -3950,6 +3954,8 @@ DearPyGui::GetEntityParser(mvAppItemType type)

args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::DoubleList, "y" });
args.push_back({ mvPyDataType::Bool, "pre_step", mvArgType::KEYWORD_ARG, "False", "the y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i]" });
args.push_back({ mvPyDataType::Bool, "shaded", mvArgType::KEYWORD_ARG, "False", "a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases" });

setup.about = "Adds a stair series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand All @@ -3968,7 +3974,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::DoubleList, "y" });
args.push_back({ mvPyDataType::Float, "weight", mvArgType::KEYWORD_ARG, "1.0" });
args.push_back({ mvPyDataType::Bool, "horizontal", mvArgType::KEYWORD_ARG, "False" });
args.push_back({ mvPyDataType::Bool, "horizontal", mvArgType::KEYWORD_ARG, "False", "bars will be rendered horizontally on the current y-axis" });

setup.about = "Adds a bar series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand All @@ -3995,23 +4001,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
setup.category = { "Plotting", "Containers", "Widgets" };
break;
}
case mvAppItemType::mvVLineSeries:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID |
MV_PARSER_ARG_PARENT |
MV_PARSER_ARG_BEFORE |
MV_PARSER_ARG_SOURCE |
MV_PARSER_ARG_SHOW)
);

args.push_back({ mvPyDataType::DoubleList, "x" });

setup.about = "Adds an infinite vertical line series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
break;
}
case mvAppItemType::mvHLineSeries:
case mvAppItemType::mvInfLineSeries:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID |
Expand All @@ -4022,8 +4012,9 @@ DearPyGui::GetEntityParser(mvAppItemType type)
);

args.push_back({ mvPyDataType::DoubleList, "x" });
args.push_back({ mvPyDataType::Bool, "horizontal", mvArgType::KEYWORD_ARG, "False" });

setup.about = "Adds an infinite horizontal line series to a plot.";
setup.about = "Adds an infinite line series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
break;
}
Expand All @@ -4046,6 +4037,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::DoubleList, "bounds_max", mvArgType::KEYWORD_ARG, "(1.0, 1.0)" });
args.push_back({ mvPyDataType::String, "format", mvArgType::KEYWORD_ARG, "'%0.1f'" });
args.push_back({ mvPyDataType::Bool, "contribute_to_bounds", mvArgType::KEYWORD_ARG, "True" });
args.push_back({ mvPyDataType::Bool, "col_major", mvArgType::KEYWORD_ARG, "False", "data will be read in column major order" });

setup.about = "Adds a heat series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand Down Expand Up @@ -4089,7 +4081,8 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::StringList, "labels" });
args.push_back({ mvPyDataType::String, "format", mvArgType::KEYWORD_ARG, "'%0.2f'" });
args.push_back({ mvPyDataType::Double, "angle", mvArgType::KEYWORD_ARG, "90.0" });
args.push_back({ mvPyDataType::Bool, "normalize", mvArgType::KEYWORD_ARG, "False" });
args.push_back({ mvPyDataType::Bool, "normalize", mvArgType::KEYWORD_ARG, "False", "force normalization of pie chart values (i.e. always make a full circle if sum < 0)" });
args.push_back({ mvPyDataType::Bool, "ignore_hidden", mvArgType::KEYWORD_ARG, "False", "ignore hidden slices when drawing the pie chart (as if they were not there)" });

setup.about = "Adds an pie series to a plot.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand Down Expand Up @@ -4148,9 +4141,10 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::Float, "bar_scale", mvArgType::KEYWORD_ARG, "1.0" });
args.push_back({ mvPyDataType::Double, "min_range", mvArgType::KEYWORD_ARG, "0.0" });
args.push_back({ mvPyDataType::Double, "max_range", mvArgType::KEYWORD_ARG, "1.0" });
args.push_back({ mvPyDataType::Bool, "cumlative", mvArgType::KEYWORD_ARG, "False" });
args.push_back({ mvPyDataType::Bool, "density", mvArgType::KEYWORD_ARG, "False" });
args.push_back({ mvPyDataType::Bool, "outliers", mvArgType::KEYWORD_ARG, "True" });
args.push_back({ mvPyDataType::Bool, "cumulative", mvArgType::KEYWORD_ARG, "False", "each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D)" });
args.push_back({ mvPyDataType::Bool, "density", mvArgType::KEYWORD_ARG, "False", "counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set" });
args.push_back({ mvPyDataType::Bool, "no_outliers", mvArgType::KEYWORD_ARG, "False", "exclude values outside the specifed histogram range from the count toward normalizing and cumulative counts" });
args.push_back({ mvPyDataType::Bool, "horizontal", mvArgType::KEYWORD_ARG, "False", "histogram bars will be rendered horizontally (not supported by PlotHistogram2D)" });
args.push_back({ mvPyDataType::Bool, "contribute_to_bounds", mvArgType::KEYWORD_ARG, "True" });

setup.about = "Adds a histogram series to a plot.";
Expand All @@ -4175,8 +4169,9 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::Double, "xmax_range", mvArgType::KEYWORD_ARG, "1.0" });
args.push_back({ mvPyDataType::Double, "ymin_range", mvArgType::KEYWORD_ARG, "0.0" });
args.push_back({ mvPyDataType::Double, "ymax_range", mvArgType::KEYWORD_ARG, "1.0" });
args.push_back({ mvPyDataType::Bool, "density", mvArgType::KEYWORD_ARG, "False" });
args.push_back({ mvPyDataType::Bool, "outliers", mvArgType::KEYWORD_ARG, "True" });
args.push_back({ mvPyDataType::Bool, "density", mvArgType::KEYWORD_ARG, "False", "counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set" });
args.push_back({ mvPyDataType::Bool, "no_outliers", mvArgType::KEYWORD_ARG, "False", "exclude values outside the specifed histogram range from the count toward normalizing and cumulative counts" });
args.push_back({ mvPyDataType::Bool, "col_major", mvArgType::KEYWORD_ARG, "False", "data will be read in column major order (not supported by PlotHistogram)" });

setup.about = "Adds a 2d histogram series.";
setup.category = { "Plotting", "Containers", "Widgets" };
Expand Down
3 changes: 1 addition & 2 deletions src/mvAppItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ GetEntityCommand(mvAppItemType type)
case mvAppItemType::mvBarSeries: return "add_bar_series";
case mvAppItemType::mvErrorSeries: return "add_error_series";
case mvAppItemType::mvCustomSeries: return "add_custom_series";
case mvAppItemType::mvVLineSeries: return "add_vline_series";
case mvAppItemType::mvHLineSeries: return "add_hline_series";
case mvAppItemType::mvInfLineSeries: return "add_inf_line_series";
case mvAppItemType::mvHeatSeries: return "add_heat_series";
case mvAppItemType::mvImageSeries: return "add_image_series";
case mvAppItemType::mvPieSeries: return "add_pie_series";
Expand Down
3 changes: 1 addition & 2 deletions src/mvAppItemTypes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
X( mvStairSeries ) \
X( mvBarSeries ) \
X( mvErrorSeries ) \
X( mvVLineSeries ) \
X( mvHLineSeries ) \
X( mvInfLineSeries ) \
X( mvHeatSeries ) \
X( mvImageSeries ) \
X( mvPieSeries ) \
Expand Down
Loading

0 comments on commit b993316

Please sign in to comment.