From 505546bc7026466fbeed92d6cf23dfa73e8ef3d1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 17 May 2019 10:06:51 +0200 Subject: [PATCH] Tickplot: components and units in legend --- src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc b/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc index e41a358..a54ef92 100644 --- a/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc +++ b/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc @@ -22,6 +22,7 @@ #include "Time/TimePlot.hh" #include "TickPlot.hh" #include "PlPlotUtil.hh" +#include "ParamMgr.hh" using boost::tuples::get; @@ -350,15 +351,41 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA for (auto index : lSeriesProperties.getIndexList(_pParameterValues)) { boost::shared_ptr pSerie = boost::shared_ptr(new SeriesInfo()); + + AMDA::Info::ParamMgr* piMgr = AMDA::Info::ParamMgr::getInstance(); + AMDA::Info::ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(lSeriesProperties.getParamId()); + std::ostringstream osstr; - osstr << name; - // display index only if non scalar - if(index.getDim1Index() != -1){ - osstr << "[" << index.getDim1Index() ; - if (index.getDim2Index() != -1) - osstr << "," << index.getDim2Index(); - osstr << "]"; + bool skipIndex = false; + if (paramInfo == nullptr) { + osstr << name; + } + else { + if (paramInfo->getComponents(index).empty() == false) { + osstr << paramInfo->getComponents(index); + skipIndex = true; + } + else { + osstr << paramInfo->getShortName(); + } + } + + if (!skipIndex) { + if(index.getDim1Index() != -1){ + osstr << "[" << index.getDim1Index() ; + if (index.getDim2Index() != -1) + osstr << "," << index.getDim2Index(); + osstr << "]"; + } + else if (index.getDim2Index() != -1) { + osstr << "[" << index.getDim2Index() << "]"; + } + } + + if ((paramInfo != nullptr) && (paramInfo->getUnits().empty() == false)) { + osstr << ", " << paramInfo->getUnits(); } + pSerie->_name = osstr.str(); if (pSerie->_name.size() > maxNameLen) { maxNameLen = pSerie->_name.size(); -- libgit2 0.21.2