如何偏移 System.Windows.Forms.DataVisualization.Charting.Chart 中的标签?

发布于 2024-10-09 01:01:17 字数 286 浏览 0 评论 0原文

我正在尝试显示具有 128 个 bin 的 FFT 结果,但是当我执行以下操作来添加新数据时:

DataVisualization::Charting::Series^ series = m_chart->Series[0];
series->Points->DataBindY(m_dataBuffer);
m_chart->Refresh();

...它将我的光谱标记为从 1 到 128。我需要这些标签来读取 0 到 127。什么是实现这一目标的最简单方法?

I'm trying to display the results of an FFT with 128 bins, but when I do the following to add new data:

DataVisualization::Charting::Series^ series = m_chart->Series[0];
series->Points->DataBindY(m_dataBuffer);
m_chart->Refresh();

...it labels my spectra from 1 to 128. I need those labels to read 0 to 127. What's the easiest way to achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

偏爱你一生 2024-10-16 01:01:17

万一其他人想要按照这些方式做某事,您可以使用自定义标签来执行此操作:

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);
}

Just in case anyone else wants to do something along these lines, you can can do so using custom labels:

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);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文