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 @@ -20,6 +20,8 @@ { public static bool hadFocus = false; + public static int year = 1; + public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) { bool newShow = true; @@ -32,7 +34,7 @@ { ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white); } - ImGui.SetNextWindowSize(new Num.Vector2(400, 250)); + ImGui.SetNextWindowSize(new Num.Vector2(400, 400)); ImGui.Begin("Graph", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); if (GraphWindow.hadFocus) @@ -43,27 +45,37 @@ // ImGui.Text("Lorem Ipsum"); - var totals = sim.allBudgets().Select(b => (float)b.money); + var totals = sim.allBudgets().Select(b => (double)b.money); var totals_array = totals.ToArray(); + var periods = 12.0d * GraphWindow.year; + + // totals.Max() * 1.10d; + ImPlot.SetNextPlotLimits(totals.Count()-periods, totals.Count(), 0.0d, (totals.Count() > 0 )? totals.Max() * 1.05 : 115_000d , ImGuiCond.Always); + if( ImPlot.BeginPlot("My Plot")) { - // Span totals = new Span(new double[]{0.0, 1.0, 2.0, 9.0}); - - if (totals_array.Length > 0) { - var max = totals.Max() * 1.10f; // ImGui.PlotLines("MainGraph", ref totals[0], totals.Length, 0, null, float.MaxValue, float.MaxValue, new Num.Vector2(350, 200)); // ImPlot.PlotLine("My Line", ref MemoryMarshal.GetReference(totals), ref MemoryMarshal.GetReference(totals), totals.Length); - ImPlot.PlotLine("My Line", ref totals_array[0], totals_array.Length, max); + // Logging.Info(String.Format("Max: {0}", max.ToString())); + ImPlot.PlotLine("Total Funds", ref totals_array[0], totals_array.Length); } ImPlot.EndPlot(); } + 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); +