Михаил, ПОЖАЛУЙСТА, внесите изменения в исходники.
SciChartTradeAnnotationBase.cs:
namespace StockSharp.Xaml
{
using System;
using Abt.Controls.SciChart;
using Ecng.Common;
using StockSharp.BusinessEntities;
class SciChartTradeAnnotationBase : CustomAnnotation
{
private readonly MyTrade _trade;
public SciChartTradeAnnotationBase(MyTrade trade)
{
if (trade == null)
throw new ArgumentException("trade");
_trade = trade;
}
public string BuySell
{
get { return _trade.Trade.OrderDirection.To<string>(); }
}
public string TradeVolume
{
get { return _trade.Trade.Volume.To<string>(); }
}
public string TradePrice
{
get { return Math.Round(_trade.Trade.Price, 3).To<string>(); } // Округление до 3-х знаков!
}
}
}
ChartArea.cs:
namespace StockSharp.Xaml
{
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Ecng.Collections;
using Ecng.Serialization;
/// <summary>
/// Область графика.
/// </summary>
[DisplayName("Область графика")]
public class ChartArea : ChartPart<ChartArea>
{
private sealed class ChartElementCollection : BaseList<IChartElement>
{
}
/// <summary>
/// Создать <see cref="ChartArea"/>.
/// </summary>
public ChartArea()
{
Elements = new ChartElementCollection();
Height = 100; // Константа!!!!! Ниже задается значение, задаете, пожалуйста, переменную.
IsAligned = true;
}
private string _title;
/// <summary>
/// Название области графика.
/// </summary>
[DisplayName("Название")]
[Description("Название области графика.")]
[Category("Основное")]
public string Title
{
get { return _title; }
set
{
_title = value;
RaisePropertyChanged("Title");
}
}
private bool _axisValuesPosition;
/// <summary>
/// Расположить значения оси справа.
/// </summary>
[DisplayName("Значения оси справа")]
[Description("Расположить значения оси справа.")]
[Category("Основное")]
public bool AxisValuesPosition
{
// True - справа (по умолчанию)
// False - слева
get { return _axisValuesPosition; }
set
{
_axisValuesPosition = value;
RaisePropertyChanged("AxisValuesPosition");
}
}
/// <summary>
/// Высота области.
/// </summary>
[Browsable(false)]
public float Height { get; set; } // Согласуйте это свойство!
private bool _isAligned;
Chart.xaml.cs:
...............
else
{
if (tuple.Second == null ||
tuple.Second.XValue != chartTime)
{
var point = new DataPoint
(chartTime, new[]
{
(double)candle.LowPrice,
(double)candle.HighPrice,
(double)candle.OpenPrice,
(double)candle.ClosePrice,
(double)candle.TotalVolume // Добавьте, пожалуйста, объем!
})
{
BorderColor = WinColor.DarkSlateGray,
ToolTip = "{0}{6}O = {1}{6}H = {2}{6}L = {3}{6}C = {4}{6}V = {5}"
.Put
(candle.OpenTime, candle.OpenPrice, candle.HighPrice, candle.LowPrice, candle.ClosePrice, candle.TotalVolume, Environment.NewLine), Color = chartCandles.ColorPriceUp.ToWin(),
BackSecondaryColor = chartCandles.ColorPriceDown.ToWin(),
};
tuple.First.Points.Add(point);
tuple.Second = point;
}
......................
var tradesElem = elem as ChartTradeElement;
if (tradesElem != null)
{
var trade = (MyTrade)pair.Value;
var tuple = _tradeSeries[tradesElem];
if (trade == null)
{
tuple.Item1.Points.Add(new DataPoint
{
XValue = chartTime,
YValues = new double[1],
IsEmpty = true,
});
tuple.Item2.Points.Add(new DataPoint
{
XValue = chartTime,
YValues = new double[1],
IsEmpty = true,
});
}
else
{
var point = new DataPoint
{
XValue = chartTime,
YValues = new[] { (double) Math.Round(trade.Trade.Price, 3) }, // Округление до трех знаков после запятой!
ToolTip = trade.ToString(),
};
.......................
else
{
var point = new DataPoint
{
XValue = chartTime,
YValues = new[] { (double)Math.Round(order.Price, 3) }, // Округление до трех знаков после запятой!
ToolTip = order.ToString(),
};
var main = order.Direction == OrderDirections.Buy ? tuple.Item1 : tuple.Item2;
var oppos = order.Direction == OrderDirections.Buy ? tuple.Item2 : tuple.Item1;
main.Points.Add(point);
oppos.Points.Add(new DataPoint
{
XValue = chartTime,
YValues = new double[1],
IsEmpty = true,
});
UpdateMinMax(order.Price);
}
........................
И я к сожалению не нашел свойства CrossHair для Chart. Там тоже миллион знаков после запятой. Пожалуйста, округлите их тоже максимум до 3-х знаков при выводе...