Commit 765e29e35d6d7756c9bad8659c755253fae04ecc
Exists in
master
and in
11 other branches
Merge branch 'FER_7857' into amdadev
Showing
3 changed files
with
28 additions
and
15 deletions
Show diff stats
src/ParamOutputImpl/Plot/AxisLegendManager.cc
... | ... | @@ -13,7 +13,8 @@ namespace plot |
13 | 13 | { |
14 | 14 | // Build list of all indexes used by each parameters for each x axes |
15 | 15 | std::map<std::string, AxisParamsComponents> axesParamsComponents; |
16 | - | |
16 | + // Keep an order of the legends | |
17 | + std::vector<std::string> insertionOrder; | |
17 | 18 | // Compute nb series to draw by y axis |
18 | 19 | std::map<std::string, int> nbSeriesByYAxisMap = plot->getNbSeriesByYAxis(); |
19 | 20 | |
... | ... | @@ -53,6 +54,7 @@ namespace plot |
53 | 54 | compLegendColor = pHistogramProperties->getColor(); |
54 | 55 | ParameterIndexComponentColor xIndex = ParameterIndexComponentColor(xIndexComp, compLegendColor); |
55 | 56 | pushComponentInList(xParamId, xIndex, axesParamsComponents[xAxisId]); |
57 | + insertionOrder.push_back(xParamId); | |
56 | 58 | } |
57 | 59 | } |
58 | 60 | |
... | ... | @@ -83,6 +85,7 @@ namespace plot |
83 | 85 | |
84 | 86 | ParameterIndexComponentColor xIndex = ParameterIndexComponentColor(xSerie.getIndex(), compLegendColor); |
85 | 87 | pushComponentInList(xSerie.getParamId(), xIndex, axesParamsComponents[xAxisId]); |
88 | + insertionOrder.push_back(xSerie.getParamId()); | |
86 | 89 | } |
87 | 90 | } |
88 | 91 | |
... | ... | @@ -95,7 +98,7 @@ namespace plot |
95 | 98 | for (auto axisParamsComponents : axesParamsComponents) |
96 | 99 | { |
97 | 100 | boost::shared_ptr<Axis> lXAxis = plot->_panel->getAxis(axisParamsComponents.first); |
98 | - setAxisLegendForSeries(plot, lXAxis, axisParamsComponents.second); | |
101 | + setAxisLegendForSeries(plot, lXAxis, axisParamsComponents.second, insertionOrder); | |
99 | 102 | } |
100 | 103 | } |
101 | 104 | |
... | ... | @@ -136,6 +139,9 @@ namespace plot |
136 | 139 | std::map<std::string, AxisParamsComponents> axesParamsComponents; |
137 | 140 | std::map<std::string, AxisParamsComponents> axesHistoParamsComponents; |
138 | 141 | std::map<std::string,std::string> yAxisTextLegendHisto; |
142 | + | |
143 | + // Keeping the order of the legends | |
144 | + std::vector<std::string> insertionOrder; | |
139 | 145 | if (!plot->_panel->_page->_superposeMode) |
140 | 146 | { |
141 | 147 | plot->resetAutomaticSerieColorCursor(); |
... | ... | @@ -179,6 +185,7 @@ namespace plot |
179 | 185 | compLegendColor = pHistogramProperties->getColor(); |
180 | 186 | ParameterIndexComponentColor yIndex = ParameterIndexComponentColor(yIndexComp, compLegendColor); |
181 | 187 | pushComponentInList(yParamId, yIndex, axesHistoParamsComponents[yAxisId]); |
188 | + insertionOrder.push_back(yParamId); | |
182 | 189 | } |
183 | 190 | } |
184 | 191 | for (auto lSeriesProperties : param.getYSeriePropertiesList()) |
... | ... | @@ -204,6 +211,7 @@ namespace plot |
204 | 211 | } |
205 | 212 | ParameterIndexComponentColor yIndex = ParameterIndexComponentColor(index, compLegendColor); |
206 | 213 | pushComponentInList(lSeriesProperties.getParamId(), yIndex, axesParamsComponents[yAxisId]); |
214 | + insertionOrder.push_back(lSeriesProperties.getParamId()); | |
207 | 215 | } |
208 | 216 | } |
209 | 217 | } |
... | ... | @@ -216,12 +224,12 @@ namespace plot |
216 | 224 | for (auto axisParamsComponents : axesParamsComponents) |
217 | 225 | { |
218 | 226 | boost::shared_ptr<Axis> lYAxis = plot->_panel->getAxis(axisParamsComponents.first); |
219 | - setAxisLegendForSeries(plot, lYAxis, axisParamsComponents.second,yAxisTextLegend); | |
227 | + setAxisLegendForSeries(plot, lYAxis, axisParamsComponents.second,insertionOrder, yAxisTextLegend); | |
220 | 228 | } |
221 | 229 | for (auto axisHistoParamsComponents : axesHistoParamsComponents) |
222 | 230 | { |
223 | 231 | boost::shared_ptr<Axis> lYAxis = plot->_panel->getAxis(axisHistoParamsComponents.first); |
224 | - setAxisLegendForSeries(plot, lYAxis, axisHistoParamsComponents.second, yAxisTextLegendHisto[axisHistoParamsComponents.first] ); | |
232 | + setAxisLegendForSeries(plot, lYAxis, axisHistoParamsComponents.second, insertionOrder, yAxisTextLegendHisto[axisHistoParamsComponents.first] ); | |
225 | 233 | |
226 | 234 | } |
227 | 235 | } |
... | ... | @@ -241,6 +249,7 @@ namespace plot |
241 | 249 | |
242 | 250 | // Build list of all indexes used by each parameters for each y axes |
243 | 251 | AxisParamsComponents axisParamsComponents; |
252 | + std::vector<std::string> insertionOrder; | |
244 | 253 | for (auto param : plot->_parameterAxesList) |
245 | 254 | { |
246 | 255 | for (auto pHistogramProperties : param.getHistogramSeriesPropertiesList()) |
... | ... | @@ -265,6 +274,7 @@ namespace plot |
265 | 274 | if (pHistogramProperties->getHistotypeProperties().getIndex() > -1) |
266 | 275 | colorSerieIndex = ParameterIndexComponentColor(pHistogramProperties->getHistotypeProperties().getIndex(), -1, lZAxis->_color); |
267 | 276 | pushComponentInList(pHistogramProperties->getHistotypeProperties().getParamId(), colorSerieIndex, axisParamsComponents); |
277 | + insertionOrder.push_back(pHistogramProperties->getHistotypeProperties().getParamId()); | |
268 | 278 | } |
269 | 279 | } |
270 | 280 | for (auto lSeriesProperties : param.getYSeriePropertiesList()) |
... | ... | @@ -289,10 +299,11 @@ namespace plot |
289 | 299 | if (lColorSerieProperties.getIndex() > -1) |
290 | 300 | colorSerieIndex = ParameterIndexComponentColor(lColorSerieProperties.getIndex(), -1, lZAxis->_color); |
291 | 301 | pushComponentInList(lColorSerieProperties.getColorParamIds()[yParamId], colorSerieIndex, axisParamsComponents); |
302 | + insertionOrder.push_back(lColorSerieProperties.getColorParamIds()[yParamId]); | |
292 | 303 | } |
293 | 304 | } |
294 | 305 | |
295 | - setAxisLegendForSeries(plot, lZAxis, axisParamsComponents, zAxisTextLegend); | |
306 | + setAxisLegendForSeries(plot, lZAxis, axisParamsComponents, insertionOrder,zAxisTextLegend); | |
296 | 307 | } |
297 | 308 | |
298 | 309 | void AxisLegendManager::configureColorAxisLegendForSpectro( |
... | ... | @@ -364,7 +375,7 @@ namespace plot |
364 | 375 | } |
365 | 376 | |
366 | 377 | void AxisLegendManager::setAxisLegendForSeries(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, AxisParamsComponents &axisParamsComponents, |
367 | - std::string legendPrefix) | |
378 | + std::vector<std::string> insertionOrder, std::string legendPrefix) | |
368 | 379 | { |
369 | 380 | if (pAxis == nullptr || !pAxis->_legend.isEmpty()) |
370 | 381 | { |
... | ... | @@ -374,21 +385,21 @@ namespace plot |
374 | 385 | // Retrieve ParamInfo Manager |
375 | 386 | ParamMgr *piMgr = ParamMgr::getInstance(); |
376 | 387 | |
377 | - for (auto paramsComponents : axisParamsComponents) | |
388 | + for (auto paramsComponents : insertionOrder) | |
378 | 389 | { |
379 | - ParameterSPtr p = plot->_parameterManager.getParameter(paramsComponents.first); | |
390 | + ParameterSPtr p = plot->_parameterManager.getParameter(paramsComponents); | |
380 | 391 | if (p == nullptr) |
381 | 392 | continue; |
382 | 393 | ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(p->getInfoId()); |
383 | - if (paramsComponents.second.size() == p->getDataWriterTemplate()->getParamData()->getDim1() * p->getDataWriterTemplate()->getParamData()->getDim2()) | |
394 | + if (axisParamsComponents[paramsComponents].size() == p->getDataWriterTemplate()->getParamData()->getDim1() * p->getDataWriterTemplate()->getParamData()->getDim2()) | |
384 | 395 | { |
385 | 396 | // All components of this parameter are used by this axis => merge |
386 | - Color color = paramsComponents.second.front().getColor(); | |
387 | - paramsComponents.second.clear(); | |
388 | - paramsComponents.second.push_back(ParameterIndexComponentColor(-1, -1, color)); | |
397 | + Color color = axisParamsComponents[paramsComponents].front().getColor(); | |
398 | + axisParamsComponents[paramsComponents].clear(); | |
399 | + axisParamsComponents[paramsComponents].push_back(ParameterIndexComponentColor(-1, -1, color)); | |
389 | 400 | } |
390 | 401 | bool isFirstComponent = true; |
391 | - for (auto components : paramsComponents.second) | |
402 | + for (auto components : axisParamsComponents[paramsComponents]) | |
392 | 403 | { |
393 | 404 | if (paramInfo == nullptr) |
394 | 405 | continue; | ... | ... |
src/ParamOutputImpl/Plot/AxisLegendManager.hh
... | ... | @@ -75,7 +75,7 @@ namespace plot |
75 | 75 | |
76 | 76 | static void configureXAxisLegendForSeries(PanelPlotOutput *plot); |
77 | 77 | |
78 | - static void setAxisLegendForSeries(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, AxisParamsComponents &axisParamsComponents, std::string legendPrefix=""); | |
78 | + static void setAxisLegendForSeries(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, AxisParamsComponents &axisParamsComponents, std::vector<std::string> insertionOrder, std::string legendPrefix=""); | |
79 | 79 | |
80 | 80 | static void setAxisLegendForSpectro(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, std::string originalParamId); |
81 | 81 | ... | ... |
src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc
... | ... | @@ -968,8 +968,10 @@ void InstantPlot::configureDataAxisLegend(boost::shared_ptr<Axis> axisSPtr, bool |
968 | 968 | else |
969 | 969 | { |
970 | 970 | AxisLegendManager::AxisParamsComponents axisParamsComponents; |
971 | + std::vector<std::string> insertionOrder; | |
971 | 972 | axisParamsComponents[_originalParamId].push_back(ParameterIndexComponentColor(-1,-1, axisSPtr->_color)); |
972 | - AxisLegendManager::setAxisLegendForSeries(this, axisSPtr, axisParamsComponents); | |
973 | + insertionOrder.push_back(_originalParamId); | |
974 | + AxisLegendManager::setAxisLegendForSeries(this, axisSPtr, axisParamsComponents, insertionOrder); | |
973 | 975 | } |
974 | 976 | } |
975 | 977 | ... | ... |