diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index ce8233d..23f88a0 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -315,7 +315,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Plot type $this->isInstantPlot = false; $plotNode = $this->unmarshallPlotType($panelData, $panelNode); - $isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME); //Tick plot @@ -365,6 +364,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass protected function unmarshallPlotType($panelData, $panelNode) { + + + error_log($panelData->{'panel-plot-type'}); switch ($panelData->{'panel-plot-type'}) { case 'timePlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT); @@ -373,6 +375,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT); $plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'}); break; + case 'histoPlot': + $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::HISTOPLOT); + break; case 'statusPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT); switch ($panelData->{'panel-status-position'}) { @@ -629,6 +634,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $paramZInfo = NULL; $this->unmarshallHistogram2D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $paramZInfo,$axesData); break; + case 'histogram1d': + $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); + $this->unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes']); + break; case 'orbit-serie': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true); @@ -766,6 +775,42 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass } } + protected function unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes) + { + $histogram1DNodes = array(); + if ($paramData->{'param-drawing-object'}->{'histo1d-color'} == "none") { + $color = NULL; + } else { + $color = $this->hexColor2KernelColor($paramData->{'param-drawing-object'}->{'histo1d-color'}); + } + + if (count($indexes) == 0) { + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $color); + if (isset($histogram1DNode)) { + $histogram1DNode->setId($paramData->{'id'}); + $histogram1DNodes[] = $histogram1DNode; + } + } + foreach ($indexes as $index) { + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $color); + if (isset($histogram1DNode)) { + if (count($indexes) == 1) + $histogram1DNode->setId($paramData->{'id'}); + $histogram1DNodes[] = $histogram1DNode; + } + } + + foreach ($histogram1DNodes as $histogram1DNode) { + + // xBinNumber + $histogram1DNode->getBins()->addManual1DBins($paramData->{'param-drawing-object'}->{'histo1d-xbinnumber'}); + + // histotype, function + $histogram1DNode->getHistotype()->set1DFunction($paramData->{'param-drawing-object'}->{'histo1d-function'}); + + } + } + protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie) { $serieNodes = array(); diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementHistoNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementHistoNodeClass.php new file mode 100644 index 0000000..c8a2f5e --- /dev/null +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementHistoNodeClass.php @@ -0,0 +1,50 @@ +getAxes()->addDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS,REQUESTOUTPUTPLOTELEMENTHISTO_XAXISID); + //force color axis creation + $this->getAxes()->getColorAxis(); + } + + public function getXAxis() + { + return $this->getAxes()->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS,REQUESTOUTPUTPLOTELEMENTHISTO_XAXISID); + } + + public function addYAxis($id) + { + return $this->getAxes()->addDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS,$id); + } + + public function getYAxis($id) + { + return $this->getAxes()->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS,$id); + } + + public function getZAxis() + { + return $this->getAxes()->getColorAxis(); + } + + public function loadFromNode($xmlNode) + { + parent::loadFromNode($xmlNode); + } +} + +?> \ No newline at end of file diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram1DSerieNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram1DSerieNodeClass.php new file mode 100644 index 0000000..091caed --- /dev/null +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram1DSerieNodeClass.php @@ -0,0 +1,120 @@ +getFirstChildByName(REQUESTOUTPUTPLOTBINS_MANUAL); + + if (!isset($node)) + { + $node = new NodeClass(REQUESTOUTPUTPLOTBINS_MANUAL); + $this->addChild($node); + } + + $node->setAttribute(REQUESTOUTPUTPLOTBINS_XBINNUMBER, $xBinNumber); + return $node; + } + +} + +class RequestOutputPlotHistotype1DNodeClass extends NodeClass +{ + public function __construct($name) + { + parent::__construct($name); + } + + public function set1DFunction($type){ + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION, $type); + } + public function get1DFunction(){ + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION); + } +} + +class RequestOutputPlotHistogram1DSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass +{ + public function __construct($name) + { + parent::__construct($name); + } + + public function getBins() + { + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_NAME); + + if (!isset($node)) + { + $node = new RequestOutputPlotBins1DNodeClass(REQUESTOUTPUTPLOTBINS_NAME); + $this->addChild($node); + } + + return $node; + } + + public function getHistotype() + { + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOTYPE_NAME); + + if (!isset($node)) + { + $node = new RequestOutputPlotHistotype1DNodeClass(REQUESTOUTPUTPLOTHISTOTYPE_NAME); + $this->addChild($node); + } + + return $node; + } + + public function setColor($color) + { + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR, $color); + } + + public function getColor() + { + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR); + } + + public function setIndex($index) + { + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX, $index); + } + + public function getIndex() + { + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX); + } + + public function loadFromNode($xmlNode) + { + $this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX)); + parent::loadFromNode($xmlNode); + } +} + +?> diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php index 8ed62c5..d661421 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php @@ -23,6 +23,7 @@ abstract class RequestOutputPlotElementTypeEnum { const TIMEPLOT = "TimePlot"; const XYPLOT = "XYPlot"; + const HISTOPLOT = "HistoPlot"; const STATUSPLOT = "StatusPlot"; const TICKPLOT = "TickPlot"; const EPOCHPLOT = "EpochPlot"; @@ -107,6 +108,9 @@ class RequestOutputPlotPanelNodeClass extends NodeClass case RequestOutputPlotElementTypeEnum::XYPLOT: $node = new RequestOutputPlotElementXYNodeClass(); break; + case RequestOutputPlotElementTypeEnum::HISTOPLOT: + $node = new RequestOutputPlotElementHistoNodeClass(); + break; case RequestOutputPlotElementTypeEnum::STATUSPLOT: $node = new RequestOutputPlotElementStatusNodeClass($noAxes); break; diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php index 2e24b69..709d686 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php @@ -115,6 +115,18 @@ class RequestOutputPlotParamNodeClass extends NodeClass return $histogram2dNode; } + public function addHistogram1DSerie($yAxis, $index, $color) + { + $histogram1dNode = new RequestOutputPlotHistogram1DSerieNodeClass(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_NAME); + $histogram1dNode->setColor($color); + $histogram1dNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); + $histogram1dNode->setYAxisId($yAxis); + if ($index >= 0) + $histogram1dNode->setIndex($index); + $this->addChild($histogram1dNode); + return $histogram1dNode; + } + public function addOrbitSerie($yAxis, $colorSerieId = -1) { $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); -- libgit2 0.21.2