51 #include <TInterpreter.h>
61 gPad->SetFrameFillColor(18);
62 gStyle->SetOptStat(0);
63 Int_t nrDivisions = graph->GetN();
65 TH1F *frame =
new TH1F(graph->GetName(),graph->GetTitle(),2,
xmin,xmax+1);
66 frame->SetMinimum(ymin);
67 frame->SetMaximum(ymax);
68 frame->SetLabelOffset(10);
69 frame->SetLabelSize(0.0);
70 frame->SetNdivisions(0);
71 frame->SetTitleOffset(1.1,
"X");
72 frame->SetXTitle((
char*)xname.Data());
73 frame->SetTitleOffset(1.1,
"Y");
76 TText *
t =
new TText();
78 t->SetTextSize(0.022);
80 Float_t span = xmax-
xmin;
81 Float_t
step = Float_t(span/nrDivisions);
82 Float_t
dist = TMath::Abs(ymax-ymin);
84 for (Int_t
j=0;
j<nrDivisions;
j++) {
86 Float_t ypos = ymin-0.05*
dist;
87 t->DrawText(xpos,ypos,labels[
j].
Data());
91 graph->SetFillColor(rand()%149);
92 graph->SetLineWidth(1.0);
98 const Text_t* usr=
"scott",
99 const Text_t* pwd=
"tiger" )
108 str =
"Connecting to dsn="; str += dsn;
109 str +=
", uid="; str += usr;
110 str +=
", pwd="; str += pwd;
112 printf(
"%s\n",str.Data());
115 if(!gConn)
return -1;
123 const Int_t nrows = 14;
125 Float_t empno[nrows];
129 TString ename[nrows];
131 for(
int i=0;
i<nrows;
i++) {
142 TCanvas*
c =
new TCanvas(
"EMP",
"EMP table",900,600);
146 Float_t
xmax = nrows;
152 gPad->SetFillColor(38);
153 gPad->SetToolTipText(
"This is EMPNO distribution");
154 ind = TMath::LocMin(nrows,empno);
156 ind = TMath::LocMax(nrows,empno);
157 ymax = empno[ind]*1.05;
158 gr =
new TGraph(nrows,row,empno);
159 gr->SetName(
"empno");
160 gr->SetTitle(
"empno");
161 DrawGraph(gr,ename,
"ename",xmin,xmax,ymin,ymax);
164 gPad->SetFillColor(30);
165 gPad->SetToolTipText(
"This is SAL distribution");
166 ind = TMath::LocMin(nrows,sal);
168 ind = TMath::LocMax(nrows,sal);
169 ymax = sal[ind]*1.05;
170 gr =
new TGraph(nrows,row,sal);
173 DrawGraph(gr,ename,
"sal",xmin,xmax,ymin,ymax);
176 gPad->SetFillColor(47);
177 gPad->SetToolTipText(
"This is MGR distribution");
178 ind = TMath::LocMin(nrows,mgr);
181 ind = TMath::LocMax(nrows,mgr);
182 ymax = mgr[ind]*1.05;
183 gr =
new TGraph(nrows,row,mgr);
186 DrawGraph(gr,ename,
"ename",xmin,xmax,ymin,ymax);
189 gPad->SetFillColor(42);
190 gPad->SetToolTipText(
"This is COMM distribution");
191 ind = TMath::LocMin(nrows,comm);
192 ymin = comm[ind]*0.9;
193 ind = TMath::LocMax(nrows,comm);
194 ymax = comm[ind]*1.05;
195 gr =
new TGraph(nrows,row,comm);
197 gr->SetTitle(
"comm");
198 DrawGraph(gr,ename,
"ename",xmin,xmax,ymin,ymax);
209 printf(
"SQL Error: %s\n",str.Data());
218 #include <TApplication.h>
222 TROOT
root(
"RDBCemp",
"EMP table graphs");
224 int main(
int argc,
char **argv)
226 if(argc!=3 && argc!=4) {
227 cerr <<
"Usage: " << argv[0] <<
" url username" << endl
228 <<
"or " << argv[0] <<
" url username password" << endl;
232 TApplication theApp(
"App", &argc, argv);
234 if (gROOT->IsBatch()) {
235 cerr << argv[0] <<
"cannot run in batch mode" << endl;
239 gSystem->Load(
"libRDBC");
242 if(argc==3) ret=
RDBCemp(argv[1],argv[2],
"");
243 else ret =
RDBCemp(argv[1],argv[2],argv[3]);