ladder resizable columns
This commit is contained in:
1 parent
1b918278f6
commit
a27abfb6d4
7 files changed
+228
-74
No files matched your search
@@ -38,7 +38,7 @@ namespace bts.shell {
|
||||
return null;
|
||||
}
|
||||
|
||||
IObservable<mbts.spark.LadderSettings> default_ladder_settings = Observable.Return(new mbts.spark.LadderSettings());
|
||||
IObservable<mbts.spark.LadderSettings> default_ladder_settings => Observable.Return(new mbts.spark.LadderSettings());
|
||||
|
||||
private IShellWindow create_ladder_window(SecurityMD md) {
|
||||
var model = new LadderModel(md, _orders_model);
|
||||
|
||||
@@ -72,6 +72,14 @@ namespace System.Collections.Generic
|
||||
return false;
|
||||
}
|
||||
|
||||
public static T FirstOrDefault<T>(this IEnumerable<T> source, Func<T, bool> predicate, T default_rv) {
|
||||
if (source == null) throw new ArgumentNullException(nameof(source));
|
||||
foreach (T element in source)
|
||||
if (predicate(element))
|
||||
return element;
|
||||
return default_rv;
|
||||
}
|
||||
|
||||
public static TResult FirstOrDefault<T, TResult>(this IEnumerable<T> source, Func<T, bool> predicate, Func<T, TResult> select) {
|
||||
if (source == null) throw new ArgumentNullException(nameof(source));
|
||||
foreach (T element in source)
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace mbts.utils {
|
||||
return Create<T?>((x, y) => x.HasValue ? y.HasValue && eqc.Equals(key_selector(x.Value), key_selector(y.Value)) : !y.HasValue);
|
||||
}
|
||||
|
||||
public static bool NullCheckEquals<T>(T x, T y, Func<T, T, bool> non_null_equals) where T : class, IEquatable<T> =>
|
||||
x == null ? y == null :
|
||||
y != null &&
|
||||
non_null_equals(x, y);
|
||||
|
||||
private class AnonymousEqualityComparer<T> : IEqualityComparer<T> {
|
||||
readonly Func<T, T, bool> _equals;
|
||||
readonly Func<T, int> _get_hash_code;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using mbts.co2;
|
||||
using mbts.ui;
|
||||
using mbts.ui.controls;
|
||||
using mbts.utils;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,14 +17,14 @@ using System.Windows.Media.Animation;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class LadderGridHost : Control {
|
||||
const int _rowcount = 1001;
|
||||
const int _rowcount = 1001, COLUMN_MIN_WIDTH = 8;
|
||||
|
||||
IDisposable _settings_sub, _tick_sub;
|
||||
LadderSettings _settings;
|
||||
LadderVM _vm;
|
||||
ContractSpecificationImmutable _spec;
|
||||
|
||||
VisualHost _visualHost = new VisualHost() {};
|
||||
VisualHost _visualHost = new VisualHost() { };
|
||||
LadderOrdersHost _ordershost;
|
||||
ScrollViewer _scrollViewer;
|
||||
ulong _prices_updated;
|
||||
@@ -41,7 +42,7 @@ namespace mbts.spark {
|
||||
LadderTactileAdorner _tactile_adorner;
|
||||
|
||||
public LadderGridHost() {
|
||||
_ordershost = new LadderOrdersHost(this) { HorizontalAlignment = HorizontalAlignment.Left };
|
||||
_ordershost = new LadderOrdersHost(this) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Stretch };
|
||||
var scrollViewerFactory = new FrameworkElementFactory(typeof(ScrollViewer));
|
||||
scrollViewerFactory.SetValue(FocusableProperty, false);
|
||||
Template = new ControlTemplate() {
|
||||
@@ -67,6 +68,8 @@ namespace mbts.spark {
|
||||
public static readonly DependencyProperty CommandProperty =
|
||||
DependencyProperty.Register("Command", typeof(ICommand), typeof(LadderGridHost), new PropertyMetadata(null));
|
||||
|
||||
Column[] columns { get; set; } = new Column[0];
|
||||
|
||||
internal int row_for_point(Point point) {
|
||||
var row_offset = (_scrollViewer.ContentVerticalOffset / _settings.row_height);
|
||||
var click_offset = point.Y / _settings.row_height;
|
||||
@@ -93,10 +96,10 @@ namespace mbts.spark {
|
||||
if (_settings != null) {
|
||||
var point = e.GetPosition(this);
|
||||
var price = price_for_point(point);
|
||||
var column = column_for_point(point).col;
|
||||
var column = column_for_point(point);
|
||||
Side? bs = null;
|
||||
if (column == _settings.bid_column) bs = Side.Buy;
|
||||
if (column == _settings.ask_column) bs = Side.Sell;
|
||||
if (column.column_type == ColumnType.Bid) bs = Side.Buy;
|
||||
if (column.column_type == ColumnType.Ask) bs = Side.Sell;
|
||||
var pbs = (price, bs);
|
||||
if (Command != null && Command.CanExecute(pbs)) {
|
||||
if (bs.HasValue) {
|
||||
@@ -110,19 +113,32 @@ namespace mbts.spark {
|
||||
}
|
||||
|
||||
protected override void OnMouseDoubleClick(MouseButtonEventArgs e) {
|
||||
var column = column_for_point(e.GetPosition(this)).col;
|
||||
if (column == _settings.price_column)
|
||||
var column = column_for_point(e.GetPosition(this));
|
||||
if (column.column_type == ColumnType.Price)
|
||||
scroll_to_center();
|
||||
}
|
||||
|
||||
(LadderColumnSettings col, ColumnType col_type, DrawingVisual visual) column_for_point(Point point) =>
|
||||
columns.TakeWhile(0d, (x, c) => x + c.col.width, (x, c) => x <= point.X).LastOrDefault((null, ColumnType.None, null));
|
||||
#region Column Utility Methods
|
||||
Column get_column(Column column, int offset_index) {
|
||||
if (offset_index == 0) return column;
|
||||
int i = Array.IndexOf(columns, column);
|
||||
if (i >= 0) {
|
||||
i += offset_index;
|
||||
if (i >= 0 && i < columns.Length)
|
||||
return columns[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Column column_for_point(Point point) =>
|
||||
columns.FirstOrDefault(c => c.x_right > point.X, columns[columns.Length - 1]);
|
||||
|
||||
double column_start(ColumnType col_type) =>
|
||||
columns.TakeWhile(c => c.col_type != col_type).Sum(c => c.col.width);
|
||||
columns.TakeWhile(c => c.column_type != col_type).Sum(c => c.settings.width);
|
||||
|
||||
double column_width(ColumnType col_type) =>
|
||||
columns.First(c => c.col_type == col_type).col.width;
|
||||
columns.First(c => c.column_type == col_type).settings.width;
|
||||
#endregion
|
||||
|
||||
public override void OnApplyTemplate() {
|
||||
base.OnApplyTemplate();
|
||||
@@ -134,7 +150,7 @@ namespace mbts.spark {
|
||||
_init_tactile_adorner();
|
||||
}
|
||||
|
||||
private void _connect_vm() {
|
||||
void _connect_vm() {
|
||||
Disposable.dispose(ref _settings_sub);
|
||||
Disposable.dispose(ref _tick_sub);
|
||||
_vm = DataContext as LadderVM;
|
||||
@@ -147,49 +163,78 @@ namespace mbts.spark {
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<(LadderColumnSettings col, ColumnType col_type, DrawingVisual visual)> columns {
|
||||
get {
|
||||
if (_settings != null) {
|
||||
yield return (_settings.orders_column, ColumnType.Order, null);
|
||||
yield return (_settings.bid_column, ColumnType.Bid, _bidvis);
|
||||
yield return (_settings.price_column, ColumnType.Price, _pricevis);
|
||||
yield return (_settings.ask_column, ColumnType.Ask, _askvis);
|
||||
yield return (_settings.last_column, ColumnType.Last, _lastvis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void settings_updated(LadderSettings s) {
|
||||
void settings_updated(LadderSettings s) {
|
||||
_settings = s;
|
||||
_visualHost.Height = _rowcount * s.row_height;
|
||||
_price_dirty = _settings.price_column.show;
|
||||
|
||||
// Clear and re-add the columns to the viewer to ensure offset/visibility is correct
|
||||
_visualHost.Clear();
|
||||
double offset = 0.0;
|
||||
|
||||
// Orders column
|
||||
_ordershost.Visibility = s.orders_column.show ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (s.orders_column.show) {
|
||||
_ordershost.Width = s.orders_column.width;
|
||||
_ordershost.VerticalAlignment = VerticalAlignment.Stretch;
|
||||
offset += s.orders_column.width;
|
||||
_ordershost.Visibility = Visibility.Visible;
|
||||
_ordershost.set_col_width(s.orders_column.width);
|
||||
}
|
||||
|
||||
foreach ((var col, var col_type, var visual) in columns) {
|
||||
if (col.show && visual != null) {
|
||||
visual.Offset = new Vector(offset, 0);
|
||||
offset += col.width;
|
||||
_visualHost.AddVisualChild(visual);
|
||||
}
|
||||
}
|
||||
|
||||
_set_columns();
|
||||
_apply_column_visual_offset();
|
||||
foreach (var col in columns)
|
||||
if (col.settings.show && col.visual != null)
|
||||
_visualHost.AddVisualChild(col.visual);
|
||||
// Renders the grid lines
|
||||
_visualHost.AddVisualChild(_gridvis);
|
||||
_visualHost.AddVisualChild(_midvis);
|
||||
_init_tactile_adorner();
|
||||
}
|
||||
|
||||
void _apply_column_visual_offset() {
|
||||
foreach (var col in columns)
|
||||
if (col.settings.show && col.visual != null)
|
||||
col.visual.Offset = new Vector(col.x_left, 0);
|
||||
}
|
||||
|
||||
void _adjust_column_width(Column column, double adjustment) {
|
||||
int new_col_width = (int)Math.Max((double)column.settings.width + adjustment, COLUMN_MIN_WIDTH);
|
||||
int true_adj = new_col_width - (int)column.settings.width;
|
||||
column.settings.width = (uint)new_col_width;
|
||||
column.x_right += adjustment;
|
||||
foreach (var col in columns.Reverse().TakeWhile(c => c != column)) {
|
||||
col.x_left += true_adj;
|
||||
col.x_right += true_adj;
|
||||
}
|
||||
if (_price_list != null) {
|
||||
switch (column.column_type) {
|
||||
case ColumnType.Order:
|
||||
_ordershost.set_col_width(column.settings.width);
|
||||
break;
|
||||
case ColumnType.Bid:
|
||||
_render_market_col(column, _bids);
|
||||
break;
|
||||
case ColumnType.Price:
|
||||
LadderRender.render_prices(column.visual, _last_mid, _rowcount, _settings.row_height, _price_list, column.settings, _spec);
|
||||
break;
|
||||
case ColumnType.Ask:
|
||||
_render_market_col(column, _asks);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_apply_column_visual_offset();
|
||||
}
|
||||
|
||||
void _render_market_col(Column column, NativePriceSize[] depth) {
|
||||
var mid = LadderRender.index_of(_price_list, _last_mid);
|
||||
LadderRender.render_sizes(column.visual, mid, _price_list, depth, _settings.row_height, security.ContractSpec, column.settings);
|
||||
}
|
||||
|
||||
void _set_columns() {
|
||||
double x = 0;
|
||||
columns = new[] {
|
||||
new Column(_settings.orders_column, ColumnType.Order, null, x),
|
||||
new Column(_settings.bid_column, ColumnType.Bid, _bidvis, (x += _settings.orders_column.show ? _settings.orders_column.width : 0)),
|
||||
new Column(_settings.price_column, ColumnType.Price, _pricevis, (x += _settings.bid_column.show ? _settings.bid_column.width : 0)),
|
||||
new Column(_settings.ask_column, ColumnType.Ask, _askvis, (x += _settings.price_column.show ? _settings.price_column.width : 0)),
|
||||
new Column(_settings.last_column, ColumnType.Last, _lastvis, (x += _settings.ask_column.show ? _settings.ask_column.width : 0))
|
||||
};
|
||||
}
|
||||
|
||||
void _init_tactile_adorner() {
|
||||
Disposable.dispose(ref _tactile_adorner);
|
||||
if (_scrollViewer != null)
|
||||
@@ -303,5 +348,41 @@ namespace mbts.spark {
|
||||
|
||||
#endregion
|
||||
|
||||
class Column : IEquatable<Column> {
|
||||
public static readonly Column Empty = new Column(new LadderColumnSettings { width = 0 }, ColumnType.None, null, 0);
|
||||
|
||||
public readonly LadderColumnSettings settings;
|
||||
public readonly ColumnType column_type;
|
||||
public readonly DrawingVisual visual;
|
||||
|
||||
public Column(LadderColumnSettings settings, ColumnType column_type, DrawingVisual visual, double x_left) {
|
||||
this.settings = settings;
|
||||
this.column_type = column_type;
|
||||
this.visual = visual;
|
||||
this.x_left = x_left;
|
||||
x_right = x_left + settings.width;
|
||||
}
|
||||
|
||||
public double x_left { get; set; }
|
||||
public double x_right { get; set; }
|
||||
|
||||
static bool _non_null_equals(Column x, Column y) =>
|
||||
x.column_type == y.column_type;
|
||||
|
||||
public bool Equals(Column other) =>
|
||||
other != null && _non_null_equals(this, other);
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj as Column);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
column_type.GetHashCode();
|
||||
|
||||
public static bool operator ==(Column x, Column y) =>
|
||||
EqualityComparer.NullCheckEquals(x, y, _non_null_equals);
|
||||
|
||||
public static bool operator !=(Column x, Column y) =>
|
||||
!(x == y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ namespace mbts.spark
|
||||
double[] _price_list;
|
||||
double _row_height, _col_width;
|
||||
|
||||
|
||||
public LadderOrdersHost(LadderGridHost parent) {
|
||||
_parent = parent;
|
||||
AllowDrop = true;
|
||||
@@ -40,11 +39,17 @@ namespace mbts.spark
|
||||
_row_height = row_height;
|
||||
_col_width = settings.width;
|
||||
Background = new SolidColorBrush(settings.background.rgb_color());
|
||||
// clear and re-add _orders to the view
|
||||
var existing_orders = _orders.ToList();
|
||||
clear_orders();
|
||||
foreach (var order in existing_orders) {
|
||||
add_order(order);
|
||||
set_col_width(settings.width);
|
||||
_refresh_orders();
|
||||
}
|
||||
|
||||
public void set_col_width(double width) {
|
||||
if (_col_width != width) {
|
||||
Width = _col_width = width;
|
||||
foreach (var box in Children.OfType<Viewbox>())
|
||||
box.Width = _col_width;
|
||||
foreach (var panel in _stacks.Values)
|
||||
panel.MaxWidth = _col_width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +75,14 @@ namespace mbts.spark
|
||||
remove_order(o);
|
||||
}
|
||||
|
||||
void _refresh_orders() {
|
||||
var existing_orders = _orders.ToList();
|
||||
clear_orders();
|
||||
foreach (var order in existing_orders) {
|
||||
add_order(order);
|
||||
}
|
||||
}
|
||||
|
||||
void _add_order(OrderVM order, double price) {
|
||||
if (_orders.Add(order)) {
|
||||
// listen for price changes
|
||||
|
||||
@@ -10,10 +10,10 @@ using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace mbts.spark
|
||||
{
|
||||
namespace mbts.spark {
|
||||
partial class LadderGridHost {
|
||||
class LadderTactileAdorner : Adorner, IDisposable {
|
||||
const double COL_RESIZE_RANGE = 4;
|
||||
// [John]I decided against using a column style map because only bid/ask cells are animated, and if animation is eventually extended to other columns,
|
||||
// I'm not sure that all the properties could be captured with a single column style class.
|
||||
// Although bid_busy_stroke and ask_busy_stroke are the same, I was playing around with different colors during developement,
|
||||
@@ -28,9 +28,10 @@ namespace mbts.spark
|
||||
readonly LadderGridHost _host;
|
||||
readonly IList<IDisposable> _hooks;
|
||||
|
||||
bool _is_mouse_over, _is_mouse_down;
|
||||
int _curr_row;
|
||||
(LadderColumnSettings col, ColumnType col_type, DrawingVisual visual) _curr_column;
|
||||
Point? _width_adjustment_start;
|
||||
bool _is_mouse_over, _is_mouse_down, _is_mouse_within_resize_range;
|
||||
int _curr_row, _resize_column_offset;
|
||||
Column _curr_column = Column.Empty;
|
||||
|
||||
public LadderTactileAdorner(LadderGridHost host, VisualHost visual_host, ScrollViewer scroll_viewer) : base(visual_host) {
|
||||
_host = host;
|
||||
@@ -91,12 +92,12 @@ namespace mbts.spark
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext) {
|
||||
if (_is_mouse_over && _curr_column.col_type == ColumnType.Bid || _curr_column.col_type == ColumnType.Ask) {
|
||||
if (!_width_adjustment_start.HasValue && _is_mouse_over && (_curr_column.column_type == ColumnType.Bid || _curr_column.column_type == ColumnType.Ask)) {
|
||||
double y = _curr_row * _host._settings.row_height;
|
||||
double x = _host.column_start(_curr_column.col_type);
|
||||
double x = _curr_column.x_left;
|
||||
ushort? size = null;
|
||||
(Typeface typeface, double font_size, Brush background, Pen stroke) style = default;
|
||||
switch (_curr_column.col_type) {
|
||||
switch (_curr_column.column_type) {
|
||||
case ColumnType.Bid:
|
||||
size = _host.bid_size_from_row(_curr_row);
|
||||
style = _is_mouse_down ? _bid_mouse_down_style : _bid_style;
|
||||
@@ -106,10 +107,10 @@ namespace mbts.spark
|
||||
style = _is_mouse_down ? _ask_mouse_down_style : _ask_style;
|
||||
break;
|
||||
}
|
||||
_draw_cell(drawingContext, style.background, style.stroke, x, y, _curr_column.col.width);
|
||||
_draw_cell(drawingContext, style.background, style.stroke, x, y, _curr_column.settings.width);
|
||||
if (size.HasValue) {
|
||||
var ft = TextUtils.GetFormattedTextBold(size.Value.ToString(), style.font_size, Brushes.White, style.typeface);
|
||||
drawingContext.DrawText(ft, new Point(x + 0.5 * (_curr_column.col.width - ft.Width), y + 0.5 * (_host._settings.row_height - ft.Height)));
|
||||
drawingContext.DrawText(ft, new Point(x + 0.5 * (_curr_column.settings.width - ft.Width), y + 0.5 * (_host._settings.row_height - ft.Height)));
|
||||
}
|
||||
}
|
||||
foreach (var row in _busy_cells) {
|
||||
@@ -122,49 +123,90 @@ namespace mbts.spark
|
||||
}
|
||||
}
|
||||
|
||||
static Cursor _evaluate_position(Column column, Point point, out bool within_resize_range, out int resize_target_offset) {
|
||||
if ((column.x_right - point.X) <= COL_RESIZE_RANGE) {
|
||||
resize_target_offset = 0;
|
||||
} else if (column.x_left > 0 && (point.X - column.x_left) <= COL_RESIZE_RANGE) {
|
||||
resize_target_offset = -1;
|
||||
} else {
|
||||
within_resize_range = false;
|
||||
resize_target_offset = 0;
|
||||
switch (column.column_type) {
|
||||
case ColumnType.Bid:
|
||||
case ColumnType.Ask:
|
||||
return Cursors.Hand;
|
||||
default: return Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
within_resize_range = true;
|
||||
return Cursors.SizeWE;
|
||||
}
|
||||
|
||||
void _draw_cell(DrawingContext drawing_context, Brush background, Pen stroke, double x, double y, double col_width) =>
|
||||
drawing_context.DrawRectangle(background, stroke, new Rect(x + 1, y, col_width - 2, _host._settings.row_height));
|
||||
|
||||
void _host_MouseEnter(object sender, MouseEventArgs e) {
|
||||
_is_mouse_over = true;
|
||||
_width_adjustment_start = null;
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
void _host_MouseLeave(object sender, MouseEventArgs e) {
|
||||
_is_mouse_over = false;
|
||||
_width_adjustment_start = null;
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
void _host_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
_is_mouse_down = false;
|
||||
if (_width_adjustment_start.HasValue) {
|
||||
var point = e.GetPosition(_host);
|
||||
_adjust_column_width(point);
|
||||
_width_adjustment_start = null;
|
||||
_set_current_row_and_column(point);
|
||||
}
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
void _host_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
_is_mouse_down = true;
|
||||
if (_is_mouse_within_resize_range)
|
||||
_width_adjustment_start = e.GetPosition(_host);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
void _host_MouseMove(object sender, MouseEventArgs e) {
|
||||
var point = e.GetPosition(_host);
|
||||
var row = _host.row_for_point(point);
|
||||
var column = _host.column_for_point(point);
|
||||
if (_curr_row != row || !_curr_column.Equals(column)) {
|
||||
_curr_row = row;
|
||||
_curr_column = column;
|
||||
switch (_curr_column.col_type) {
|
||||
case ColumnType.Bid:
|
||||
case ColumnType.Ask:
|
||||
Cursor = Cursors.Hand; break;
|
||||
default: Cursor = Cursors.Arrow; break;
|
||||
}
|
||||
InvalidateVisual();
|
||||
if (_width_adjustment_start.HasValue) {
|
||||
if (_adjust_column_width(point)) {
|
||||
_width_adjustment_start = point;
|
||||
return;
|
||||
} else _width_adjustment_start = null;
|
||||
}
|
||||
_set_current_row_and_column(point);
|
||||
}
|
||||
|
||||
void _scroll_viewer_ScrollChanged(object sender, ScrollChangedEventArgs e) =>
|
||||
InvalidateVisual();
|
||||
|
||||
bool _adjust_column_width(Point current_posn) {
|
||||
var col = _host.get_column(_curr_column, _resize_column_offset);
|
||||
if (col != null) {
|
||||
_host._adjust_column_width(_host.get_column(_curr_column, _resize_column_offset), current_posn.X - _width_adjustment_start.Value.X);
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
void _set_current_row_and_column(Point current_posn) {
|
||||
var row = _host.row_for_point(current_posn);
|
||||
var column = _host.column_for_point(current_posn);
|
||||
_host.Cursor = _evaluate_position(column, current_posn, out _is_mouse_within_resize_range, out _resize_column_offset);
|
||||
if (_curr_row != row || _curr_column != column) {
|
||||
_curr_row = row;
|
||||
_curr_column = column;
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,14 @@ namespace mbts.spark {
|
||||
|
||||
public static double[] render_prices(DrawingVisual price, double mid, int row_count, double row_height,
|
||||
LadderColumnSettings settings, ContractSpecificationImmutable spec) {
|
||||
var dprices = gen_prices(mid, row_count, spec);
|
||||
render_prices(price, mid, row_count, row_height, dprices, settings, spec);
|
||||
return dprices;
|
||||
}
|
||||
|
||||
public static void render_prices(DrawingVisual price, double mid, int row_count, double row_height, double[] dprices, LadderColumnSettings settings, ContractSpecificationImmutable spec) {
|
||||
var foreground = new SolidColorBrush(settings.foreground.rgb_color());
|
||||
var background = new SolidColorBrush(settings.background.rgb_color());
|
||||
var dprices = gen_prices(mid, row_count, spec);
|
||||
var fprices = format_prices(dprices, settings.font_family, settings.font_size, foreground, spec);
|
||||
double y = top_margin(fprices[0], row_height);
|
||||
using (var dc = price.RenderOpen()) {
|
||||
@@ -78,7 +83,7 @@ namespace mbts.spark {
|
||||
y += row_height;
|
||||
}
|
||||
}
|
||||
return dprices;
|
||||
|
||||
}
|
||||
|
||||
public static void render_grid(DrawingVisual dv, double[] prices, double width, double rowcount, double row_height, UInt32 line_color) {
|
||||
|
||||
Reference in new issue
Block a user