Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TParallelCoordEditor.cxx
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2// Author: Bastien Dalla Piazza 02/08/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
13#include "TParallelCoord.h"
14#include "TParallelCoordRange.h"
15#include "TParallelCoordVar.h"
16
17#include "TGButton.h"
18#include "TGButtonGroup.h"
19#include "TGNumberEntry.h"
20#include "TGLabel.h"
21#include "TGTextEntry.h"
22#include "TGComboBox.h"
23#include "TGColorSelect.h"
24#include "TColor.h"
25#include "TG3DLine.h"
26#include "TGSlider.h"
27#include "TGDoubleSlider.h"
28#include "TGedPatternSelect.h"
29#include "TCanvas.h"
30
31#include "TROOT.h"
32
34
35
36/** \class TParallelCoordEditor
37
38This is the TParallelCoord editor. It brings tools to explore datas
39Using parallel coordinates. The main tools are:
40
41 - Dots spacing : Set the dots spacing with which-one the lines
42 must be drawn. This tool is useful to reduce the image
43 cluttering.
44 - The Selections section : Set the current edited selection and
45 allows to apply it to the tree through a generated entry list.
46 - The Entries section : Set how many events must be drawn.
47 A weight cut can be defined here (see TParallelCoord for a
48 a description of the weight cut).
49 - The Variables tab : To define the global settings to display
50 the axes. It is also possible to add a variable from its
51 expression or delete a selected one (also possible using right
52 click on the pad.
53*/
54
91
92////////////////////////////////////////////////////////////////////////////////
93/// Normal constructor.
94
96 Int_t/*width*/, Int_t /*height*/,
97 UInt_t /*options*/, Pixel_t /*back*/)
98{
99 fPriority = 1;
100 fDelay = true;
101
102 // Line
103 MakeTitle("Line");
104
109 fGlobalLineWidth->Resize(91, 20);
110 f1->AddFrame(fGlobalLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
112
113 if (!TCanvas::SupportAlpha()) {
114
115 AddFrame(new TGLabel(this,"Dots spacing"),
117
118 TGHorizontalFrame *f2 = new TGHorizontalFrame(this);
120 fDotsSpacing->SetRange(0,60);
125 fDotsSpacingField->Resize(40,20);
128 }
129 else {
130 TGLabel *AlphaLabel = new TGLabel(this,"Opacity");
131 AddFrame(AlphaLabel,
133 TGHorizontalFrame *f2a = new TGHorizontalFrame(this);
134 fAlpha = new TGHSlider(f2a,100,kSlider2|kScaleNo,kAlpha);
135 fAlpha->SetRange(0,1000);
140 fAlphaField->Resize(40,20);
143 }
144
145 fLineTypeBgroup = new TGButtonGroup(this,2,1,0,0, "Line type");
146 fLineTypeBgroup->SetRadioButtonExclusive(true);
148 fLineTypePoly->SetToolTipText("Draw the entries with a polyline");
151 fLineTypeCurves->SetToolTipText("Draw the entries with a curve");
154
155 // Selections
156 MakeTitle("Selections");
157
158 fHideAllRanges = new TGCheckButton(this,"Hide all ranges",kHideAllRanges);
160
162 fSelectionSelect->Resize(140,20);
164
165 TGHorizontalFrame *f3 = new TGHorizontalFrame(this);
169 fSelectLineWidth->Resize(94, 20);
170 f3->AddFrame(fSelectLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
171 AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsTop,0,0,3,0));
172
174 fActivateSelection->SetToolTipText("Activate the current selection");
176 fShowRanges = new TGCheckButton(this,"Show ranges",kShowRanges);
178
179 TGHorizontalFrame *f5 = new TGHorizontalFrame(this);
181 fAddSelectionField->Resize(57,20);
183 fAddSelection = new TGTextButton(f5,"Add");
184 fAddSelection->SetToolTipText("Add a new selection (Right click on the axes to add a range).");
187 fDeleteSelection->SetToolTipText("Delete the current selection");
190
191 TGHorizontalFrame *f7 = new TGHorizontalFrame(this);
192 fApplySelect = new TGTextButton(f7,"Apply to tree",kApplySelect);
193 fApplySelect->SetToolTipText("Generate an entry list for the current selection and apply it to the tree.");
195 fUnApply = new TGTextButton(f7,"Reset tree",kUnApply);
196 fUnApply->SetToolTipText("Reset the tree entry list");
199
200 // Entries
201 MakeTitle("Entries");
202
203 fPaintEntries = new TGCheckButton(this,"Draw entries",kPaintEntries);
205 fDelayDrawing = new TGCheckButton(this,"Delay Drawing", kDelayDrawing);
207
210
211 TGHorizontalFrame *f6 = new TGHorizontalFrame(this);
214 v1->AddFrame(new TGLabel(v1,"First entry:"));
218 fFirstEntry->Resize(68,20);
219 v1->AddFrame(fFirstEntry);
220 v2->AddFrame(new TGLabel(v2,"# of entries:"));
224 fNentries->Resize(68,20);
225 v2->AddFrame(fNentries);
226 f6->AddFrame(v1);
227 f6->AddFrame(v2, new TGLayoutHints(kLHintsLeft,4,0,0,0));
228 AddFrame(f6);
229
230 AddFrame(new TGLabel(this,"Weight cut:"));
231
232 TGHorizontalFrame *f8 = new TGHorizontalFrame(this);
237 fWeightCutField->Resize(40,20);
238 f8->AddFrame(fWeightCut);
240 AddFrame(f8);
241
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Make the "variable" tab.
247
249{
250 fVarTab = CreateEditorTabSubFrame("Variables");
251 // Variable
252
254 fAddVariable = new TGTextEntry(f9);
255 fAddVariable->Resize(71,20);
257 fButtonAddVar = new TGTextButton(f9,"Add");
258 fButtonAddVar->SetToolTipText("Add a new variable from the tree (must be a valid expression).");
260 fVarTab->AddFrame(f9);
261
264 fVariables->Resize(105,20);
266 fVarTab->AddFrame(f10,new TGLayoutHints(kLHintsLeft,0,0,2,0));
267
269 fDeleteVar = new TGTextButton(f12,"Delete",kDeleteVar);
270 fDeleteVar->SetToolTipText("Delete the current selected variable");
272 fRenameVar = new TGTextButton(f12,"Rename",kRenameVar);
273 fRenameVar->SetToolTipText("Rename the current selected variable");
275 fVarTab->AddFrame(f12,new TGLayoutHints(kLHintsLeft,0,0,2,0));
276
277 fVarTab->AddFrame(new TGLabel(fVarTab,"Axis histograms:"));
278
282 v3->AddFrame(new TGLabel(v3,"Binning:"));
286 fHistBinning->Resize(68,20);
287 v3->AddFrame(fHistBinning);
288 v4->AddFrame(new TGLabel(v4,"Width:"));
292 fHistWidth->Resize(68,20);
293 v4->AddFrame(fHistWidth, new TGLayoutHints(kLHintsLeft,4,0,0,0));
294 f11->AddFrame(v3);
295 f11->AddFrame(v4);
296 fVarTab->AddFrame(f11);
297
298 fHistShowBoxes = new TGCheckButton(fVarTab,"Show box histograms");
299 fVarTab->AddFrame(fHistShowBoxes);
300
301 fVarTab->AddFrame(new TGLabel(fVarTab,"Bar histograms style:"));
302
305 f13->AddFrame(fHistColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
306 fHistColorSelect->Associate(this);
309 fHistPatternSelect->Associate(this);
310 fVarTab->AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Destructor.
315
321
322////////////////////////////////////////////////////////////////////////////////
323/// Clean up the selection combo box.
324
326{
327 TList *list = fParallel->GetSelectList();
328 fSelectionSelect->RemoveAll();
329 bool enable = list->GetSize() > 0;
330 fSelectionSelect->SetEnabled(enable);
331 fSelectLineColor->SetEnabled(enable);
332 fSelectLineWidth->SetEnabled(enable);
333 fActivateSelection->SetEnabled(enable);
334 fShowRanges->SetEnabled(enable);
335 fDeleteSelection->SetEnabled(enable);
336 if (list->GetSize() > 0) {
337 Int_t i = 0;
338 TIter next(list);
340 while ((sel = (TParallelCoordSelect*)next())) {
341 fSelectionSelect->AddEntry(sel->GetTitle(),i);
342 TGLBEntry *entry = fSelectionSelect->GetListBox()->GetEntry(i);
343 if (entry)
344 entry->SetBackgroundColor(TColor::Number2Pixel(sel->GetLineColor()));
345 ++i;
346 }
347 sel = fParallel->GetCurrentSelection();
348 if (sel) {
349 fSelectionSelect->Select(list->IndexOf(sel),false);
350 Color_t c;
351 Pixel_t p;
352 c = sel->GetLineColor();
354 fSelectLineColor->SetColor(p);
355 fSelectLineWidth->Select(sel->GetLineWidth());
358 }
359 }
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Clean up the variables combo box.
364
366{
367 TList *list = fParallel->GetVarList();
368 fVariables->RemoveAll();
369 bool enable = list->GetSize() > 0;
370 fVariables->SetEnabled(enable);
371 fDeleteVar->SetEnabled(enable);
372 fHistShowBoxes->SetEnabled(enable);
373 fHistWidth->SetEnabled(enable);
374 fHistBinning->SetEnabled(enable);
375 if (list->GetSize() > 0) {
376 Int_t i = 0;
377 TIter next(list);
379 while ((var = (TParallelCoordVar*)next())) {
380 fVariables->AddEntry(var->GetTitle(),i);
381 ++i;
382 }
383 var = (TParallelCoordVar*)list->First();
384 fVariables->Select(0,false);
386 fHistWidth->SetNumber(var->GetHistLineWidth());
387 fHistBinning->SetNumber(var->GetHistBinning());
388 }
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Connect signals to slots.
393
395{
396 fGlobalLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
397 this, "DoGlobalLineColor(Pixel_t)");
398 fGlobalLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
399 this, "DoGlobalLineWidth(Int_t)");
400 if (!TCanvas::SupportAlpha()) {
401 fDotsSpacing->Connect("Released()","TParallelCoordEditor",
402 this, "DoDotsSpacing()");
403 fDotsSpacing->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
404 this, "DoLiveDotsSpacing(Int_t)");
405 fDotsSpacingField->Connect("ReturnPressed()","TParallelCoordEditor",
406 this, "DoDotsSpacingField()");
407 }
408 else {
409 fAlpha->Connect("Released()","TParallelCoordEditor",
410 this, "DoAlpha()");
411 fAlpha->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
412 this, "DoLiveAlpha(Int_t)");
413 fAlphaField->Connect("ReturnPressed()","TParallelCoordEditor",
414 this, "DoAlphaField()");
415 }
416 fLineTypeBgroup->Connect("Clicked(Int_t)", "TParallelCoordEditor",
417 this, "DoLineType()");
418 fSelectionSelect->Connect("Selected(const char*)","TParallelCoordEditor",
419 this, "DoSelectionSelect(const char*)");
420 fSelectLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
421 this, "DoSelectLineColor(Pixel_t)");
422 fSelectLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
423 this, "DoSelectLineWidth(Int_t)");
424 fActivateSelection->Connect("Toggled(bool)","TParallelCoordEditor",
425 this, "DoActivateSelection(bool)");
426 fShowRanges->Connect("Toggled(bool)","TParallelCoordEditor",
427 this, "DoShowRanges(bool)");
428 fDeleteSelection->Connect("Clicked()","TParallelCoordEditor",
429 this, "DoDeleteSelection()");
430 fAddSelection->Connect("Clicked()","TParallelCoordEditor",
431 this, "DoAddSelection()");
432 fPaintEntries->Connect("Toggled(bool)","TParallelCoordEditor",
433 this, "DoPaintEntries(bool)");
434 fEntriesToDraw->Connect("Released()","TParallelCoordEditor",
435 this, "DoEntriesToDraw()");
436 fEntriesToDraw->Connect("PositionChanged()","TParallelCoordEditor",
437 this, "DoLiveEntriesToDraw()");
438 fFirstEntry->Connect("ReturnPressed()","TParallelCoordEditor",
439 this, "DoFirstEntry()");
440 fNentries->Connect("ReturnPressed()","TParallelCoordEditor",
441 this, "DoNentries()");
442 fApplySelect->Connect("Clicked()","TParallelCoordEditor",
443 this, "DoApplySelect()");
444 fUnApply->Connect("Clicked()","TParallelCoordEditor",
445 this, "DoUnApply()");
446 fDelayDrawing->Connect("Toggled(bool)","TParallelCoordEditor",
447 this, "DoDelayDrawing(bool)");
448 fAddVariable->Connect("ReturnPressed()","TParallelCoordEditor",
449 this, "DoAddVariable()");
450 fButtonAddVar->Connect("Clicked()","TParallelCoordEditor",
451 this, "DoAddVariable()");
452 fHideAllRanges->Connect("Toggled(bool)","TParallelCoordEditor",
453 this, "DoHideAllRanges(bool)");
454 fVariables->Connect("Selected(const char*)","TParallelCoordEditor",
455 this, "DoVariableSelect(const char*)");
456 fDeleteVar->Connect("Clicked()","TParallelCoordEditor",
457 this, "DoDeleteVar()");
458 fHistWidth->Connect("ReturnPressed()","TParallelCoordEditor",
459 this, "DoHistWidth()");
460 fHistBinning->Connect("ReturnPressed()","TParallelCoordEditor",
461 this, "DoHistBinning()");
462 fWeightCut->Connect("Released()","TParallelCoordEditor",
463 this, "DoWeightCut()");
464 fWeightCut->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
465 this, "DoLiveWeightCut(Int_t)");
466 fWeightCutField->Connect("ReturnPressed()","TParallelCoordEditor",
467 this, "DoWeightCut()");
468 fHistColorSelect->Connect("ColorSelected(Pixel_t)", "TParallelCoordEditor",
469 this, "DoHistColorSelect(Pixel_t)");
470 fHistPatternSelect->Connect("PatternSelected(Style_t)", "TParallelCoordEditor",
471 this, "DoHistPatternSelect(Style_t)");
472 fHistShowBoxes->Connect("Toggled(bool)","TParallelCoordEditor",
473 this, "DoHistShowBoxes(bool)");
474
475 fInit = false;
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Slot to activate or not a selection.
480
482{
483 if (fAvoidSignal) return;
484
485 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
486 if (sel) {
487 sel->SetActivated(on);
488 Update();
489 }
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// Slot to add a selection.
494
496{
497 TString title = fAddSelectionField->GetText();
498 if (title == "") title = "Selection";
499 TString titlebis = title;
500 bool found = true;
501 Int_t i=1;
502 while (found){
503 if (fSelectionSelect->FindEntry(titlebis)) {
504 titlebis = title;
505 titlebis.Append(Form("(%d)",i));
506 }
507 else found = false;
508 ++i;
509 }
510
511 fParallel->AddSelection(titlebis.Data());
512
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Slot to add a variable.
518
520{
521 if (fAvoidSignal) return;
522
523 fParallel->AddVariable(fAddVariable->GetText());
525 Update();
526}
527
528////////////////////////////////////////////////////////////////////////////////
529/// Slot to apply a selection to the tree.
530
532{
533 //FIXME I forgot to update the slider over the entries
534 // (nentries and firstentry might have changed after applying the selection)
535
536 if (fAvoidSignal) return;
537
538 fParallel->ApplySelectionToTree();
539 Update();
541}
542
543////////////////////////////////////////////////////////////////////////////////
544/// Slot to delay the drawing.
545
547{
548 if (fAvoidSignal) return;
549
550 fDelay = on;
551 fParallel->SetLiveRangesUpdate(!on);
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Slot to delete a selection.
556
558{
559 if (fAvoidSignal) return;
560
561 fParallel->DeleteSelection(fParallel->GetCurrentSelection());
562
564 Update();
565}
566
567////////////////////////////////////////////////////////////////////////////////
568/// Slot to delete a variable().
569
571{
572 if (fAvoidSignal) return;
573
574 bool hasDeleted = fParallel->RemoveVariable(((TGTextLBEntry*)fVariables->GetSelectedEntry())->GetTitle());
576 if (hasDeleted) Update();
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Slot to set the line dot spacing.
581
583{
584 if (fAvoidSignal) return;
585
586 fParallel->SetDotsSpacing(fDotsSpacing->GetPosition());
587 fDotsSpacingField->SetNumber((Int_t)fDotsSpacing->GetPosition());
588 Update();
589}
590
591////////////////////////////////////////////////////////////////////////////////
592/// Slot to set the line dot spacing from the entry field.
593
595{
596 if (fAvoidSignal) return;
597
598 fParallel->SetDotsSpacing((Int_t)fDotsSpacingField->GetNumber());
599 fDotsSpacing->SetPosition((Int_t)fDotsSpacingField->GetNumber());
600 Update();
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Slot to set the alpha value from the entry field.
605
607{
608 if (fAvoidSignal) return;
609
610 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
611 color->SetAlpha((Float_t)fAlphaField->GetNumber());
612 fAlpha->SetPosition((Int_t)fAlphaField->GetNumber()*1000);
613 }
614 Update();
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Slot to set the alpha value
619
621{
622 if (fAvoidSignal) return;
623
624 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
625 color->SetAlpha((Float_t)fAlpha->GetPosition()/1000);
626 fAlphaField->SetNumber((Float_t)fAlpha->GetPosition()/1000);
627 }
628 Update();
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Slot to select the entries to be drawn.
633
635{
636 if (fAvoidSignal) return;
637
638 Long64_t nentries,firstentry;
639 firstentry = fEntriesToDraw->GetMinPositionL();
640 nentries = (Long64_t)(fEntriesToDraw->GetMaxPositionD() - fEntriesToDraw->GetMinPositionD() + 1);
641
642 fParallel->SetCurrentFirst(firstentry);
643 fParallel->SetCurrentN(nentries);
644 Update();
645}
646
647////////////////////////////////////////////////////////////////////////////////
648/// Slot to set the first entry.
649
651{
652 if (fAvoidSignal) return;
653
654 fParallel->SetCurrentFirst((Long64_t)fFirstEntry->GetNumber());
655 fEntriesToDraw->SetPosition((Long64_t)fFirstEntry->GetNumber(),(Long64_t)fFirstEntry->GetNumber()+fParallel->GetCurrentN());
656 Update();
657}
658
659////////////////////////////////////////////////////////////////////////////////
660/// Slot to set the global line color.
661
663{
664 if (fAvoidSignal) return;
665
666 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
667 color->SetAlpha(1);
668 color = gROOT->GetColor(TColor::GetColor(a));
669 if (color) {
670 color->SetAlpha((Float_t)fAlphaField->GetNumber());
671 fParallel->SetLineColor(color->GetNumber());
672 }
673 }
674 Update();
675}
676
677////////////////////////////////////////////////////////////////////////////////
678/// Slot to set the global line width.
679
681{
682 if (fAvoidSignal) return;
683
684 fParallel->SetLineWidth(wid);
685 Update();
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Slot to hide all the ranges.
690
692{
693 if (fAvoidSignal) return;
694
695 TIter next(fParallel->GetSelectList());
697 while((sel = (TParallelCoordSelect*)next())) sel->SetShowRanges(!on);
698 fShowRanges->SetOn(!on);
699 fShowRanges->SetEnabled(!on);
700 fShowRanges->SetOn(!on);
701 Update();
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// Slot to set the axes histogram binning.
706
708{
709 if (fAvoidSignal) return;
710
711 fParallel->SetAxisHistogramBinning((Int_t)fHistBinning->GetNumber());
712 Update();
713}
714
715////////////////////////////////////////////////////////////////////////////////
716/// Slot to set the histograms color.
717
719{
720 if (fAvoidSignal) return;
721
722 Color_t col = TColor::GetColor(p);
723 TIter next(fParallel->GetVarList());
724 TParallelCoordVar *var = nullptr;
725 while ((var = (TParallelCoordVar*)next())) var->SetFillColor(col);
726 Update();
727}
728
729////////////////////////////////////////////////////////////////////////////////
730/// Slot to set histogram height.
731
733{
734 if (fAvoidSignal) return;
735
736 TIter next(fParallel->GetVarList());
738 while ((var = (TParallelCoordVar*)next())) var->SetBit(TParallelCoordVar::kShowBarHisto,s);
739 Update();
740}
741
742////////////////////////////////////////////////////////////////////////////////
743/// Slot to set the histograms fill style.
744
746{
747 if (fAvoidSignal) return;
748
749 TIter next(fParallel->GetVarList());
750 TParallelCoordVar *var = nullptr;
751 while ((var = (TParallelCoordVar*)next())) var->SetFillStyle(sty);
752 Update();
753}
754
755////////////////////////////////////////////////////////////////////////////////
756/// Slot to set histogram width.
757
759{
760 if (fAvoidSignal) return;
761
762 fParallel->SetAxisHistogramLineWidth((Int_t)fHistWidth->GetNumber());
763 Update();
764}
765
766////////////////////////////////////////////////////////////////////////////////
767/// Slot to set the line type.
768
770{
771 if (fAvoidSignal) return;
772
773 if (fLineTypePoly->GetState() == kButtonDown) fParallel->SetCurveDisplay(false);
774 else fParallel->SetCurveDisplay(true);
775 Update();
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Slot to set the dots spacing online.
780
782{
783 if (fAvoidSignal) return;
784 fDotsSpacingField->SetNumber(a);
785 fParallel->SetDotsSpacing(a);
786 if (!fDelay) Update();
787}
788
789////////////////////////////////////////////////////////////////////////////////
790/// Slot to set alpha value online.
791
793{
794 if (fAvoidSignal) return;
795 fAlphaField->SetNumber((Float_t)a/1000);
796
797 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) color->SetAlpha((Float_t)a/1000);
798 if (!fDelay) Update();
799}
800
801////////////////////////////////////////////////////////////////////////////////
802/// Slot to update the entries fields from the slider position.
803
805{
806 if (fAvoidSignal) return;
807
808 Long64_t nentries,firstentry;
809 firstentry = fEntriesToDraw->GetMinPositionL();
810 nentries = (Long64_t)(fEntriesToDraw->GetMaxPositionD() - fEntriesToDraw->GetMinPositionD() + 1);
811
812 fFirstEntry->SetNumber(firstentry);
813 fNentries->SetNumber(nentries);
814
815 if (!fDelay) {
816 fParallel->SetCurrentFirst(firstentry);
817 fParallel->SetCurrentN(nentries);
818 Update();
819 }
820}
821
822////////////////////////////////////////////////////////////////////////////////
823/// Slot to update the weight cut entry field from the slider position.
824
826{
827 if (fAvoidSignal) return;
828
829 fWeightCutField->SetNumber(n);
830 if (!fDelay) {
831 fParallel->SetWeightCut(n);
832 Update();
833 }
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Slot to set the number of entries to display.
838
840{
841 if (fAvoidSignal) return;
842
843 fParallel->SetCurrentN((Long64_t)fNentries->GetNumber());
844 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(),fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
845 Update();
846}
847
848////////////////////////////////////////////////////////////////////////////////
849/// Slot to postpone the entries drawing.
850
852{
853 if (fAvoidSignal) return;
854
856 Update();
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Slot to set the line color of selection.
861
863{
864 if (fAvoidSignal) return;
865
866 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
867 if (sel) sel->SetLineColor(TColor::GetColor(a));
868 fSelectionSelect->GetSelectedEntry()->SetBackgroundColor(a);
869 Update();
870}
871
872////////////////////////////////////////////////////////////////////////////////
873/// Slot to set the line width of selection.
874
876{
877 if (fAvoidSignal) return;
878
879 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
880 if (sel) {
881 sel->SetLineWidth(wid);
882 Update();
883 }
884}
885
886////////////////////////////////////////////////////////////////////////////////
887/// Slot to set the selection being edited.
888
890{
891 if (fAvoidSignal) return;
892
893 if (!fParallel->SetCurrentSelection(title)) return;
894
895 Color_t c = fParallel->GetCurrentSelection()->GetLineColor();
897 fSelectLineColor->SetColor(p,false);
898
899 fSelectLineWidth->Select(fParallel->GetCurrentSelection()->GetLineWidth(),false);
900
901 fActivateSelection->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kActivated));
902 fShowRanges->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kShowRanges));
903}
904
905////////////////////////////////////////////////////////////////////////////////
906/// Slot to show or not the ranges on the pad.
907
909{
910 if (fAvoidSignal) return;
911
912 TParallelCoordSelect *select = fParallel->GetCurrentSelection();
913 if (select) {
914 select->SetShowRanges(s);
915 Update();
916 }
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Slot to reset the tree entry list to the original one.
921
923{
924 if (fAvoidSignal) return;
925
926 fParallel->ResetTree();
927 Update();
929}
930
931////////////////////////////////////////////////////////////////////////////////
932/// Slot to select a variable.
933
935{
936}
937
938////////////////////////////////////////////////////////////////////////////////
939/// Slot to update the weight cut.
940
942{
943 if (fAvoidSignal) return;
944
945 Int_t n = (Int_t)fWeightCutField->GetNumber();
946 fParallel->SetWeightCut(n);
947 Update();
948}
949
950////////////////////////////////////////////////////////////////////////////////
951/// Pick up the used parallel coordinates plot attributes.
952
954{
955 if (!obj) return;
956 fParallel = dynamic_cast<TParallelCoord*>(obj);
957 if (!fParallel) return;
958 fAvoidSignal = true;
959
960 Color_t c = fParallel->GetLineColor();
962 fGlobalLineColor->SetColor(p);
963
964 fGlobalLineWidth->Select(fParallel->GetLineWidth());
965
967
968 if (!TCanvas::SupportAlpha()) {
969 fDotsSpacing->SetPosition(fParallel->GetDotsSpacing());
970 fDotsSpacingField->SetNumber(fParallel->GetDotsSpacing());
971 }
972 else {
973 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
974 fAlpha->SetPosition((Int_t)color->GetAlpha()*1000);
975 fAlphaField->SetNumber(color->GetAlpha());
976 }
977 }
978
979 bool cur = fParallel->GetCurveDisplay();
980 if (cur) fLineTypeBgroup->SetButton(kLineTypeCurves,true);
981 else fLineTypeBgroup->SetButton(kLineTypePoly,true);
982
983 if (fInit) fHideAllRanges->SetOn(false);
984
987
988 if (fInit) fEntriesToDraw->SetRange(0LL,fParallel->GetNentries());
989 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(), fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
990
991 fFirstEntry->SetNumber(fParallel->GetCurrentFirst());
992 fNentries->SetNumber(fParallel->GetCurrentN());
993
994 fDelayDrawing->SetOn(fDelay);
995
996 fWeightCut->SetRange(0,(Int_t)(fParallel->GetNentries()/10)); // Maybe search here for better boundaries.
997 fWeightCut->SetPosition(fParallel->GetWeightCut());
998 fWeightCutField->SetNumber(fParallel->GetWeightCut());
999
1000 fHistColorSelect->SetColor(TColor::Number2Pixel(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillColor()), false);
1001 fHistPatternSelect->SetPattern(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillStyle(),false);
1002
1004
1005 fAvoidSignal = false;
1006}
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
short Style_t
Definition RtypesCore.h:89
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:92
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
long long Long64_t
Definition RtypesCore.h:80
#define ClassImp(name)
Definition Rtypes.h:377
@ kButtonDown
Definition TGButton.h:54
@ kDoubleScaleNo
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kScaleNo
Definition TGSlider.h:34
@ kSlider2
Definition TGSlider.h:31
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Int_t i
int nentries
@ kLineTypeCurves
@ kAddSelectionEntry
@ kSelectLineWidth
@ kDotsSpacingField
@ kHistColorSelect
@ kDeleteSelection
@ kHistPatternSelect
@ kSelectLineColor
@ kGlobalLineColor
@ kSelectionSelect
@ kActivateSelection
@ kLineTypeBgroup
@ kGlobalLineWidth
#define gROOT
Definition TROOT.h:414
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:39
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition TCanvas.cxx:2463
The color creation and management class.
Definition TColor.h:21
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2320
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1839
Organizes TGButton widgets in a group.
Selects different options.
Definition TGButton.h:264
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
TGCompositeFrame(const TGCompositeFrame &)=delete
Dragging the slider will generate the event:
Concrete class for horizontal slider.
Definition TGSlider.h:119
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
Basic listbox entries.
Definition TGListBox.h:24
void SetBackgroundColor(Pixel_t col) override
Set background color (override from TGWindow base class).
Definition TGListBox.h:42
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGLineWidthComboBox user callable and it creates a combobox for selecting the line width.
Definition TGComboBox.h:158
@ kNEANonNegative
Non-negative number.
@ kNESReal
Real number.
@ kNESInteger
Style of number entry field.
Selects different options.
Definition TGButton.h:321
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
Text string listbox entries.
Definition TGListBox.h:48
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Int_t fPriority
location in GedEditor
Definition TGedFrame.h:53
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
is a button with pattern area with a little down arrow.
A doubly linked list.
Definition TList.h:38
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:196
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
This is the TParallelCoord editor.
virtual void DoSelectLineColor(Pixel_t)
Slot to set the line color of selection.
~TParallelCoordEditor() override
Destructor.
virtual void DoHistShowBoxes(bool)
Slot to set histogram height.
TGDoubleHSlider * fEntriesToDraw
virtual void DoLiveEntriesToDraw()
Slot to update the entries fields from the slider position.
TGCheckButton * fHideAllRanges
virtual void DoDotsSpacing()
Slot to set the line dot spacing.
virtual void DoAlpha()
Slot to set the alpha value.
virtual void DoApplySelect()
Slot to apply a selection to the tree.
virtual void ConnectSignals2Slots()
Connect signals to slots.
virtual void DoFirstEntry()
Slot to set the first entry.
virtual void DoLiveDotsSpacing(Int_t a)
Slot to set the dots spacing online.
TGTextButton * fDeleteSelection
TGLineWidthComboBox * fSelectLineWidth
virtual void DoLiveWeightCut(Int_t n)
Slot to update the weight cut entry field from the slider position.
TGCheckButton * fActivateSelection
TGedPatternSelect * fHistPatternSelect
virtual void DoDotsSpacingField()
Slot to set the line dot spacing from the entry field.
TGLineWidthComboBox * fGlobalLineWidth
virtual void DoPaintEntries(bool)
Slot to postpone the entries drawing.
void CleanUpSelections()
Clean up the selection combo box.
virtual void DoActivateSelection(bool)
Slot to activate or not a selection.
virtual void DoGlobalLineColor(Pixel_t)
Slot to set the global line color.
TGNumberEntryField * fFirstEntry
virtual void DoLiveAlpha(Int_t a)
Slot to set alpha value online.
virtual void DoDeleteVar()
Slot to delete a variable().
TGNumberEntryField * fDotsSpacingField
virtual void DoSelectionSelect(const char *title)
Slot to set the selection being edited.
TGCompositeFrame * fVarTab
virtual void DoHistColorSelect(Pixel_t)
Slot to set the histograms color.
virtual void DoGlobalLineWidth(Int_t)
Slot to set the global line width.
virtual void DoHistWidth()
Slot to set histogram width.
TGCheckButton * fHistShowBoxes
void SetModel(TObject *obj) override
Pick up the used parallel coordinates plot attributes.
virtual void DoUnApply()
Slot to reset the tree entry list to the original one.
virtual void DoAddVariable()
Slot to add a variable.
TGCheckButton * fPaintEntries
virtual void DoDelayDrawing(bool)
Slot to delay the drawing.
virtual void DoHistPatternSelect(Style_t)
Slot to set the histograms fill style.
TGColorSelect * fSelectLineColor
void MakeVariablesTab()
Make the "variable" tab.
virtual void DoAddSelection()
Slot to add a selection.
TGCheckButton * fDelayDrawing
virtual void DoAlphaField()
Slot to set the alpha value from the entry field.
TGNumberEntryField * fHistWidth
TParallelCoordEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Normal constructor.
virtual void DoSelectLineWidth(Int_t)
Slot to set the line width of selection.
virtual void DoEntriesToDraw()
Slot to select the entries to be drawn.
TGColorSelect * fHistColorSelect
TGRadioButton * fLineTypePoly
virtual void DoHideAllRanges(bool)
Slot to hide all the ranges.
virtual void DoLineType()
Slot to set the line type.
TGColorSelect * fGlobalLineColor
TGNumberEntryField * fAlphaField
void CleanUpVariables()
Clean up the variables combo box.
TGNumberEntryField * fWeightCutField
TGRadioButton * fLineTypeCurves
virtual void DoWeightCut()
Slot to update the weight cut.
virtual void DoNentries()
Slot to set the number of entries to display.
TGNumberEntryField * fNentries
TGButtonGroup * fLineTypeBgroup
virtual void DoShowRanges(bool s)
Slot to show or not the ranges on the pad.
virtual void DoHistBinning()
Slot to set the axes histogram binning.
virtual void DoDeleteSelection()
Slot to delete a selection.
TGNumberEntryField * fHistBinning
virtual void DoVariableSelect(const char *var)
Slot to select a variable.
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord.
void SetShowRanges(bool s)
Show the ranges needles.
TParallelCoord axes.
Int_t GetHistBinning() const
Parallel Coordinates class.
@ kPaintEntries
To paint all TParallelCoord entries.
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
TString & Append(const char *cs)
Definition TString.h:572
const Int_t n
Definition legend1.C:16
TF1 * f1
Definition legend1.C:11