This macro shows how ROOT RCanvas::Update method is working.
One can do sync and/or async depending how important is that graphics is updated before next action will be performed
#include <iostream>
void rcanvas_update()
{
static constexpr int npoints = 10;
double x[npoints] = {1., 2., 3., 4., 5., 6., 7., 8., 9., 10.};
double y[npoints] = {.1, .2, .3, .2, .1, .2, .3, .2, .1, .2};
canvas->Show();
canvas->Update(false,
[](bool res) { std::cout << "First sync update done = " << (res ? "true" : "false") << std::endl; });
canvas->Modified();
canvas->Update(
true, [](bool res) { std::cout << "Second async update done = " << (res ? "true" : "false") << std::endl; });
std::cout << "This message appear normally before second async update" << std::endl;
}
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
Namespace for ROOT features in testing.
- Date
- 2021-07-05
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Author
- Sergey Linev s.lin.nosp@m.ev@g.nosp@m.si.de
Definition in file rcanvas_update.cxx.