Commit 21ddb9f281fc0c9b36c718177453ff7e62cbb07b
1 parent
19cbe5ae
Exists in
master
and in
94 other branches
Set legend color for x axis
Showing
1 changed file
with
15 additions
and
1 deletions
Show diff stats
src/ParamOutputImpl/Plot/AxisLegendManager.cc
... | ... | @@ -11,12 +11,17 @@ void AxisLegendManager::configureXAxisLegendForSeries( |
11 | 11 | // Build list of all indexes used by each parameters for each x axes |
12 | 12 | std::map<std::string, AxisParamsComponents> axesParamsComponents; |
13 | 13 | |
14 | + // Compute nb series to draw by y axis | |
15 | + std::map<std::string,int> nbSeriesByYAxisMap = plot->getNbSeriesByYAxis(); | |
16 | + | |
14 | 17 | SeriesProperties lSeriesProperties; |
15 | 18 | for (auto param: plot->_parameterAxesList) { |
16 | 19 | for(auto lSeriesProperties : param.getYSeriePropertiesList()) { |
17 | 20 | if(!lSeriesProperties.hasYAxis() || !lSeriesProperties.hasXAxis()) |
18 | 21 | continue; |
19 | 22 | |
23 | + bool moreThanOneSerieForAxis = (nbSeriesByYAxisMap[lSeriesProperties.getYAxisId()] > 1); | |
24 | + | |
20 | 25 | ParameterAxes* xParameter = plot->getParameterAxesByXSerieId(lSeriesProperties.getXId()); |
21 | 26 | |
22 | 27 | XSeriesProperties xSerie = xParameter->getXSeriePropertiesById(lSeriesProperties.getXId()); |
... | ... | @@ -28,11 +33,20 @@ void AxisLegendManager::configureXAxisLegendForSeries( |
28 | 33 | continue; |
29 | 34 | } |
30 | 35 | |
31 | - ParameterIndexComponentColor xIndex = ParameterIndexComponentColor(xSerie.getIndex(), lXAxis->_color); | |
36 | + Color compLegendColor = lXAxis->_color; | |
37 | + if (moreThanOneSerieForAxis && (lSeriesProperties.getColorSerieId() == -1) && (!plot->_panel->_page->_superposeMode)) { | |
38 | + compLegendColor = plot->getSerieLineColor(lSeriesProperties, moreThanOneSerieForAxis); | |
39 | + } | |
40 | + | |
41 | + ParameterIndexComponentColor xIndex = ParameterIndexComponentColor(xSerie.getIndex(), compLegendColor); | |
32 | 42 | pushComponentInList(xSerie.getParamId(), xIndex, axesParamsComponents[xAxisId]); |
33 | 43 | } |
34 | 44 | } |
35 | 45 | |
46 | + if (!plot->_panel->_page->_superposeMode) { | |
47 | + plot->resetAutomaticSerieColorCursor(); | |
48 | + } | |
49 | + | |
36 | 50 | std::list<std::string> legendLines; |
37 | 51 | for (auto axisParamsComponents : axesParamsComponents) { |
38 | 52 | boost::shared_ptr<Axis> lXAxis = plot->_panel->getAxis(axisParamsComponents.first); | ... | ... |