ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
save_batch.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphics
3
/// This macro demonstrates batch image mode of web canvas
4
/// When enabled - several images converted into JSON before all together
5
/// provided to headless browser to produce image files. Let significantly
6
/// increase performance. Important - disable batch mode for flushing remaining images
7
///
8
/// \macro_code
9
///
10
/// \author Sergey Linev
11
12
void
save_batch()
13
{
14
// 37 canvases will be collected together for conversion
15
TWebCanvas::BatchImageMode
(37);
16
17
auto
c
=
new
TCanvas
(
"canvas"
,
"Canvas with histogram"
);
18
19
auto
h1
=
new
TH1I
(
"hist"
,
"Histogram with random data"
, 100, -5., 5);
20
h1
->SetDirectory(
nullptr
);
21
h1
->FillRandom(
"gaus"
, 10000);
22
h1
->Draw();
23
24
for
(
int
n
= 0;
n
< 100; ++
n
) {
25
h1
->FillRandom(
"gaus"
, 10000);
26
c
->SaveAs(
TString::Format
(
"batch_image_%03d.png"
,
n
));
27
}
28
29
// Important - disabling batch mode also flush remaining images
30
TWebCanvas::BatchImageMode
(0);
31
}
c
#define c(i)
Definition
RSha256.hxx:101
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1I
1-D histogram with an int per channel (see TH1 documentation)
Definition
TH1.h:796
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition
TString.cxx:2385
TWebCanvas::BatchImageMode
static void BatchImageMode(UInt_t n=100)
Configure batch image mode for web graphics.
Definition
TWebCanvas.cxx:160
n
const Int_t n
Definition
legend1.C:16
h1
TH1F * h1
Definition
legend1.C:5
tutorials
visualisation
graphics
save_batch.C
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1