本文整理汇总了C#中EnumerableDataSource.SetXYMapping方法的典型用法代码示例。如果您正苦于以下问题:C# EnumerableDataSource.SetXYMapping方法的具体用法?C# EnumerableDataSource.SetXYMapping怎么用?C# EnumerableDataSource.SetXYMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnumerableDataSource
的用法示例。
在下文中一共展示了EnumerableDataSource.SetXYMapping方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLineGraph
private void AddLineGraph(Point startPoint, Point endPoint)
{
var ds = new EnumerableDataSource<Point>(new List<Point> {
new Point { X = startPoint.X, Y = startPoint.Y },
new Point { X = endPoint.X, Y = endPoint.Y }
});
ds.SetXYMapping(pt => pt);
plotter.AddLineGraph(ds);
}
示例2: CreateSineDataSource
private IPointDataSource CreateSineDataSource(double phase)
{
const int N = 100;
Point[] pts = new Point[N];
for (int i = 0; i < N; i++)
{
double x = i / (N / 10.0) + phase;
pts[i] = new Point(x, Math.Sin(x - phase));
}
var ds = new EnumerableDataSource<Point>(pts);
ds.SetXYMapping(pt => pt);
return ds;
}
示例3: CreateSineDataSource
private IPointDataSource CreateSineDataSource(double phase)
{
const int N = 100000;
Point[] pts = new Point[N];
Random r = new Random();
for (int i = 0; i < N; i++)
{
double x = 10.0* i / N + phase;
pts[i] = new Point(x, Math.Sin(x - phase) + (r.NextDouble()-0.5)/1000);
}
var ds = new EnumerableDataSource<Point>(pts);
ds.SetXYMapping(pt => pt);
return ds;
}
示例4: plotter_Loaded
private void plotter_Loaded(object sender, RoutedEventArgs e)
{
innerPlotter.ViewportBindingConverter = new InjectedPlotterVerticalSyncConverter(innerPlotter);
if (Record != null && !string.IsNullOrEmpty(Record.Id))
{
Record = MySession.Session.Get<Exerciserecord>(Record.Id);
if (Record != null)
{
float[] targetLine = null;
float[] actionLine = null;
float[] powerLine = null;
int xLength = int.MaxValue;
if (Record.Record1 != null && !string.IsNullOrEmpty(Record.Record1)) //目标轨迹
{
var temp = record.Record1.Split('|');
targetLine = new float[temp.Length];
for (int i = 0; i < temp.Length; i++)
{
if (!string.IsNullOrEmpty(temp[i]))
{
targetLine[i] = Convert.ToSingle(temp[i]);
}
}
if (temp.Length < xLength) xLength = temp.Length;
}
if (Record.Record2 != null && !string.IsNullOrEmpty(Record.Record2)) //实际运动轨迹
{
var temp = record.Record2.Split('|');
actionLine = new float[temp.Length];
for (int i = 0; i < temp.Length; i++)
{
if (!string.IsNullOrEmpty(temp[i]))
{
actionLine[i] = Convert.ToSingle(temp[i]);
}
}
if (temp.Length < xLength) xLength = temp.Length;
}
if (Record.Record3 != null && !string.IsNullOrEmpty(Record.Record3)) //力量
{
var temp = record.Record3.Split('|');
powerLine = new float[temp.Length];
for (int i = 0; i < temp.Length; i++)
{
if (!string.IsNullOrEmpty(temp[i]))
{
powerLine[i] = Convert.ToSingle(temp[i]);
}
}
if (temp.Length < xLength) xLength = temp.Length;
}
if (xLength < int.MaxValue)
{
//添加X轴
var xs = Enumerable.Range(1, xLength).Select(i => i * 1).ToArray();
//var xds = xs.AsXDataSource();
plotter.Visible = DataRect.Create(0, -60, xLength, 60);
//添加目标轨迹
if (targetLine != null)
{
var target = targetLine.Take(xLength).ToArray();
//var tl = target.Join(xds);
var tl = new List<Point>();
for (int i = 0; i < xLength; i++)
{
Point p = new Point(xs[i], target[i]);
tl.Add(p);
}
var ds = new EnumerableDataSource<Point>(tl);
ds.SetXYMapping(pt => pt);
plotter.AddLineGraph(ds, Colors.Red, 2, "目标轨迹");
}
//添加运动轨迹
if (actionLine != null)
{
var action = actionLine.Take(xLength).ToArray();
//var al = action.Join(xds);
var al = new List<Point>();
for (int i = 0; i < xLength; i++)
{
Point p = new Point(xs[i], action[i]);
al.Add(p);
}
var ds = new EnumerableDataSource<Point>(al);
ds.SetXYMapping(pt => pt);
plotter.AddLineGraph(ds, Colors.Blue, 2, "运动轨迹");
}
//添加力量
if (powerLine != null)
{
//.........这里部分代码省略.........