本文整理汇总了C#中ZedGraph.LineItem.GetRange方法的典型用法代码示例。如果您正苦于以下问题:C# LineItem.GetRange方法的具体用法?C# LineItem.GetRange怎么用?C# LineItem.GetRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.LineItem
的用法示例。
在下文中一共展示了LineItem.GetRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BUT_run_Click
private void BUT_run_Click(object sender, EventArgs e)
{
Utilities.FFT2 fft = new FFT2();
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "*.wav|*.wav";
ofd.ShowDialog();
if (!File.Exists(ofd.FileName))
return;
var st = File.OpenRead(ofd.FileName);
int bins = 10;
double[] buffer = new double[1 << bins];
int a = 0;
while (st.Position < st.Length)
{
byte[] temp = new byte[2];
var read = st.Read(temp, 0, temp.Length);
var val = (double)BitConverter.ToInt16(temp, 0);
buffer[a] = val;
a++;
if (a == (1 << bins))
{
var fftanswer = fft.rin(buffer, (uint)bins);
var freqt = fft.FreqTable(buffer.Length, 1000);
ZedGraph.PointPairList ppl = new ZedGraph.PointPairList();
for (int b = 0; b < fftanswer.Length; b++)
{
ppl.Add(freqt[b], fftanswer[b]);
}
double xMin, xMax, yMin, yMax;
var curve = new LineItem("FFT", ppl, Color.Red, SymbolType.Diamond);
curve.GetRange(out xMin, out xMax, out yMin, out yMax, true, false, zedGraphControl1.GraphPane);
zedGraphControl1.GraphPane.XAxis.Title.Text = "Freq Hz";
zedGraphControl1.GraphPane.YAxis.Title.Text = "Amplitude";
zedGraphControl1.GraphPane.Title.Text = "FFT";
zedGraphControl1.GraphPane.CurveList.Clear();
zedGraphControl1.GraphPane.CurveList.Add(curve);
zedGraphControl1.Invalidate();
zedGraphControl1.AxisChange();
zedGraphControl1.Refresh();
int width = Console.WindowWidth - 1;
int height = Console.WindowHeight - 1;
int r = 1;
foreach (var ff in fftanswer)
{
int col = (int)((r / (double)fftanswer.Length) * width);
int row = (int)((ff * 0.2) + 0.5);
//Console.SetCursorPosition(col, height - row);
Console.Write("*");
r++;
}
// 50% overlap
st.Seek(-(1 << bins) / 2, SeekOrigin.Current);
a = 0;
buffer = new double[buffer.Length];
//Console.Clear();
}
}
}
}