本文整理汇总了C#中OxyPlot.PlotModel.AddLine方法的典型用法代码示例。如果您正苦于以下问题:C# PlotModel.AddLine方法的具体用法?C# PlotModel.AddLine怎么用?C# PlotModel.AddLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OxyPlot.PlotModel
的用法示例。
在下文中一共展示了PlotModel.AddLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run()
{
/*var pm = new PlotModel();
var xs = Enumerable.Range(0, 1000).Select(x => x / 1000.0).Select(x => -100 + x * 100).ToArray();
var ys1 = xs.Select(x => Compress(x, ThresholdDb, UpperSlope, 3, true)).ToArray();
var ys2 = xs.Select(x => Compress(x, ThresholdDb + 6, LowerSlope, 3, true)).ToArray();
pm.AddLine(xs, ys1);
pm.AddLine(xs, ys2);
pm.Show();
*/
var pm = new PlotModel();
pm.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Key = "L" });
pm.Axes.Add(new LinearAxis { Position = AxisPosition.Right, Key = "R" });
var follower = new EnvelopeFollower(48000, 20);
var expander = new Expander();
var slewLimiter = new SlewLimiter(48000);
follower.SetRelease(ReleaseMs);
slewLimiter.UpdateDb60(2.0, ReleaseMs);
expander.Update(ThresholdDb, ReductionDb, UpperSlope);
var signalValues = new List<double>();
var followerValues = new List<double>();
var gainValues = new List<double>();
var rand = new Random();
Func<double> random = () => 2 * rand.NextDouble() - 1;
double decay = 1.0;
for (int i = 0; i < 20000; i++)
{
var x = (Math.Sin(i / fs * 2 * Math.PI * 300) + random() * 0.4) *decay;
decay *= 0.9998;
if (i < 1000)
x = random() * 0.001;
else if (i > 12000)
{
x = random() * 0.001;
}
signalValues.Add(x);
follower.ProcessEnvelope(x);
var env = follower.GetOutput();
followerValues.Add(env);
expander.Expand(Utils.Gain2Db(env));
var gainDb = expander.GetOutput();
gainDb = slewLimiter.Process(gainDb);
var gain = Utils.Db2Gain(gainDb);
gainValues.Add(gain);
}
var signalLine = pm.AddLine(signalValues);
signalLine.Title = "Signal";
signalLine.YAxisKey = "R";
//pm.AddLine(followerValues.Select(Utils.Gain2Db)).Title = "followerValues";
pm.AddLine(gainValues.Select(Utils.Gain2Db)).Title = "gainValues";
pm.Show();
}
示例2: TestMethod1
public void TestMethod1()
{
var t = new PolyhedrusNative(48000, 12003, 12004);
var data = t.GetWavetable(0);
var pm = new PlotModel();
pm.AddLine(data.WavetableData.Take(20000));
pm.Show();
}
示例3: TestMethodSlop
public void TestMethodSlop()
{
var data = new double[48000];
var dataF = new double[48000];
var random = new Random(0);
double sum = 0.0;
double filter = 0.0;
var fs = 4800;
Func<double, double> fcToAlpha = fc => (2 * Math.PI * fc / fs) / (2 * Math.PI * fc / fs + 1);
var freq = 1.0;
var samplesPerPoint = (int)(fs / (freq * 10));
var aHp = fcToAlpha(freq * 0.5);
var aLp = fcToAlpha(freq * 0.2);
var scale = 1.0 / samplesPerPoint;
var sample = 0.0;
var n = 0;
for (int i = 0; i < data.Length; i++)
{
if (n <= 0)
{
sample = (2 * random.NextDouble() - 1) * scale;
n = samplesPerPoint;
}
sum += sample;
filter = filter * (1 - aLp) + aLp * sum;
data[i] = sum;
dataF[i] = filter;
sum *= (1 - aHp);
n--;
}
var pm = new PlotModel();
pm.AddLine(data);
pm.AddLine(dataF);
pm.Show();
}