Commit 505546bc7026466fbeed92d6cf23dfa73e8ef3d1
1 parent
af253df2
Exists in
master
and in
88 other branches
Tickplot: components and units in legend
Showing
1 changed file
with
34 additions
and
7 deletions
Show diff stats
src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | #include "Time/TimePlot.hh" |
23 | 23 | #include "TickPlot.hh" |
24 | 24 | #include "PlPlotUtil.hh" |
25 | +#include "ParamMgr.hh" | |
25 | 26 | |
26 | 27 | using boost::tuples::get; |
27 | 28 | |
... | ... | @@ -350,15 +351,41 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA |
350 | 351 | for (auto index : lSeriesProperties.getIndexList(_pParameterValues)) { |
351 | 352 | boost::shared_ptr<SeriesInfo> pSerie = |
352 | 353 | boost::shared_ptr<SeriesInfo>(new SeriesInfo()); |
354 | + | |
355 | + AMDA::Info::ParamMgr* piMgr = AMDA::Info::ParamMgr::getInstance(); | |
356 | + AMDA::Info::ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(lSeriesProperties.getParamId()); | |
357 | + | |
353 | 358 | std::ostringstream osstr; |
354 | - osstr << name; | |
355 | - // display index only if non scalar | |
356 | - if(index.getDim1Index() != -1){ | |
357 | - osstr << "[" << index.getDim1Index() ; | |
358 | - if (index.getDim2Index() != -1) | |
359 | - osstr << "," << index.getDim2Index(); | |
360 | - osstr << "]"; | |
359 | + bool skipIndex = false; | |
360 | + if (paramInfo == nullptr) { | |
361 | + osstr << name; | |
362 | + } | |
363 | + else { | |
364 | + if (paramInfo->getComponents(index).empty() == false) { | |
365 | + osstr << paramInfo->getComponents(index); | |
366 | + skipIndex = true; | |
367 | + } | |
368 | + else { | |
369 | + osstr << paramInfo->getShortName(); | |
370 | + } | |
371 | + } | |
372 | + | |
373 | + if (!skipIndex) { | |
374 | + if(index.getDim1Index() != -1){ | |
375 | + osstr << "[" << index.getDim1Index() ; | |
376 | + if (index.getDim2Index() != -1) | |
377 | + osstr << "," << index.getDim2Index(); | |
378 | + osstr << "]"; | |
379 | + } | |
380 | + else if (index.getDim2Index() != -1) { | |
381 | + osstr << "[" << index.getDim2Index() << "]"; | |
382 | + } | |
383 | + } | |
384 | + | |
385 | + if ((paramInfo != nullptr) && (paramInfo->getUnits().empty() == false)) { | |
386 | + osstr << ", " << paramInfo->getUnits(); | |
361 | 387 | } |
388 | + | |
362 | 389 | pSerie->_name = osstr.str(); |
363 | 390 | if (pSerie->_name.size() > maxNameLen) { |
364 | 391 | maxNameLen = pSerie->_name.size(); | ... | ... |