fix: Check price is within ladder's range before rendering
Bugs (fixed): The render routine was indirectly asserting that each item's price was >= the ladder's min price. That seems like an inappropriate burden to put on the caller. Now we filter these items out in the routine.
This commit is contained in:
1 parent
cf587e26d5
commit
da927adef4
1 file changed
+5
-3
@@ -373,11 +373,13 @@ namespace mbts.spark {
|
||||
using (_draw_with_clip(dc, settings, row_height, prices.Count)) {
|
||||
if (data.is_null_or_empty())
|
||||
return;
|
||||
var min_price = prices[prices.Count - 1];
|
||||
var max_price = prices[0];
|
||||
Log.assert(min_price.is_real() && max_price.is_real() && min_price <= max_price);
|
||||
data = data.Where(item => item.price.is_real() && item.price.is_within_range(min_price, max_price));
|
||||
int curr_index = 0;
|
||||
double curr_price = prices[curr_index];
|
||||
double curr_price = max_price;
|
||||
foreach (var (price, value) in data) {
|
||||
if (double.IsNaN(price))
|
||||
continue;
|
||||
// prices are in descending order, so get diff from curr_price - price.
|
||||
var tick_diff = spec.tickdiff(curr_price, price);
|
||||
if (!tick_diff.HasValue) {
|
||||
|
||||
Reference in new issue
Block a user