当前位置: 首页>>代码示例>>C#>>正文


C# Series.AddPoint方法代码示例

本文整理汇总了C#中Series.AddPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Series.AddPoint方法的具体用法?C# Series.AddPoint怎么用?C# Series.AddPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Series的用法示例。


在下文中一共展示了Series.AddPoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RespectsMostRecentTimeOnDuplicatePoints

 public void RespectsMostRecentTimeOnDuplicatePoints()
 {
     var series = new Series();
     series.AddPoint(DateTime.Today, 1m);
     series.AddPoint(DateTime.Today, 2m);
     Assert.AreEqual(1, series.Values.Count);
     Assert.AreEqual(2m, series.Values.Single().y);
 }
开发者ID:skyfyl,项目名称:Lean,代码行数:8,代码来源:SeriesTests.cs

示例2: DoesNotSampleScatterPlots

        public void DoesNotSampleScatterPlots()
        {
            var scatter = new Series("scatter", SeriesType.Scatter);
            scatter.AddPoint(DateTime.Today, 1m);
            scatter.AddPoint(DateTime.Today, 3m);
            scatter.AddPoint(DateTime.Today.AddSeconds(1), 1.5m);
            scatter.AddPoint(DateTime.Today.AddSeconds(0.5), 1.5m);

            var sampler = new SeriesSampler(TimeSpan.FromMilliseconds(1));
            var sampled = sampler.Sample(scatter, DateTime.Today, DateTime.Today.AddDays(1));
            foreach (var pair in scatter.Values.Zip<ChartPoint, ChartPoint, Tuple<ChartPoint, ChartPoint>>(sampled.Values, Tuple.Create))
            {
                Assert.AreEqual(pair.Item1.x, pair.Item2.x);
                Assert.AreEqual(pair.Item1.y, pair.Item2.y);
            }
        }
开发者ID:tremblayEric,项目名称:LeanHistory,代码行数:16,代码来源:SeriesSamplerTests.cs

示例3: SubSamples

        public void SubSamples()
        {
            var series = new Series {Name = "name"};
            var reference = DateTime.UtcNow.Date;
            series.AddPoint(reference, 1m);
            series.AddPoint(reference.AddDays(1), 2m);
            series.AddPoint(reference.AddDays(2), 3m);
            series.AddPoint(reference.AddDays(3), 4m);
            series.AddPoint(reference.AddDays(4), 5m);

            var sampler = new SeriesSampler(TimeSpan.FromDays(1));

            var sampled = sampler.Sample(series, reference.AddDays(1), reference.AddDays(2));
            Assert.AreEqual(2, sampled.Values.Count);

            Assert.AreEqual(series.Values[1].x, sampled.Values[0].x);
            Assert.AreEqual(series.Values[1].y, sampled.Values[0].y);

            Assert.AreEqual(series.Values[2].x, sampled.Values[1].x);
            Assert.AreEqual(series.Values[2].y, sampled.Values[1].y);
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:21,代码来源:SeriesSamplerTests.cs

示例4: ReturnsIdentityOnSinglePoint

        public void ReturnsIdentityOnSinglePoint()
        {
            var series = new Series {Name = "name"};
            var reference = DateTime.Now.ToUniversalTime();
            series.AddPoint(reference, 1m);

            var sampler = new SeriesSampler(TimeSpan.FromDays(1));

            var sampled = sampler.Sample(series, reference.AddSeconds(-1), reference.AddSeconds(1));
            Assert.AreEqual(1, sampled.Values.Count);
            Assert.AreEqual(series.Values[0].x, sampled.Values[0].x);
            Assert.AreEqual(series.Values[0].y, sampled.Values[0].y);
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:13,代码来源:SeriesSamplerTests.cs

示例5: EmitsEmptySeriesWithSinglePointOutsideOfStartStop

        public void EmitsEmptySeriesWithSinglePointOutsideOfStartStop()
        {
            var series = new Series { Name = "name" };
            var reference = DateTime.Now;
            series.AddPoint(reference.AddSeconds(-1), 1m);

            var sampler = new SeriesSampler(TimeSpan.FromDays(1));

            var sampled = sampler.Sample(series, reference, reference);
            Assert.AreEqual(0, sampled.Values.Count);
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:11,代码来源:SeriesSamplerTests.cs


注:本文中的Series.AddPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。