Description:
More graph series.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -37,6 +37,8 | |||||
|
37 |
|
37 | ||
|
38 | //misc |
|
38 | //misc |
|
39 | public int trees; |
|
39 | public int trees; |
|
|
40 | public int dead_trees; | ||
|
|
41 | public int crowded_trees; | ||
|
40 |
|
42 | ||
|
41 | } |
|
43 | } |
|
42 |
|
44 | ||
@@ -234,6 +236,9 | |||||
|
234 | } |
|
236 | } |
|
235 | } |
|
237 | } |
|
236 |
|
238 | ||
|
|
239 | //Historical counts | ||
|
|
240 | // public List<int> tree_count | ||
|
|
241 | |||
|
237 | public Simulation(int width, int height, float[] millisecondsPerAdvance) |
|
242 | public Simulation(int width, int height, float[] millisecondsPerAdvance) |
|
238 | { |
|
243 | { |
|
239 | this.random = new Random(); |
|
244 | this.random = new Random(); |
@@ -316,6 +321,8 | |||||
|
316 | DateTime = this.DateTime, |
|
321 | DateTime = this.DateTime, |
|
317 | money = this.money, |
|
322 | money = this.money, |
|
318 | trees = this.map.tree_count, |
|
323 | trees = this.map.tree_count, |
|
|
324 | dead_trees = this.dead_trees, | ||
|
|
325 | crowded_trees = this.crowded_trees, | ||
|
319 | subsidy = this.Subsidy, |
|
326 | subsidy = this.Subsidy, |
|
320 | contracts = this.contracts, |
|
327 | contracts = this.contracts, |
|
321 | enforcement = this.enforcement, |
|
328 | enforcement = this.enforcement, |
@@ -26,16 +26,18 | |||||
|
26 | public static bool show_subsidies = false; |
|
26 | public static bool show_subsidies = false; |
|
27 | public static bool show_upkeep = false; |
|
27 | public static bool show_upkeep = false; |
|
28 |
|
28 | ||
|
|
29 | private static string[] money_series = { "Total Funds", | ||
|
|
30 | "Subsidies", "Upkeep", "Contracts", "Cashflow", "Misc"}; | ||
|
|
31 | private static string[] tree_series = { "Total trees", "Dead trees", "Crowded trees"}; | ||
|
29 |
|
32 | ||
|
30 | public static Dictionary<string, IEnumerable<double>> data_sets = new Dictionary<string, IEnumerable<double>>(); |
|
33 | public static Dictionary<string, IEnumerable<double>> data_sets = new Dictionary<string, IEnumerable<double>>(); |
|
31 |
|
34 | ||
|
32 |
public static Dictionary<String, bool> data_sets_show = new |
|
35 | public static Dictionary<String, bool> data_sets_show = new List<string>() |
|
33 | {"Total Funds", false}, |
|
36 | .Concat(money_series) |
|
34 | {"Subsidies", false}, |
|
37 | .Concat(tree_series) |
|
35 |
|
|
38 | .Select(e => (e, false)) |
|
36 | {"Contracts", false}, |
|
39 | .ToDictionary(t => t.Item1, t=> t.Item2); |
|
37 | {"Cashflow", false}, |
|
40 | |
|
38 | {"Misc", false}}; |
|
||
|
39 |
|
41 | ||
|
40 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
42 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) |
|
41 | { |
|
43 | { |
@@ -67,6 +69,10 | |||||
|
67 | data_sets["Misc"] = sim.allBudgets().Select(b => (double)b.misc); |
|
69 | data_sets["Misc"] = sim.allBudgets().Select(b => (double)b.misc); |
|
68 | data_sets["Cashflow"] = sim.allBudgets().Select(b => (double)b.cashflow); |
|
70 | data_sets["Cashflow"] = sim.allBudgets().Select(b => (double)b.cashflow); |
|
69 |
|
71 | ||
|
|
72 | data_sets["Total trees"] = sim.allBudgets().Select(b => (double)b.trees); | ||
|
|
73 | data_sets["Dead trees"] = sim.allBudgets().Select(b => (double)b.dead_trees); | ||
|
|
74 | data_sets["Crowded trees"] = sim.allBudgets().Select(b => (double)b.crowded_trees); | ||
|
|
75 | |||
|
70 | var periods = 12.0d * GraphWindow.year; |
|
76 | var periods = 12.0d * GraphWindow.year; |
|
71 | var keys = data_sets_show.Keys.ToList(); |
|
77 | var keys = data_sets_show.Keys.ToList(); |
|
72 |
|
78 | ||
@@ -123,12 +129,25 | |||||
|
123 | ImGui.SameLine(); |
|
129 | ImGui.SameLine(); |
|
124 | ImGui.RadioButton("100 years", ref GraphWindow.year, 100); |
|
130 | ImGui.RadioButton("100 years", ref GraphWindow.year, 100); |
|
125 |
|
131 | ||
|
126 | foreach (var key in keys) |
|
132 | for (int i = 0; i < money_series.Length; i++) |
|
|
133 | { | ||
|
|
134 | var key = money_series[i]; | ||
|
|
135 | if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) | ||
|
|
136 | { | ||
|
|
137 | data_sets_show[key] = !data_sets_show[key]; | ||
|
|
138 | } | ||
|
|
139 | if ((i % 4 != 3) && (i != money_series.Length-1)) { | ||
|
|
140 | ImGui.SameLine(); | ||
|
|
141 | } | ||
|
|
142 | |||
|
|
143 | } | ||
|
|
144 | foreach (var key in tree_series) | ||
|
127 | { |
|
145 | { |
|
128 | if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) |
|
146 | if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) |
|
129 | { |
|
147 | { |
|
130 | data_sets_show[key] = !data_sets_show[key]; |
|
148 | data_sets_show[key] = !data_sets_show[key]; |
|
131 | } |
|
149 | } |
|
|
150 | ImGui.SameLine(); | ||
|
132 |
|
151 | ||
|
133 | } |
|
152 | } |
|
134 |
|
153 |
You need to be logged in to leave comments.
Login now