Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ConversionUtils.cxx
Go to the documentation of this file.
1/// \file
2/// \warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
3/// Feedback is welcome!
4
10
11#include <TAxis.h>
12
13namespace ROOT {
14namespace Experimental {
15namespace Hist {
16namespace Internal {
17
19{
20 if (auto *regular = src.GetRegularAxis()) {
21 dst.Set(regular->GetNNormalBins(), regular->GetLow(), regular->GetHigh());
22 } else if (auto *variable = src.GetVariableBinAxis()) {
23 dst.Set(variable->GetNNormalBins(), variable->GetBinEdges().data());
24 } else if (auto *categorical = src.GetCategoricalAxis()) {
25 const auto &categories = categorical->GetCategories();
26 dst.Set(categories.size(), 0, categories.size());
27
28 for (std::size_t i = 0; i < categories.size(); i++) {
29 dst.SetBinLabel(i + 1, categories[i].c_str());
30 }
31 } else {
32 throw std::logic_error("unimplemented axis type in ConvertAxis"); // GCOVR_EXCL_LINE
33 }
34}
35
36} // namespace Internal
37} // namespace Hist
38} // namespace Experimental
39} // namespace ROOT
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
A variant of all supported axis types.
Class to manage histogram axis.
Definition TAxis.h:32
void ConvertAxis(TAxis &dst, const RAxisVariant &src)
Convert a single axis object to TAxis.