JASPL  0.2
Just Another Signal Processing Library
jchart_templates.tpp
1 template <class T>
2 void JChart::Plot( T input ) {
3 
4  uint N = input.size();
5 
6  time_series->clear();
7 
8  uint k = static_cast<uint>( ceil( static_cast<double>(N) / 2048.0f ) );
9 
10  for ( uint i = 0; i < N ; i += k ) {
11  time_series->append(i, input[i]);
12  }
13 
14  auto min = std::min_element(input.begin(), input.end());
15  auto max = std::max_element(input.begin(), input.end());
16 
17  chart->axisX()->setRange(0, N);
18  chart->axisY()->setRange(*min, *max);
19 }
20 
21 template <class T>
22 void JChart::Plot( T input, std::string chart_title ) {
23 
24  Plot( input );
25  chart->setTitle( QString::fromStdString( chart_title ) );
26 }