mirror of
https://github.com/gwm17/implot.git
synced 2024-11-13 14:38:51 -05:00
invert ImPlotFlags
This commit is contained in:
parent
defc529219
commit
2dcdfc519a
34
implot.cpp
34
implot.cpp
|
@ -1212,7 +1212,7 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
|
|||
const bool any_hov_y_axis_region = plot.YAxis[0].HoveredTot || plot.YAxis[1].HoveredTot || plot.YAxis[2].HoveredTot;
|
||||
|
||||
// legend hovered from last frame
|
||||
const bool hov_legend = ImHasFlag(plot.Flags, ImPlotFlags_Legend) ? gp.Hov_Frame && plot.BB_Legend.Contains(IO.MousePos) : false;
|
||||
const bool hov_legend = !ImHasFlag(plot.Flags, ImPlotFlags_NoLegend) ? gp.Hov_Frame && plot.BB_Legend.Contains(IO.MousePos) : false;
|
||||
|
||||
bool hov_query = false;
|
||||
if (gp.Hov_Frame && gp.Hov_Plot && plot.Queried && !plot.Querying) {
|
||||
|
@ -1349,7 +1349,7 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
|
|||
if (plot.Selecting && (IO.MouseReleased[gp.InputMap.BoxSelectButton] || !IO.MouseDown[gp.InputMap.BoxSelectButton])) {
|
||||
UpdateTransformCache();
|
||||
ImVec2 select_size = plot.SelectStart - IO.MousePos;
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_BoxSelect)) {
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect)) {
|
||||
ImPlotPoint p1 = PixelsToPlot(plot.SelectStart);
|
||||
ImPlotPoint p2 = PixelsToPlot(IO.MousePos);
|
||||
const bool x_can_change = !ImHasFlag(IO.KeyMods,gp.InputMap.HorizontalMod) && ImFabs(select_size.x) > 2;
|
||||
|
@ -1370,7 +1370,7 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
|
|||
plot.Selecting = false;
|
||||
}
|
||||
// bad selection
|
||||
if (plot.Selecting && (!ImHasFlag(plot.Flags, ImPlotFlags_BoxSelect) || gp.LockPlot) && ImLengthSqr(plot.SelectStart - IO.MousePos) > 4) {
|
||||
if (plot.Selecting && (ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect) || gp.LockPlot) && ImLengthSqr(plot.SelectStart - IO.MousePos) > 4) {
|
||||
ImGui::SetMouseCursor(ImGuiMouseCursor_NotAllowed);
|
||||
}
|
||||
// cancel selection
|
||||
|
@ -1417,7 +1417,7 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
|
|||
plot.Queried = true;
|
||||
plot.QueryStart = plot.SelectStart;
|
||||
}
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_BoxSelect) && plot.Querying && !ImHasFlag(IO.KeyMods, gp.InputMap.QueryToggleMod) && !IO.MouseDown[gp.InputMap.QueryButton]) {
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect) && plot.Querying && !ImHasFlag(IO.KeyMods, gp.InputMap.QueryToggleMod) && !IO.MouseDown[gp.InputMap.QueryButton]) {
|
||||
plot.Selecting = true;
|
||||
plot.Querying = false;
|
||||
plot.Queried = false;
|
||||
|
@ -1694,8 +1694,8 @@ void ShowPlotContextMenu(ImPlotState& plot) {
|
|||
|
||||
ImGui::Separator();
|
||||
if ((ImGui::BeginMenu("Settings"))) {
|
||||
if (ImGui::MenuItem("Box Select",NULL,ImHasFlag(plot.Flags, ImPlotFlags_BoxSelect))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_BoxSelect);
|
||||
if (ImGui::MenuItem("Box Select",NULL,!ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_NoBoxSelect);
|
||||
}
|
||||
if (ImGui::MenuItem("Query",NULL,ImHasFlag(plot.Flags, ImPlotFlags_Query))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_Query);
|
||||
|
@ -1703,16 +1703,16 @@ void ShowPlotContextMenu(ImPlotState& plot) {
|
|||
if (ImGui::MenuItem("Crosshairs",NULL,ImHasFlag(plot.Flags, ImPlotFlags_Crosshairs))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_Crosshairs);
|
||||
}
|
||||
if (ImGui::MenuItem("Mouse Position",NULL,ImHasFlag(plot.Flags, ImPlotFlags_MousePos))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_MousePos);
|
||||
if (ImGui::MenuItem("Mouse Position",NULL,!ImHasFlag(plot.Flags, ImPlotFlags_NoMousePos))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_NoMousePos);
|
||||
}
|
||||
if (ImGui::MenuItem("Anti-Aliased Lines",NULL,ImHasFlag(plot.Flags, ImPlotFlags_AntiAliased))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_AntiAliased);
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::MenuItem("Legend",NULL,ImHasFlag(plot.Flags, ImPlotFlags_Legend))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_Legend);
|
||||
if (ImGui::MenuItem("Legend",NULL,!ImHasFlag(plot.Flags, ImPlotFlags_NoLegend))) {
|
||||
ImFlipFlag(plot.Flags, ImPlotFlags_NoLegend);
|
||||
}
|
||||
#ifdef IMPLOT_DEBUG
|
||||
if (ImGui::BeginMenu("Debug")) {
|
||||
|
@ -1817,7 +1817,7 @@ void EndPlot() {
|
|||
const bool wide_enough = ImFabs(select_bb.GetWidth()) > 2;
|
||||
const bool tall_enough = ImFabs(select_bb.GetHeight()) > 2;
|
||||
const bool big_enough = wide_enough && tall_enough;
|
||||
if (plot.Selecting && !gp.LockPlot && ImHasFlag(plot.Flags, ImPlotFlags_BoxSelect)) {
|
||||
if (plot.Selecting && !gp.LockPlot && !ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect)) {
|
||||
const ImVec4 col = GetStyleColorVec4(ImPlotCol_Selection);
|
||||
const ImU32 col_bg = ImGui::GetColorU32(col * ImVec4(1,1,1,0.25f));
|
||||
const ImU32 col_bd = ImGui::GetColorU32(col);
|
||||
|
@ -1868,7 +1868,7 @@ void EndPlot() {
|
|||
ImRect legend_content_bb;
|
||||
int nItems = GetLegendCount();
|
||||
bool hov_legend = false;
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_Legend) && nItems > 0) {
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoLegend) && nItems > 0) {
|
||||
// get max width
|
||||
float max_label_width = 0;
|
||||
for (int i = 0; i < nItems; ++i) {
|
||||
|
@ -1878,7 +1878,7 @@ void EndPlot() {
|
|||
}
|
||||
legend_content_bb = ImRect(gp.BB_Plot.Min + legend_offset, gp.BB_Plot.Min + legend_offset + ImVec2(max_label_width, nItems * txt_ht));
|
||||
plot.BB_Legend = ImRect(legend_content_bb.Min, legend_content_bb.Max + legend_spacing * 2 + ImVec2(legend_icon_size, 0));
|
||||
hov_legend = ImHasFlag(plot.Flags, ImPlotFlags_Legend) ? gp.Hov_Frame && plot.BB_Legend.Contains(IO.MousePos) : false;
|
||||
hov_legend = !ImHasFlag(plot.Flags, ImPlotFlags_NoLegend) ? gp.Hov_Frame && plot.BB_Legend.Contains(IO.MousePos) : false;
|
||||
// render legend box
|
||||
ImU32 col_bg = GetStyleColorU32(ImPlotCol_LegendBg);
|
||||
ImU32 col_bd = GetStyleColorU32(ImPlotCol_LegendBorder);
|
||||
|
@ -1947,7 +1947,7 @@ void EndPlot() {
|
|||
}
|
||||
|
||||
// render mouse pos
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_MousePos) && gp.Hov_Plot) {
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoMousePos) && gp.Hov_Plot) {
|
||||
char buffer[128] = {};
|
||||
ImBufferWriter writer(buffer, sizeof(buffer));
|
||||
|
||||
|
@ -2035,14 +2035,14 @@ void EndPlot() {
|
|||
|
||||
// CONTEXT MENUS -----------------------------------------------------------
|
||||
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_ContextMenu) && gp.Hov_Frame && gp.Hov_Plot && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoMenus) && gp.Hov_Frame && gp.Hov_Plot && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
ImGui::OpenPopup("##PlotContext");
|
||||
if (ImGui::BeginPopup("##PlotContext")) {
|
||||
ShowPlotContextMenu(plot);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_ContextMenu) && gp.Hov_Frame && plot.XAxis.HoveredExt && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoMenus) && gp.Hov_Frame && plot.XAxis.HoveredExt && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
ImGui::OpenPopup("##XContext");
|
||||
if (ImGui::BeginPopup("##XContext")) {
|
||||
ImGui::Text("X-Axis"); ImGui::Separator();
|
||||
|
@ -2052,7 +2052,7 @@ void EndPlot() {
|
|||
|
||||
for (int i = 0; i < IMPLOT_Y_AXES; ++i) {
|
||||
ImGui::PushID(i);
|
||||
if (ImHasFlag(plot.Flags, ImPlotFlags_ContextMenu) && gp.Hov_Frame && plot.YAxis[i].HoveredExt && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoMenus) && gp.Hov_Frame && plot.YAxis[i].HoveredExt && IO.MouseDoubleClicked[gp.InputMap.ContextMenuButton] && !hov_legend)
|
||||
ImGui::OpenPopup("##YContext");
|
||||
if (ImGui::BeginPopup("##YContext")) {
|
||||
if (i == 0) {
|
||||
|
|
26
implot.h
26
implot.h
|
@ -53,18 +53,18 @@ typedef int ImPlotColormap; // -> enum ImPlotColormap_
|
|||
|
||||
// Options for plots.
|
||||
enum ImPlotFlags_ {
|
||||
ImPlotFlags_MousePos = 1 << 0, // the mouse position, in plot coordinates, will be displayed in the bottom-right
|
||||
ImPlotFlags_Legend = 1 << 1, // a legend will be displayed in the top-left
|
||||
ImPlotFlags_Highlight = 1 << 2, // plot items will be highlighted when their legend entry is hovered
|
||||
ImPlotFlags_BoxSelect = 1 << 3, // the user will be able to box-select with right-mouse
|
||||
ImPlotFlags_Query = 1 << 4, // the user will be able to draw query rects with middle-mouse
|
||||
ImPlotFlags_ContextMenu = 1 << 5, // the user will be able to open context menus with double-right click
|
||||
ImPlotFlags_Crosshairs = 1 << 6, // the default mouse cursor will be replaced with a crosshair when hovered
|
||||
ImPlotFlags_AntiAliased = 1 << 7, // plot lines will be software anti-aliased (not recommended for density plots, prefer MSAA)
|
||||
ImPlotFlags_NoChild = 1 << 8, // a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications)
|
||||
ImPlotFlags_YAxis2 = 1 << 9, // enable a 2nd y-axis
|
||||
ImPlotFlags_YAxis3 = 1 << 10, // enable a 3rd y-axis
|
||||
ImPlotFlags_Default = ImPlotFlags_MousePos | ImPlotFlags_Legend | ImPlotFlags_Highlight | ImPlotFlags_BoxSelect | ImPlotFlags_ContextMenu
|
||||
ImPlotFlags_None = 0, // default
|
||||
ImPlotFlags_NoLegend = 1 << 0, // the top-left legend will not be displayed
|
||||
ImPlotFlags_NoMenus = 1 << 1, // the user will be able to open context menus with double-right click
|
||||
ImPlotFlags_NoBoxSelect = 1 << 2, // the user will be able to box-select with right-mouse
|
||||
ImPlotFlags_NoMousePos = 1 << 3, // the mouse position, in plot coordinates, will not be displayed in the bottom-right
|
||||
ImPlotFlags_NoHighlight = 1 << 4, // plot items will be highlighted when their legend entry is hovered
|
||||
ImPlotFlags_NoChild = 1 << 5, // a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications)
|
||||
ImPlotFlags_YAxis2 = 1 << 6, // enable a 2nd y-axis
|
||||
ImPlotFlags_YAxis3 = 1 << 7, // enable a 3rd y-axis
|
||||
ImPlotFlags_Query = 1 << 8, // the user will be able to draw query rects with middle-mouse
|
||||
ImPlotFlags_Crosshairs = 1 << 9, // the default mouse cursor will be replaced with a crosshair when hovered
|
||||
ImPlotFlags_AntiAliased = 1 << 10 // plot lines will be software anti-aliased (not recommended for density plots, prefer MSAA)
|
||||
};
|
||||
|
||||
// Options for plot axes (X and Y).
|
||||
|
@ -282,7 +282,7 @@ bool BeginPlot(const char* title_id,
|
|||
const char* x_label = NULL,
|
||||
const char* y_label = NULL,
|
||||
const ImVec2& size = ImVec2(-1,0),
|
||||
ImPlotFlags flags = ImPlotFlags_Default,
|
||||
ImPlotFlags flags = ImPlotFlags_None,
|
||||
ImPlotAxisFlags x_flags = ImPlotAxisFlags_Default,
|
||||
ImPlotAxisFlags y_flags = ImPlotAxisFlags_Default,
|
||||
ImPlotAxisFlags y2_flags = ImPlotAxisFlags_Auxiliary,
|
||||
|
|
|
@ -346,7 +346,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImPlot::SetNextPlotTicksX(positions, 10, labels);
|
||||
}
|
||||
if (ImPlot::BeginPlot("Bar Plot", horz ? "Score" : "Student", horz ? "Student" : "Score",
|
||||
ImVec2(-1,0), ImPlotFlags_Default, ImPlotAxisFlags_Default,
|
||||
ImVec2(-1,0), 0, ImPlotAxisFlags_Default,
|
||||
horz ? ImPlotAxisFlags_Default | ImPlotAxisFlags_Invert : ImPlotAxisFlags_Default))
|
||||
{
|
||||
if (horz) {
|
||||
|
@ -426,7 +426,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
}
|
||||
|
||||
ImPlot::SetNextPlotLimits(0,1,0,1,ImGuiCond_Always);
|
||||
if (ImPlot::BeginPlot("##Pie1", NULL, NULL, ImVec2(250,250), ImPlotFlags_Legend, 0, 0)) {
|
||||
if (ImPlot::BeginPlot("##Pie1", NULL, NULL, ImVec2(250,250), ImPlotFlags_NoMousePos | ImPlotFlags_NoMousePos, 0, 0)) {
|
||||
ImPlot::PlotPieChart(labels1, data1, 4, 0.5f, 0.5f, 0.4f, normalize, "%.2f");
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
|
||||
ImPlot::PushColormap(ImPlotColormap_Pastel);
|
||||
ImPlot::SetNextPlotLimits(0,1,0,1,ImGuiCond_Always);
|
||||
if (ImPlot::BeginPlot("##Pie2", NULL, NULL, ImVec2(250,250), ImPlotFlags_Legend, 0, 0)) {
|
||||
if (ImPlot::BeginPlot("##Pie2", NULL, NULL, ImVec2(250,250), ImPlotFlags_NoMousePos | ImPlotFlags_NoMousePos, 0, 0)) {
|
||||
ImPlot::PlotPieChart(labels2, data2, 5, 0.5f, 0.5f, 0.4f, true, "%.0f", 180);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImPlot::PushColormap(map);
|
||||
SetNextPlotTicksX(0 + 1.0/14.0, 1 - 1.0/14.0, 7, xlabels);
|
||||
SetNextPlotTicksY(1 - 1.0/14.0, 0 + 1.0/14.0, 7, ylabels);
|
||||
if (ImPlot::BeginPlot("##Heatmap1",NULL,NULL,ImVec2(225,225),0,axes_flags,axes_flags)) {
|
||||
if (ImPlot::BeginPlot("##Heatmap1",NULL,NULL,ImVec2(225,225),ImPlotFlags_NoLegend,axes_flags,axes_flags)) {
|
||||
ImPlot::PlotHeatmap("heat",values1[0],7,7,scale_min,scale_max);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
static ImVec4 gray[2] = {ImVec4(0,0,0,1), ImVec4(1,1,1,1)};
|
||||
ImPlot::PushColormap(gray, 2);
|
||||
ImPlot::SetNextPlotLimits(-1,1,-1,1);
|
||||
if (ImPlot::BeginPlot("##Heatmap2",NULL,NULL,ImVec2(225,225),ImPlotFlags_ContextMenu,0,0)) {
|
||||
if (ImPlot::BeginPlot("##Heatmap2",NULL,NULL,ImVec2(225,225),0,0,0)) {
|
||||
ImPlot::PlotHeatmap("heat1",values2,100,100,0,1,NULL);
|
||||
ImPlot::PlotHeatmap("heat2",values2,100,100,0,1,NULL, ImPlotPoint(-1,-1), ImPlotPoint(0,0));
|
||||
ImPlot::EndPlot();
|
||||
|
@ -516,13 +516,13 @@ void ShowDemoWindow(bool* p_open) {
|
|||
|
||||
static ImPlotAxisFlags rt_axis = ImPlotAxisFlags_Default & ~ImPlotAxisFlags_TickLabels;
|
||||
ImPlot::SetNextPlotLimitsX(t - history, t, ImGuiCond_Always);
|
||||
if (ImPlot::BeginPlot("##Scrolling", NULL, NULL, ImVec2(-1,150), ImPlotFlags_Default, rt_axis, rt_axis | ImPlotAxisFlags_LockMin)) {
|
||||
if (ImPlot::BeginPlot("##Scrolling", NULL, NULL, ImVec2(-1,150), 0, rt_axis, rt_axis | ImPlotAxisFlags_LockMin)) {
|
||||
ImPlot::PlotShaded("Data 1", &sdata1.Data[0].x, &sdata1.Data[0].y, sdata1.Data.size(), 0, sdata1.Offset, 2 * sizeof(t_float));
|
||||
ImPlot::PlotLine("Data 2", &sdata2.Data[0], sdata2.Data.size(), sdata2.Offset);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
ImPlot::SetNextPlotLimitsX(0, history, ImGuiCond_Always);
|
||||
if (ImPlot::BeginPlot("##Rolling", NULL, NULL, ImVec2(-1,150), ImPlotFlags_Default, rt_axis, rt_axis)) {
|
||||
if (ImPlot::BeginPlot("##Rolling", NULL, NULL, ImVec2(-1,150), 0, rt_axis, rt_axis)) {
|
||||
// two methods of plotting Data
|
||||
// as ImVec2* (or ImPlot*):
|
||||
ImPlot::PlotLine("Data 1", &rdata1.Data[0], rdata1.Data.size());
|
||||
|
@ -583,7 +583,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImGui::BulletText("Open the plot context menu (double right click) to change scales.");
|
||||
|
||||
ImPlot::SetNextPlotLimits(0.1, 100, 0, 10);
|
||||
if (ImPlot::BeginPlot("Log Plot", NULL, NULL, ImVec2(-1,0), ImPlotFlags_Default, ImPlotAxisFlags_Default | ImPlotAxisFlags_LogScale )) {
|
||||
if (ImPlot::BeginPlot("Log Plot", NULL, NULL, ImVec2(-1,0), 0, ImPlotAxisFlags_Default | ImPlotAxisFlags_LogScale )) {
|
||||
ImPlot::PlotLine("f(x) = x", xs, xs, 1001);
|
||||
ImPlot::PlotLine("f(x) = sin(x)+1", xs, ys1, 1001);
|
||||
ImPlot::PlotLine("f(x) = log(x)", xs, ys2, 1001);
|
||||
|
@ -595,7 +595,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
static double min = 1577836800; // 01/01/2020 @ 12:00:00am (UTC)
|
||||
static double max = 1609459200; // 01/01/2021 @ 12:00:00am (UTC)
|
||||
ImPlot::SetNextPlotLimits(min,max,0,1);
|
||||
if (ImPlot::BeginPlot("##Time", "UTC Time", "Y-Axis", ImVec2(-1,0), ImPlotFlags_Default, ImPlotAxisFlags_Default | ImPlotAxisFlags_Time)) {
|
||||
if (ImPlot::BeginPlot("##Time", "UTC Time", "Y-Axis", ImVec2(-1,0), 0, ImPlotAxisFlags_Default | ImPlotAxisFlags_Time)) {
|
||||
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -627,7 +627,6 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImPlot::SetNextPlotLimitsY(0, 1, ImGuiCond_Once, 1);
|
||||
ImPlot::SetNextPlotLimitsY(0, 300, ImGuiCond_Once, 2);
|
||||
if (ImPlot::BeginPlot("Multi-Axis Plot", NULL, NULL, ImVec2(-1,0),
|
||||
ImPlotFlags_Default |
|
||||
(y2_axis ? ImPlotFlags_YAxis2 : 0) |
|
||||
(y3_axis ? ImPlotFlags_YAxis3 : 0))) {
|
||||
ImPlot::PlotLine("f(x) = x", xs, xs, 1001);
|
||||
|
@ -656,7 +655,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImGui::BulletText("The query rect can be dragged after it's created.");
|
||||
ImGui::Unindent();
|
||||
|
||||
if (ImPlot::BeginPlot("##Drawing", NULL, NULL, ImVec2(-1,0), ImPlotFlags_Default | ImPlotFlags_Query, ImPlotAxisFlags_GridLines, ImPlotAxisFlags_GridLines)) {
|
||||
if (ImPlot::BeginPlot("##Drawing", NULL, NULL, ImVec2(-1,0), ImPlotFlags_Query, ImPlotAxisFlags_GridLines, ImPlotAxisFlags_GridLines)) {
|
||||
if (ImPlot::IsPlotHovered() && ImGui::IsMouseClicked(0) && ImGui::GetIO().KeyCtrl) {
|
||||
ImPlotPoint pt = ImPlot::GetPlotMousePos();
|
||||
data.push_back(t_float2((t_float)pt.x, (t_float)pt.y));
|
||||
|
@ -709,7 +708,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImPlot::SetNextPlotLimits(0,0.01,-1,1);
|
||||
ImPlotAxisFlags flags = ImPlotAxisFlags_Default & ~ImPlotAxisFlags_TickLabels;
|
||||
ImPlotLimits query;
|
||||
if (ImPlot::BeginPlot("##View1",NULL,NULL,ImVec2(-1,150), ImPlotFlags_Default | ImPlotFlags_Query, flags, flags)) {
|
||||
if (ImPlot::BeginPlot("##View1",NULL,NULL,ImVec2(-1,150), ImPlotFlags_Query, flags, flags)) {
|
||||
ImPlot::PlotLine("Signal 1", x_data, y_data1, 512);
|
||||
ImPlot::PlotLine("Signal 2", x_data, y_data2, 512);
|
||||
ImPlot::PlotLine("Signal 3", x_data, y_data3, 512);
|
||||
|
@ -774,7 +773,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
}
|
||||
}
|
||||
ImPlot::SetNextPlotLimitsX((double)t - 10, t, paused ? ImGuiCond_Once : ImGuiCond_Always);
|
||||
if (ImPlot::BeginPlot("##DND", NULL, NULL, ImVec2(-1,0), ImPlotFlags_Legend | ImPlotFlags_Highlight | ImPlotFlags_BoxSelect | ImPlotFlags_ContextMenu | ImPlotFlags_YAxis2 | ImPlotFlags_YAxis3)) {
|
||||
if (ImPlot::BeginPlot("##DND", NULL, NULL, ImVec2(-1,0), ImPlotFlags_YAxis2 | ImPlotFlags_YAxis3)) {
|
||||
for (int i = 0; i < K_CHANNELS; ++i) {
|
||||
if (show[i] && data[i].Data.size() > 0) {
|
||||
char label[K_CHANNELS];
|
||||
|
@ -1031,7 +1030,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImPlot::SetNextPlotTicksY(0, 1, 6, custom_labels ? ylabels_aux : NULL, false, 2);
|
||||
}
|
||||
ImPlot::SetNextPlotLimits(2.5,5,0,10);
|
||||
if (ImPlot::BeginPlot("Custom Ticks", NULL, NULL, ImVec2(-1,0), ImPlotFlags_Default | ImPlotFlags_YAxis2 | ImPlotFlags_YAxis3)) {
|
||||
if (ImPlot::BeginPlot("Custom Ticks", NULL, NULL, ImVec2(-1,0), ImPlotFlags_YAxis2 | ImPlotFlags_YAxis3)) {
|
||||
// nothing to see here, just the ticks
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -1136,7 +1135,7 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImGui::SameLine(); ImGui::ColorEdit4("##Bull", &bullCol.x, ImGuiColorEditFlags_NoInputs);
|
||||
ImGui::SameLine(); ImGui::ColorEdit4("##Bear", &bearCol.x, ImGuiColorEditFlags_NoInputs);
|
||||
ImPlot::SetNextPlotLimits(1546300800, 1571961600, 1250, 1600);
|
||||
if (ImPlot::BeginPlot("Candlestick Chart","Day","USD",ImVec2(-1,-1),ImPlotFlags_Default, ImPlotAxisFlags_Default | ImPlotAxisFlags_Time)) {
|
||||
if (ImPlot::BeginPlot("Candlestick Chart","Day","USD",ImVec2(-1,-1),0,ImPlotAxisFlags_Default | ImPlotAxisFlags_Time)) {
|
||||
MyImPlot::PlotCandlestick("GOOGL",dates, opens, closes, lows, highs, 218, tooltip, 0.25f, bullCol, bearCol);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
@ -1413,7 +1412,7 @@ void ShowBenchmarkTool() {
|
|||
|
||||
ImPlot::SetNextPlotLimits(0,500,0,500,ImGuiCond_Always);
|
||||
static char buffer[8];
|
||||
if (ImPlot::BeginPlot("##Stats", "Lines (1,000 pts each)", "Framerate (Hz)", ImVec2(-1,0), ImPlotFlags_Default | ImPlotFlags_NoChild)) {
|
||||
if (ImPlot::BeginPlot("##Stats", "Lines (1,000 pts each)", "Framerate (Hz)", ImVec2(-1,0), ImPlotFlags_NoChild)) {
|
||||
for (int run = 0; run < records.size(); ++run) {
|
||||
sprintf(buffer, "Run %d", run + 1);
|
||||
ImPlot::PlotLine(buffer, records[run].Data, records[run].Size);
|
||||
|
|
|
@ -433,7 +433,7 @@ struct ImPlotState
|
|||
int CurrentYAxis;
|
||||
|
||||
ImPlotState() {
|
||||
Flags = PreviousFlags = ImPlotFlags_Default;
|
||||
Flags = PreviousFlags = ImPlotFlags_None;
|
||||
SelectStart = QueryStart = ImVec2(0,0);
|
||||
Selecting = Querying = Queried = DraggingQuery = false;
|
||||
ColormapIdx = CurrentYAxis = 0;
|
||||
|
|
|
@ -145,7 +145,7 @@ bool BeginItem(const char* label_id, ImPlotCol recolor_from) {
|
|||
s.Colors[ImPlotCol_Fill].w *= s.FillAlpha;
|
||||
// s.Colors[ImPlotCol_MarkerFill].w *= s.FillAlpha; // TODO: this should be separate, if it at all
|
||||
// apply highlight mods
|
||||
if (item->LegendHovered && ImHasFlag(gp.CurrentPlot->Flags, ImPlotFlags_Highlight)) {
|
||||
if (item->LegendHovered && !ImHasFlag(gp.CurrentPlot->Flags, ImPlotFlags_NoHighlight)) {
|
||||
s.LineWeight *= 2;
|
||||
s.MarkerWeight *= 2;
|
||||
// TODO: highlight fills?
|
||||
|
|
Loading…
Reference in New Issue
Block a user