Description:
Scale graph.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -20,6 +20,8 | |||||
|
20 | { |
|
20 | { |
|
21 | public static bool hadFocus = false; |
|
21 | public static bool hadFocus = false; |
|
22 |
|
22 | ||
|
|
23 | public static int year = 1; | ||
|
|
24 | |||
|
23 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
25 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
24 | { |
|
26 | { |
|
25 | bool newShow = true; |
|
27 | bool newShow = true; |
@@ -32,7 +34,7 | |||||
|
32 | { |
|
34 | { |
|
33 | ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white); |
|
35 | ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white); |
|
34 | } |
|
36 | } |
|
35 |
ImGui.SetNextWindowSize(new Num.Vector2(400, |
|
37 | ImGui.SetNextWindowSize(new Num.Vector2(400, 400)); |
|
36 |
|
38 | ||
|
37 | ImGui.Begin("Graph", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); |
|
39 | ImGui.Begin("Graph", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); |
|
38 | if (GraphWindow.hadFocus) |
|
40 | if (GraphWindow.hadFocus) |
@@ -43,27 +45,37 | |||||
|
43 |
|
45 | ||
|
44 | // ImGui.Text("Lorem Ipsum"); |
|
46 | // ImGui.Text("Lorem Ipsum"); |
|
45 |
|
47 | ||
|
46 |
var totals = sim.allBudgets().Select(b => ( |
|
48 | var totals = sim.allBudgets().Select(b => (double)b.money); |
|
47 |
|
49 | ||
|
48 |
|
50 | ||
|
49 | var totals_array = totals.ToArray(); |
|
51 | var totals_array = totals.ToArray(); |
|
50 |
|
52 | ||
|
|
53 | var periods = 12.0d * GraphWindow.year; | ||
|
|
54 | |||
|
|
55 | // totals.Max() * 1.10d; | ||
|
|
56 | ImPlot.SetNextPlotLimits(totals.Count()-periods, totals.Count(), 0.0d, (totals.Count() > 0 )? totals.Max() * 1.05 : 115_000d , ImGuiCond.Always); | ||
|
|
57 | |||
|
51 | if( ImPlot.BeginPlot("My Plot")) { |
|
58 | if( ImPlot.BeginPlot("My Plot")) { |
|
52 |
|
|||
|
53 | // Span<double> totals = new Span<double>(new double[]{0.0, 1.0, 2.0, 9.0}); |
|
59 | // Span<double> totals = new Span<double>(new double[]{0.0, 1.0, 2.0, 9.0}); |
|
54 |
|
|||
|
55 |
|
|||
|
56 | if (totals_array.Length > 0) |
|
60 | if (totals_array.Length > 0) |
|
57 | { |
|
61 | { |
|
58 | var max = totals.Max() * 1.10f; |
|
||
|
59 | // ImGui.PlotLines("MainGraph", ref totals[0], totals.Length, 0, null, float.MaxValue, float.MaxValue, new Num.Vector2(350, 200)); |
|
62 | // ImGui.PlotLines("MainGraph", ref totals[0], totals.Length, 0, null, float.MaxValue, float.MaxValue, new Num.Vector2(350, 200)); |
|
60 | // ImPlot.PlotLine("My Line", ref MemoryMarshal.GetReference(totals), ref MemoryMarshal.GetReference(totals), totals.Length); |
|
63 | // ImPlot.PlotLine("My Line", ref MemoryMarshal.GetReference(totals), ref MemoryMarshal.GetReference(totals), totals.Length); |
|
61 | ImPlot.PlotLine("My Line", ref totals_array[0], totals_array.Length, max); |
|
64 | // Logging.Info(String.Format("Max: {0}", max.ToString())); |
|
|
65 | ImPlot.PlotLine("Total Funds", ref totals_array[0], totals_array.Length); | ||
|
62 | } |
|
66 | } |
|
63 | ImPlot.EndPlot(); |
|
67 | ImPlot.EndPlot(); |
|
64 |
|
68 | ||
|
65 | } |
|
69 | } |
|
66 |
|
70 | ||
|
|
71 | ImGui.RadioButton("1 year", ref GraphWindow.year, 1); | ||
|
|
72 | ImGui.SameLine(); | ||
|
|
73 | ImGui.RadioButton("5 years", ref GraphWindow.year, 5); | ||
|
|
74 | ImGui.SameLine(); | ||
|
|
75 | ImGui.RadioButton("25 years", ref GraphWindow.year, 25); | ||
|
|
76 | ImGui.SameLine(); | ||
|
|
77 | ImGui.RadioButton("100 years", ref GraphWindow.year, 100); | ||
|
|
78 | |||
|
67 |
|
79 | ||
|
68 |
|
80 | ||
|
69 |
|
81 |
You need to be logged in to leave comments.
Login now