Draw a TBox and TLine that resizes when zooming


ROOT Version: 6.12/06
Platform: f29
Compiler: gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)


Dear co-rooters,

I am creating a two-padded canvas in which I am drawing histograms, TBoxes and TLines.
The problem is that when zooming on the x-axis, the TBoxes and the TLines are outside of the Pad frame, as shown below

These objects are constructed by using the following code

TBox *signal_locator_movie[number_of_pulses];
for (int i=0; i<number_of_pulses; ++i){
	signal_locator_movie[i] = new TBox(start_signal_time[i], maximum_point_movie, end_signal_time[i], minimum_point_movie);
	signal_locator_movie[i]->SetFillStyle(3002);
	signal_locator_movie[i]->SetFillColor(kBlack);
	signal_locator_movie[i]->Draw();
}

and the TLine

TLine *middle_locator_movie[number_of_pulses];
for (int i=0; i<number_of_pulses; ++i){
	middle_locator_movie[i] = new TLine(middle_points[i], maximum_point_movie, middle_points[i], minimum_point_movie);
	middle_locator_movie[i]->SetLineColor(kBlack);
	middle_locator_movie[i]->SetLineWidth(2);
	middle_locator_movie[i]->DrawLine(middle_points[i], maximum_point_movie, middle_points[i], minimum_point_movie);
}

Any idea on how to draw the TLines and TBoxes so that when zooming on x-axis. they won’t be drawn outside of the frame?

Thanks in advance!

Hi,
our graphics expert, @couet, is currently travelling and should be back next week.
Maybe some other ROOT user knows how to achieve what you want – if not, please ping us again next week!

Cheers,
Enrico

1 Like

Hi
even simpler
dont use TBox but TGraph
see att macro:
overlay.C (570 Bytes)
Otto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.