Description:
Make the graph slightly nicer for flat series. Avoids making the range of the graph go into the negative if the series isn't negative already.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r647:412280b6f2ab -

@@ -125,6 +125,18
125 125 return (int) (((num - domain.X) / domain_span) * range_span + range.X);
126 126 }
127 127
128 public static Num.Vector2 adjust_domain(int domain_min, int domain_max)
129 {
130 if (domain_min != domain_max) {
131 return new Num.Vector2(domain_min, domain_max);
132 }
133 else {
134 var lower = MathUtils.Clamp(domain_min, 0, 100);
135 var upper = MathUtils.Clamp(domain_min, 10, 100);
136
137 return new Num.Vector2(domain_min-lower, domain_max+upper);
138 }
139 }
128 140
129 141 public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine)
130 142 {
@@ -209,7 +221,7
209 221 }
210 222 }
211 223
212 var domain = (domain_min != domain_max) ? new Num.Vector2(domain_min, domain_max) : new Num.Vector2(domain_min-100, domain_max+100) ;
224 var domain = adjust_domain(domain_min, domain_max);
213 225 var range = new Num.Vector2(200 - padding, 0 + padding);
214 226
215 227 //Zero
You need to be logged in to leave comments. Login now