我正在尝试使用 128 个 bin 显示 FFT 的结果,但是当我执行以下操作以添加新数据时:
DataVisualization::Charting::Series^ series = m_chart->Series[0];
series->Points->DataBindY(m_dataBuffer);
m_chart->Refresh();
...它将我的光谱标记为 1 到 128。我需要这些标签来读取 0 到 127。实现这一目标的最简单方法是什么?
以防万一其他人想按照这些方式做某事,您可以使用自定义标签来做到这一点:
System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1 = this->m_chart->ChartAreas[0];
for( int i = 0; i < 128; i += 16 )
{
System::Windows::Forms::DataVisualization::Charting::CustomLabel^ customLabel1 = (gcnew System::Windows::Forms::DataVisualization::Charting::CustomLabel());
customLabel1->FromPosition = i-1.5;
customLabel1->Text = (i).ToString();
customLabel1->ToPosition = i+1.5;
chartArea1->AxisX->CustomLabels->Add(customLabel1);
}