如何减少蜱之间的距离?我想更密切地放蜡烛。
我在LinearAxis XAxis
中找不到任何响应距离的属性。
代码:
namespace WpfApplication20
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new PlotClass();
}
}
public class PlotClass
{
public PlotModel PlotModel { get; set; }
public PlotClass()
{
Random rnd = new Random();
PlotModel = new PlotModel();
LineSeries LS = new LineSeries();
LinearAxis XAxis = new LinearAxis
{
Position = AxisPosition.Bottom,
MinorStep=1,
MajorStep=1
};
LinearAxis YAxis = new LinearAxis()
{
Position = AxisPosition.Left
};
for (int i=0;i<10;i++)
{
LS.Points.Add(new DataPoint(i,rnd.Next(1,10)));
}
PlotModel.Axes.Add(YAxis);
PlotModel.Axes.Add(XAxis);
PlotModel.Series.Add(LS);
ChangeToCandles();
WhatTypeOfSeries();
}
public void ChangeToCandles()
{
Random rnd = new Random();
PlotModel.Series.Clear();
CandleStickSeries CSS = new CandleStickSeries();
for (int i = 0; i < 10;i++ )
{
CSS.Items.Add(new HighLowItem { X = i, Close = rnd.NextDouble(), High = rnd.NextDouble(), Low = rnd.NextDouble(), Open = rnd.NextDouble() });
}
PlotModel.Series.Add(CSS);
}
public void WhatTypeOfSeries()
{
var temp = PlotModel.Series[0].GetType();
Console.WriteLine(temp);
}
}
}
XAML:
<Grid>
<oxy:Plot Model="{Binding PlotModel}"/>
</Grid>
答案 0 :(得分:2)
尝试缩放:
XAxis.Zoom(-5, 15);
<强>编辑&gt;&GT;&GT;&GT; 强>
你有一个从0到10的for循环,你只需要添加一些调整值。对于更通用的限制:
int lowerIndex = 0;
int upperIndex = 10;
int zoomValue = 5;
for (int i=lowerIndex;i<upperIndex;i++)
{
LS.Points.Add(new DataPoint(i,rnd.Next(1,10)));
}
XAxis.Zoom(lowerIndex-zoomValue, upperIndex+zoomValue);
答案 1 :(得分:0)
尝试使用OFFSET
属性: