XAML을 통해 HighLowSeries
을 정의하고 싶습니다. HighLowSeries-graphs
사용할 수없는 때문에 oxyplot.wpf
네임 스페이스에 내가 다음 클래스 만들었습니다 윈도우의 뒤에 코드에서Xaml oxyplot HighLowSeries Items 바인딩
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Oxy="http://oxyplot.org/wpf"
xmlns:Tmp="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Oxy:PlotView Width="300"
Height="300"
Title="Test">
<Oxy:PlotView.Series>
<Tmp:HighLowSeries ItemsSource="{Binding list}" />
</Oxy:PlotView.Series>
</Oxy:PlotView>
</Grid>
</Window>
: 내 창에서
public class HighLowSeries : OxyPlot.Wpf.XYAxisSeries
{
public HighLowSeries()
{
this.InternalSeries = new OxyPlot.Series.HighLowSeries();
}
public override OxyPlot.Series.Series CreateModel()
{
this.SynchronizeProperties(this.InternalSeries);
return this.InternalSeries;
}
/// <summary>
/// The synchronize properties.
/// </summary>
/// <param name="series">
/// The series.
/// </param>
protected override void SynchronizeProperties(OxyPlot.Series.Series series)
{
base.SynchronizeProperties(series);
var s = (OxyPlot.Series.HighLowSeries)series;
foreach (HighLowItem item in s.Items)
{
Trace.WriteLine("HighLowSeries " + item.X);
}
}
}
을, 나는 HighLowSeries
는 다음과 같은 방법을 사용 나는 (0,0)에서만 작은 수평선이 응용 프로그램을 시작할 때
private IList<HighLowItem> _list;
public IList<HighLowItem> list
{
get
{
return this._list;
}
set
{
this._list = value;
}
}
public MainWindow()
{
this.list = new List<HighLowItem>();
list.Add(new HighLowItem(10, 8, 3, 2, 5));
list.Add(new HighLowItem(12, 7, 4, 4, 2));
list.Add(new HighLowItem(18, 4, 1, 2, 3));
this.DataContext = this;
InitializeComponent();
}
: 나는 다음과 같은 코드가,
는 또한 내가 항목-컬렉션에 HighLowElements
의 X 좌표를 출력 HighLowSeries.SynchronizeProperties()
에 Trace.WriteLine
있다. 출력의 양은 list-property의 요소와 일치합니다 (MainWindow
). 그러나 X 좌표는 항상 0입니다 (HighLowElements
의 다른 속성뿐 아니라). 동일한 방법으로 직접 LineSeries
을 구현하면 모든 것이 제대로 작동합니다.
이것은 oxyplot의 버그입니까? 또는 나는 무엇인가 놓치고있다? 현재 코드를 통해 HighLowSeries
을 생성하는 것은 옵션이 아닙니다.