Description:
Support multiple data series.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -21,10 +21,15 | |||||
|
21 | public static bool hadFocus = false; |
|
21 | public static bool hadFocus = false; |
|
22 |
|
22 | ||
|
23 | public static int year = 1; |
|
23 | public static int year = 1; |
|
|
24 | public static bool show_totals = false; | ||
|
|
25 | public static bool show_subsidies = false; | ||
|
|
26 | public static bool show_upkeep = false; | ||
|
24 |
|
27 | ||
|
25 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
28 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
26 | { |
|
29 | { |
|
27 | bool newShow = true; |
|
30 | bool newShow = true; |
|
|
31 | |||
|
|
32 | |||
|
28 | ImGui.PushFont(font); |
|
33 | ImGui.PushFont(font); |
|
29 |
|
34 | ||
|
30 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; |
|
35 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; |
@@ -46,9 +51,12 | |||||
|
46 | // ImGui.Text("Lorem Ipsum"); |
|
51 | // ImGui.Text("Lorem Ipsum"); |
|
47 |
|
52 | ||
|
48 | var totals = sim.allBudgets().Select(b => (double)b.money); |
|
53 | var totals = sim.allBudgets().Select(b => (double)b.money); |
|
49 |
|
54 | var subsidies = sim.allBudgets().Select(b => (double)b.subsidy); | |
|
|
55 | var upkeep = sim.allBudgets().Select(b => (double)b.upkeep); | ||
|
50 |
|
56 | ||
|
51 | var totals_array = totals.ToArray(); |
|
57 | var totals_array = totals.ToArray(); |
|
|
58 | var subsidies_array = subsidies.ToArray(); | ||
|
|
59 | var upkeep_array = upkeep.ToArray(); | ||
|
52 |
|
60 | ||
|
53 | var periods = 12.0d * GraphWindow.year; |
|
61 | var periods = 12.0d * GraphWindow.year; |
|
54 |
|
62 | ||
@@ -57,13 +65,19 | |||||
|
57 |
|
65 | ||
|
58 | if( ImPlot.BeginPlot("My Plot")) { |
|
66 | if( ImPlot.BeginPlot("My Plot")) { |
|
59 | // Span<double> totals = new Span<double>(new double[]{0.0, 1.0, 2.0, 9.0}); |
|
67 | // Span<double> totals = new Span<double>(new double[]{0.0, 1.0, 2.0, 9.0}); |
|
60 | if (totals_array.Length > 0) |
|
68 | if (totals_array.Length > 0 && show_totals) |
|
61 | { |
|
69 | { |
|
62 | // ImGui.PlotLines("MainGraph", ref totals[0], totals.Length, 0, null, float.MaxValue, float.MaxValue, new Num.Vector2(350, 200)); |
|
||
|
63 | // ImPlot.PlotLine("My Line", ref MemoryMarshal.GetReference(totals), ref MemoryMarshal.GetReference(totals), totals.Length); |
|
||
|
64 | // Logging.Info(String.Format("Max: {0}", max.ToString())); |
|
||
|
65 | ImPlot.PlotLine("Total Funds", ref totals_array[0], totals_array.Length); |
|
70 | ImPlot.PlotLine("Total Funds", ref totals_array[0], totals_array.Length); |
|
66 | } |
|
71 | } |
|
|
72 | if (subsidies_array.Length > 0 && show_subsidies) | ||
|
|
73 | { | ||
|
|
74 | ImPlot.PlotLine("Subsidies", ref subsidies_array[0], subsidies_array.Length); | ||
|
|
75 | } | ||
|
|
76 | if (upkeep_array.Length > 0 && show_upkeep) | ||
|
|
77 | { | ||
|
|
78 | ImPlot.PlotLine("Upkeep", ref upkeep_array[0], upkeep_array.Length); | ||
|
|
79 | } | ||
|
|
80 | |||
|
67 | ImPlot.EndPlot(); |
|
81 | ImPlot.EndPlot(); |
|
68 |
|
82 | ||
|
69 | } |
|
83 | } |
@@ -76,6 +90,10 | |||||
|
76 | ImGui.SameLine(); |
|
90 | ImGui.SameLine(); |
|
77 | ImGui.RadioButton("100 years", ref GraphWindow.year, 100); |
|
91 | ImGui.RadioButton("100 years", ref GraphWindow.year, 100); |
|
78 |
|
92 | ||
|
|
93 | if (Menu.activeButton("Totals", show_totals, StyleSets.selected, StyleSets.white)) | ||
|
|
94 | { | ||
|
|
95 | GraphWindow.show_totals = !GraphWindow.show_totals; | ||
|
|
96 | } | ||
|
79 |
|
97 | ||
|
80 |
|
98 | ||
|
81 |
|
99 |
@@ -16,7 +16,7 | |||||
|
16 | public const int MENU_BAR_HEIGHT = 20; |
|
16 | public const int MENU_BAR_HEIGHT = 20; |
|
17 |
|
17 | ||
|
18 |
|
18 | ||
|
19 |
p |
|
19 | public static bool activeButton(string label, bool active, Num.Vector4 activeColor, Num.Vector4 activeTextColor) { |
|
20 |
|
20 | ||
|
21 | if (active) { |
|
21 | if (active) { |
|
22 | ImGui.PushStyleColor(ImGuiCol.Button, activeColor); |
|
22 | ImGui.PushStyleColor(ImGuiCol.Button, activeColor); |
You need to be logged in to leave comments.
Login now