daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. connect(&updateTimer, &QTimer::timeout, [this, chart, series, index](){
  2. QVector<QPointF> points;
  3. QVector<double> points_x;
  4. QVector<double> points_y;
  5. QList<QVariant> var = index.data(Qt::DisplayRole).toList();
  6. for(int i = 0; i < var.size(); i++)
  7. {
  8.     points_x << var.at(i).toPointF().x();
  9.     points_y << var.at(i).toPointF().y();
  10.     points << var.at(i).toPointF();
  11. }
  12.  
  13. series->replace(points);
  14.  
  15. double min_x = *std::min_element(points_x.constBegin(), points_x.constEnd());
  16. double min_y = *std::min_element(points_y.constBegin(), points_y.constEnd());
  17.  
  18. double max_x = *std::max_element(points_x.constBegin(), points_x.constEnd());
  19. double max_y = *std::max_element(points_y.constBegin(), points_y.constEnd());
  20.  
  21. chart->axisX()->setRange(min_x, max_x);
  22. chart->axisY()->setRange(min_y, max_y);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top