diff --git a/config/xsd/request/histoPlot.xsd b/config/xsd/request/histoPlot.xsd
index eec547c..5a0ebf1 100644
--- a/config/xsd/request/histoPlot.xsd
+++ b/config/xsd/request/histoPlot.xsd
@@ -30,22 +30,22 @@
-
- define drawing properties for 1D histogram.
+ define drawing properties for 2D histogram.
To be filled.
-
- define drawing properties for 2D histogram.
+ define drawing properties for 1D histogram.
To be filled.
diff --git a/src/ParamOutputImpl/Plot/AxisLegendManager.cc b/src/ParamOutputImpl/Plot/AxisLegendManager.cc
index 87d8137..f1c9792 100644
--- a/src/ParamOutputImpl/Plot/AxisLegendManager.cc
+++ b/src/ParamOutputImpl/Plot/AxisLegendManager.cc
@@ -128,7 +128,7 @@ namespace plot
PanelPlotOutput *plot)
{
SeriesProperties lSeriesProperties;
-
+ std::string yAxisTextLegend;
// Compute nb series to draw by y axis
std::map nbSeriesByYAxisMap = plot->getNbSeriesByYAxis();
@@ -153,16 +153,22 @@ namespace plot
continue;
}
if(pHistogramProperties->getHistogramType() == "histogram1d"){
- std::string yAxisTextLegend;
- yAxisTextLegend = pHistogramProperties->getHistotypeProperties().getHisto1DFunction()->getTextLegend();
- Label yLabel(lYAxis->_legend.getFont(),lYAxis->_color);
- yLabel._text = yAxisTextLegend;
- lYAxis->_legend.setLabel(yLabel);
+ AMDA::Common::ParameterIndexComponent yIndexComp = pHistogramProperties->getHistotypeProperties().getIndex();
+ std::string yParamId = pHistogramProperties->getHistotypeProperties().getParamId();
+ yAxisTextLegend = yAxisTextLegend = pHistogramProperties->getHistotypeProperties().getHisto1DFunction()->getTextLegend();
+ if(pHistogramProperties->getHistotypeProperties().getParamId().empty())
+ {
+ Label yLabel(lYAxis->_legend.getFont(),lYAxis->_color);
+ yLabel._text = yAxisTextLegend;
+ lYAxis->_legend.setLabel(yLabel);
+ continue;
+ }
+ Color compLegendColor = lYAxis->_color;
+ if(param.getHistogramSeriesPropertiesList().size() > 0)
+ compLegendColor = pHistogramProperties->getColor();
+ ParameterIndexComponentColor yIndex = ParameterIndexComponentColor(yIndexComp, compLegendColor);
+ pushComponentInList(yParamId, yIndex, axesParamsComponents[yAxisId]);
}
-
- Color compLegendColor = lYAxis->_color;
- ParameterIndexComponentColor yIndex = ParameterIndexComponentColor(pHistogramProperties->getIndex(), compLegendColor);
- pushComponentInList(pHistogramProperties->getParamId(), yIndex, axesParamsComponents[yAxisId]);
}
}
for (auto lSeriesProperties : param.getYSeriePropertiesList())
@@ -200,7 +206,7 @@ namespace plot
for (auto axisParamsComponents : axesParamsComponents)
{
boost::shared_ptr lYAxis = plot->_panel->getAxis(axisParamsComponents.first);
- setAxisLegendForSeries(plot, lYAxis, axisParamsComponents.second);
+ setAxisLegendForSeries(plot, lYAxis, axisParamsComponents.second,yAxisTextLegend);
}
}
diff --git a/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc b/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc
index b9d9613..51953ad 100644
--- a/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc
+++ b/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc
@@ -14,7 +14,7 @@ namespace plot {
// Basically transforms the data to a matrix by keeping all the values needed later
-std::map> Histo1DFunction::getGridValues(double* xData, int nbData, Range xRange, double xBinSize)
+std::map> Histo1DFunction::getGridValues(double* xData,double* yData, int nbData, Range xRange, double xBinSize)
{
std::map> allValues;
double xMin = xRange.getMin();
@@ -26,14 +26,14 @@ std::map> Histo1DFunction::getGridValues(double* xData,
continue;
int xIndex = (xData[i]- xMin)/xBinSize;
-
- allValues[xIndex].push_back(xData[i]);
+ if(!std::isnan(yData[i]))
+ allValues[xIndex].push_back(yData[i]);
}
return allValues;
}
// Density function for 1DHistogram
-void Density1DFunction::apply(std::vector> &grid, double* xData, int nbData, Range xRange,
+void Density1DFunction::apply(std::vector> &grid, double* xData, double* /*yData*/, int nbData, Range xRange,
double& xBinSize, bool yIsLog, double& yMin, double& yMax)
{
bool yMaxToModify=true;
@@ -49,7 +49,7 @@ void Density1DFunction::apply(std::vector> &grid, doub
yMaxToModify = false;
std::map> allValues;
- allValues = getGridValues(xData,nbData,xRange,xBinSize);
+ allValues = getGridValues(xData,xData,nbData,xRange,xBinSize);
for (unsigned int i(0); i < allValues.size(); ++i){
if (allValues[i].size() > 0)
@@ -65,7 +65,7 @@ void Density1DFunction::apply(std::vector> &grid, doub
// NormDensity1DFunction function for 1DHistogram
-void NormDensity1DFunction::apply(std::vector> &grid, double* xData, int nbData, Range xRange,
+void NormDensity1DFunction::apply(std::vector> &grid, double* xData, double* /*yData*/, int nbData, Range xRange,
double& xBinSize, bool yIsLog, double& yMin, double& yMax)
{
@@ -82,7 +82,7 @@ void NormDensity1DFunction::apply(std::vector> &grid,
yMaxToModify = false;
std::map> allValues;
- allValues = getGridValues(xData,nbData,xRange,xBinSize);
+ allValues = getGridValues(xData,xData,nbData,xRange,xBinSize);
int nbRecord = 0;
for(unsigned int i(0); i < allValues.size();++i){
@@ -103,5 +103,246 @@ void NormDensity1DFunction::apply(std::vector> &grid,
yMin = allValues[i].size()/(double)nbRecord;
}
}
+
+ grid = _cacheGrid;
+}
+
+void Mean1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+
+ if (allValues[i].size() > 0){
+ double mean = Histo1DFunction::mean(allValues[i]);
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(mean) : mean));
+
+ if(yMaxToModify){
+ if(yMax < mean)
+ yMax =mean;
+ if(yMin > mean)
+ yMin = mean;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+
+ grid = _cacheGrid;
+
+}
+
+void Min1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+
+ if (allValues[i].size() > 0){
+ double min = Histo1DFunction::min(allValues[i]);
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(min) : min));
+
+ if(yMaxToModify){
+ if(yMax < min)
+ yMax =min;
+ if(yMin > min)
+ yMin = min;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+ grid = _cacheGrid;
+}
+
+void Max1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+
+ if (allValues[i].size() > 0){
+ double max = Histo1DFunction::max(allValues[i]);
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(max) : max));
+
+ if(yMaxToModify){
+ if(yMax < max)
+ yMax =max;
+ if(yMin > max)
+ yMin = max;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+ grid = _cacheGrid;
+}
+
+void Median1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+ if (allValues[i].size() > 0){
+ double median = Histo1DFunction::median(allValues[i]);
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(median) : median));
+
+ if(yMaxToModify){
+ if(yMax < median)
+ yMax = median;
+ if(yMin > median)
+ yMin = median;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+ grid = _cacheGrid;
+}
+
+void StandardDeviation1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+ if (allValues[i].size() > 0){
+ double mean = Histo1DFunction::mean(allValues[i]);
+ double stddev = Histo1DFunction::standardDeviation(allValues[i], mean);
+
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(stddev) : stddev));
+
+ if(yMaxToModify){
+ if(yMax < stddev)
+ yMax = stddev;
+ if(yMin > stddev)
+ yMin = stddev;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+ grid = _cacheGrid;
}
+
+void Kurtosis1DFunction::apply(std::vector> &grid, double* xData, double* yData, int nbData, Range xRange,
+ double& xBinSize, bool yIsLog, double& yMin, double& yMax)
+{
+ bool yMaxToModify=true;
+ if(!_cacheGrid.empty()){
+ grid = _cacheGrid;
+ return;
+ }
+ if(std::isnan(yMin))
+ yMin = (yIsLog) ? 1 : 0;
+ if(std::isnan(yMax))
+ yMax = 0;
+ else
+ yMaxToModify = false;
+ std::map> allValues;
+ allValues = getGridValues(xData,yData,nbData,xRange,xBinSize);
+
+ for (unsigned int i(0); i < allValues.size(); ++i){
+ unsigned int n = allValues[i].size();
+ if (n >= 4){
+ double mean = Histo1DFunction::mean(allValues[i]);
+ double stddev = Histo1DFunction::standardDeviation(allValues[i], mean);
+ double sum = 0.0;
+ for (const auto& value : allValues[i]) {
+ sum += std::pow((value - mean) / stddev, 4);
+ }
+ double kurtosis = (n * (n + 1.0) / ((n - 1.0) * (n - 2.0) * (n - 3.0))) * sum
+ - (3.0 * std::pow(n - 1.0, 2) / ((n - 2.0) * (n - 3.0)));
+
+ _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
+ (yIsLog)? log10(kurtosis)
+ : kurtosis));
+ if(yMaxToModify){
+ if(yMax < kurtosis)
+ yMax = kurtosis;
+ if(yMin > kurtosis)
+ yMin = kurtosis;
+ }
+ if(yIsLog){
+ yMin = log10(yMin);
+ }
+ }
+ }
+ grid = _cacheGrid;
+}
+
} /* namespace plot */
diff --git a/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.hh b/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.hh
index abddf4e..4a746e0 100644
--- a/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.hh
+++ b/src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.hh
@@ -11,6 +11,7 @@
#include
#include