# HG changeset patch # User Alys Brooks # Date 2022-08-07 22:29:13 # Node ID d8ade210884a7f63317b75f2bfc767b1f04128c4 # Parent fe338711f0103615c1a6034f1f02aad0d498b223 Put new graph on top. diff --git a/isometric-park-fna/UI/Graph.cs b/isometric-park-fna/UI/Graph.cs --- a/isometric-park-fna/UI/Graph.cs +++ b/isometric-park-fna/UI/Graph.cs @@ -185,68 +185,6 @@ } } - ImPlot.PushStyleVar(ImPlotStyleVar.LineWeight, 2.0f); - ImPlot.PushStyleVar(ImPlotStyleVar.MinorAlpha, 0.0f); - - ImPlot.SetNextPlotLimits(totals.Count()-periods, totals.Count(), min, max, ImGuiCond.Always); - if (ImPlot.BeginPlot("My Plot", null, null, new Num.Vector2(-1,0), ImPlotFlags.NoLegend | ImPlotFlags.NoMousePos )) { - foreach (var key in keys) { - var show = data_sets_show[key]; - var data = data_sets[key]; - var data_array = data_sets[key].ToArray(); - if (data_array.Length > 0 && show) - { - ImPlot.PlotLine(key, ref data_array[0], data_array.Length); - ImPlot.AnnotateClamped(data_array.Length-1, data_array[data_array.Length-1], - new Num.Vector2(5, -10), StyleSets.grey, key); - } - } - - ImPlot.EndPlot(); - } - - ImPlot.PopStyleVar(2); - - ImGui.RadioButton("1 year", ref GraphWindow.year, 1); - ImGui.SameLine(); - ImGui.RadioButton("5 years", ref GraphWindow.year, 5); - ImGui.SameLine(); - ImGui.RadioButton("25 years", ref GraphWindow.year, 25); - ImGui.SameLine(); - ImGui.RadioButton("100 years", ref GraphWindow.year, 100); - - ImGui.Text("Trees:"); - for (int i = 0; i < tree_series.Length; i++) - { - var key = tree_series[i]; - if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) - { - data_sets_show[key] = !data_sets_show[key]; - } - - if (i != tree_series.Length-1) - { - ImGui.SameLine(); - } - } - - ImGui.Text("Money:"); - for (int i = 0; i < money_series.Length; i++) - { - var key = money_series[i]; - if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) - { - data_sets_show[key] = !data_sets_show[key]; - } - if ((i % 4 != 3) && (i != money_series.Length-1)) { - ImGui.SameLine(); - } - } - - ImGui.Text("Always show zero:"); - ImGui.SameLine(); - ImGui.Checkbox("##AlwaysShowZero", ref always_show_zero); - var draw_list = ImGui.GetWindowDrawList(); var padding = 30; @@ -302,6 +240,71 @@ ImGui.Dummy(new Num.Vector2(350, 200)); + ImGui.RadioButton("1 year", ref GraphWindow.year, 1); + ImGui.SameLine(); + ImGui.RadioButton("5 years", ref GraphWindow.year, 5); + ImGui.SameLine(); + ImGui.RadioButton("25 years", ref GraphWindow.year, 25); + ImGui.SameLine(); + ImGui.RadioButton("100 years", ref GraphWindow.year, 100); + + ImGui.Text("Trees:"); + for (int i = 0; i < tree_series.Length; i++) + { + var key = tree_series[i]; + if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) + { + data_sets_show[key] = !data_sets_show[key]; + } + + if (i != tree_series.Length-1) + { + ImGui.SameLine(); + } + } + + ImGui.Text("Money:"); + for (int i = 0; i < money_series.Length; i++) + { + var key = money_series[i]; + if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) + { + data_sets_show[key] = !data_sets_show[key]; + } + if ((i % 4 != 3) && (i != money_series.Length-1)) { + ImGui.SameLine(); + } + } + + ImGui.Text("Always show zero:"); + ImGui.SameLine(); + ImGui.Checkbox("##AlwaysShowZero", ref always_show_zero); + + + #if DEBUG + ImPlot.PushStyleVar(ImPlotStyleVar.LineWeight, 2.0f); + ImPlot.PushStyleVar(ImPlotStyleVar.MinorAlpha, 0.0f); + + ImPlot.SetNextPlotLimits(totals.Count()-periods, totals.Count(), min, max, ImGuiCond.Always); + if (ImPlot.BeginPlot("My Plot", null, null, new Num.Vector2(-1,0), ImPlotFlags.NoLegend | ImPlotFlags.NoMousePos )) { + foreach (var key in keys) { + var show = data_sets_show[key]; + var data = data_sets[key]; + var data_array = data_sets[key].ToArray(); + if (data_array.Length > 0 && show) + { + ImPlot.PlotLine(key, ref data_array[0], data_array.Length); + ImPlot.AnnotateClamped(data_array.Length-1, data_array[data_array.Length-1], + new Num.Vector2(5, -10), StyleSets.grey, key); + } + } + + ImPlot.EndPlot(); + } + + ImPlot.PopStyleVar(2); + #endif + ImGui.End(); ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; StyleSets.defaultSet.pop();