Commit f822811aa088b2f6162e0b4be1afd0fd96dfc1c8
1 parent
8ef738e8
Exists in
master
and in
63 other branches
Implements multi x parameters for scatter plot
Showing
4 changed files
with
54 additions
and
28 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -621,12 +621,18 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
621 | 621 | { |
622 | 622 | //X parameters |
623 | 623 | $isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME); |
624 | + $xIds = array(); | |
624 | 625 | if ($isScatter) |
625 | 626 | { |
627 | + $crtXId = 0; | |
626 | 628 | foreach ($paramsData as $paramData) |
627 | 629 | { |
628 | 630 | if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '') |
629 | 631 | continue; |
632 | + if (array_key_exists($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $xIds)) { | |
633 | + //x param already exists | |
634 | + continue; | |
635 | + } | |
630 | 636 | |
631 | 637 | $paramXInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $this->paramsData); |
632 | 638 | if ($paramXInfo['id'] == '') |
... | ... | @@ -638,15 +644,17 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
638 | 644 | case 'serie' : |
639 | 645 | //Unmarshall x serie |
640 | 646 | if (count($paramXInfo['indexes']) == 0) |
641 | - $xParamNode->addXSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, -1, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'}); | |
647 | + $xParamNode->addXSerie(-1, $crtXId, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'}); | |
642 | 648 | else if (count($paramXInfo['indexes']) == 1) |
643 | - $xParamNode->addXSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, $paramXInfo['indexes'][0], $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'}); | |
649 | + $xParamNode->addXSerie($paramXInfo['indexes'][0], $crtXId, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'}); | |
644 | 650 | else |
645 | 651 | throw new Exception('X parameter for serie must be a component.'); |
646 | 652 | break; |
647 | 653 | default : |
648 | 654 | throw new Exception('X parameter not allowed for this drawing type. '); |
649 | 655 | } |
656 | + $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] = $crtXId; | |
657 | + ++$crtXId; | |
650 | 658 | } |
651 | 659 | } |
652 | 660 | |
... | ... | @@ -667,15 +675,17 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
667 | 675 | if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) |
668 | 676 | $colorSerieId = $drawingEltIndex; |
669 | 677 | |
678 | + $xId = ($isScatter && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1; | |
679 | + | |
670 | 680 | switch ($paramData->{'param-drawing-type'}) |
671 | 681 | { |
672 | 682 | case 'serie' : |
673 | 683 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
674 | - $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $isScatter && ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} != ''), $colorSerieId, false); | |
684 | + $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $colorSerieId, false); | |
675 | 685 | break; |
676 | 686 | case 'orbit-serie' : |
677 | 687 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
678 | - $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, false, $colorSerieId, true); | |
688 | + $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true); | |
679 | 689 | break; |
680 | 690 | case 'spectro' : |
681 | 691 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
... | ... | @@ -747,7 +757,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
747 | 757 | } |
748 | 758 | } |
749 | 759 | |
750 | - protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $useXAxis, $colorSerieId, $isOrbitSerie) | |
760 | + protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie) | |
751 | 761 | { |
752 | 762 | $serieNodes = array(); |
753 | 763 | |
... | ... | @@ -755,13 +765,13 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
755 | 765 | { |
756 | 766 | if (count($indexes) == 0) |
757 | 767 | { |
758 | - $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); | |
768 | + $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); | |
759 | 769 | $serieNode->setId($paramData->{'id'}); |
760 | 770 | $serieNodes[] = $serieNode; |
761 | 771 | } |
762 | 772 | foreach ($indexes as $index) |
763 | 773 | { |
764 | - $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); | |
774 | + $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); | |
765 | 775 | if (count($indexes) == 1) |
766 | 776 | $serieNode->setId($paramData->{'id'}); |
767 | 777 | $serieNodes[] = $serieNode; |
... | ... | @@ -769,7 +779,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
769 | 779 | } |
770 | 780 | else |
771 | 781 | { |
772 | - $orbitSerie = $paramNode->addOrbitSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, REQUESTOUTPUTPLOTELEMENTXY_XAXISID, $colorSerieId); | |
782 | + $orbitSerie = $paramNode->addOrbitSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $xAxis, $colorSerieId); | |
773 | 783 | $orbitSerie->setId($paramData->{'id'}); |
774 | 784 | $serieNodes[] = $orbitSerie; |
775 | 785 | } | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotBaseSerieNodeClass.php
... | ... | @@ -5,8 +5,9 @@ require_once "RequestOutputPlotSymbolNodeClass.php"; |
5 | 5 | require_once "RequestOutputPlotSerieTimeTicksNodeClass.php"; |
6 | 6 | require_once "RequestOutputPlotSerieIntervalTicksNodeClass.php"; |
7 | 7 | |
8 | -define ("REQUESTOUTPUTPLOTBASESERIE_YAXIS", "yAxis"); | |
9 | 8 | define ("REQUESTOUTPUTPLOTBASESERIE_XAXIS", "xAxis"); |
9 | +define ("REQUESTOUTPUTPLOTBASESERIE_YAXIS", "yAxis"); | |
10 | +define ("REQUESTOUTPUTPLOTBASESERIE_XID", "xId"); | |
10 | 11 | define ("REQUESTOUTPUTPLOTBASESERIE_COLORSERIEID", "colorSerieId"); |
11 | 12 | define ("REQUESTOUTPUTPLOTBASESERIE_MIN", "min"); |
12 | 13 | define ("REQUESTOUTPUTPLOTBASESERIE_MAX", "max"); |
... | ... | @@ -38,14 +39,14 @@ class RequestOutputPlotBaseSerieNodeClass extends NodeClass |
38 | 39 | return $this->getAttribute(REQUESTOUTPUTPLOTBASESERIE_YAXIS); |
39 | 40 | } |
40 | 41 | |
41 | - public function setXAxisId($axisId) | |
42 | + public function setXId($xId) | |
42 | 43 | { |
43 | - $this->setAttribute(REQUESTOUTPUTPLOTBASESERIE_XAXIS, $axisId); | |
44 | + $this->setAttribute(REQUESTOUTPUTPLOTBASESERIE_XID, $xId); | |
44 | 45 | } |
45 | 46 | |
46 | - public function getXAxisId() | |
47 | + public function getXId() | |
47 | 48 | { |
48 | - return $this->getAttribute(REQUESTOUTPUTPLOTBASESERIE_XAXIS); | |
49 | + return $this->getAttribute(REQUESTOUTPUTPLOTBASESERIE_XID); | |
49 | 50 | } |
50 | 51 | |
51 | 52 | public function setColorSerieId($colorSerieId) |
... | ... | @@ -192,4 +193,4 @@ class RequestOutputPlotBaseSerieNodeClass extends NodeClass |
192 | 193 | } |
193 | 194 | } |
194 | 195 | |
195 | -?> | |
196 | 196 | \ No newline at end of file |
197 | +?> | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php
... | ... | @@ -12,6 +12,7 @@ define ("REQUESTOUTPUTPLOTPARAM_ID", "id"); |
12 | 12 | define ("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie"); |
13 | 13 | define ("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis"); |
14 | 14 | define ("REQUESTOUTPUTPLOTXSERIE_INDEX", "index"); |
15 | +define ("REQUESTOUTPUTPLOTXSERIE_ID", "id"); | |
15 | 16 | define ("REQUESTOUTPUTPLOTXSERIE_MIN", "min"); |
16 | 17 | define ("REQUESTOUTPUTPLOTXSERIE_MAX", "max"); |
17 | 18 | |
... | ... | @@ -58,12 +59,13 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
58 | 59 | $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID,$id); |
59 | 60 | } |
60 | 61 | |
61 | - public function addYSerie($yAxis, $index, $xAxis = "", $colorSerieId = -1, $min = NULL, $max = NULL) | |
62 | + public function addYSerie($yAxis, $index, $xId = -1, $colorSerieId = -1, $min = NULL, $max = NULL) | |
62 | 63 | { |
63 | - if ($xAxis != "") | |
64 | + if ($xId != -1) | |
64 | 65 | { |
65 | 66 | $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); |
66 | - $ySerieNode->setXAxisId($xAxis); | |
67 | + $ySerieNode->setXId($xId); | |
68 | + $ySerieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); | |
67 | 69 | } |
68 | 70 | else |
69 | 71 | $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); |
... | ... | @@ -80,21 +82,21 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
80 | 82 | return $ySerieNode; |
81 | 83 | } |
82 | 84 | |
83 | - public function addOrbitSerie($yAxis, $xAxis, $colorSerieId = -1) | |
85 | + public function addOrbitSerie($yAxis, $xId, $colorSerieId = -1) | |
84 | 86 | { |
85 | 87 | $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); |
86 | 88 | $orbitSerieNode->setYAxisId($yAxis); |
87 | - $orbitSerieNode->setXAxisId($xAxis); | |
89 | + $orbitSerieNode->setXId($xId); | |
88 | 90 | if ($colorSerieId >= 0) |
89 | 91 | $orbitSerieNode->setColorSerieId($colorSerieId); |
90 | 92 | $this->addChild($orbitSerieNode); |
91 | 93 | return $orbitSerieNode; |
92 | 94 | } |
93 | 95 | |
94 | - public function addInstantSerie($xAxis, $yAxis) | |
96 | + public function addInstantSerie($xId, $yAxis) | |
95 | 97 | { |
96 | 98 | $iserieNode = new RequestOutputPlotInstantSerieNodeClass(); |
97 | - $iserieNode->setXAxisId($xAxis); | |
99 | + $iserieNode->setXId($xId); | |
98 | 100 | $iserieNode->setYAxisId($yAxis); |
99 | 101 | $this->addChild($iserieNode); |
100 | 102 | return $iserieNode; |
... | ... | @@ -114,10 +116,10 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
114 | 116 | return $spectroNode; |
115 | 117 | } |
116 | 118 | |
117 | - public function addInstantSpectro($xAxis, $yAxis, $dimOnXAxis, $index = NULL, $min = NULL, $max = NULL) | |
119 | + public function addInstantSpectro($xId, $yAxis, $dimOnXAxis, $index = NULL, $min = NULL, $max = NULL) | |
118 | 120 | { |
119 | 121 | $ispectroNode = new NodeClass(REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME); |
120 | - $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS, $xAxis); | |
122 | + $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_ID, $xId); | |
121 | 123 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); |
122 | 124 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS, $dimOnXAxis); |
123 | 125 | |
... | ... | @@ -129,12 +131,12 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
129 | 131 | return $ispectroNode; |
130 | 132 | } |
131 | 133 | |
132 | - public function addXSerie($xAxis = "", $index = -1, $min = NULL, $max = NULL) | |
134 | + public function addXSerie($index = -1, $id = 0, $min = NULL, $max = NULL) | |
133 | 135 | { |
134 | 136 | $xSerieNode = new NodeClass(REQUESTOUTPUTPLOTXSERIE_NAME); |
135 | - $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_XAXIS, $xAxis); | |
136 | 137 | if ($index >= 0) |
137 | 138 | $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_INDEX, $index); |
139 | + $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_ID, $id); | |
138 | 140 | if (isset($min)) |
139 | 141 | $xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_MIN, $min); |
140 | 142 | if (isset($max)) |
... | ... | @@ -202,9 +204,12 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
202 | 204 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_INDEX); |
203 | 205 | if (empty($index)) |
204 | 206 | $index = -1; |
207 | + $xId = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_XID); | |
208 | + if (empty($xId)) | |
209 | + $xId = 0; | |
205 | 210 | $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MIN); |
206 | 211 | $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MAX); |
207 | - $node = $this->addXSerie($xAxis, $index, $min, $max); | |
212 | + $node = $this->addXSerie($index, $xId, $min, $max); | |
208 | 213 | break; |
209 | 214 | case REQUESTOUTPUTPLOTCOLORSERIE_NAME : |
210 | 215 | $id = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_ID); |
... | ... | @@ -269,4 +274,4 @@ class RequestOutputPlotParamsNodeClass extends NodeClass |
269 | 274 | } |
270 | 275 | } |
271 | 276 | |
272 | -?> | |
273 | 277 | \ No newline at end of file |
278 | +?> | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotYSerieNodeClass.php
... | ... | @@ -22,6 +22,16 @@ class RequestOutputPlotYSerieNodeClass extends RequestOutputPlotBaseSerieNodeCla |
22 | 22 | parent::__construct($name); |
23 | 23 | } |
24 | 24 | |
25 | + public function setXAxisId($axisId) | |
26 | + { | |
27 | + $this->setAttribute(REQUESTOUTPUTPLOTBASESERIE_XAXIS, $axisId); | |
28 | + } | |
29 | + | |
30 | + public function getXAxisId() | |
31 | + { | |
32 | + return $this->getAttribute(REQUESTOUTPUTPLOTBASESERIE_XAXIS); | |
33 | + } | |
34 | + | |
25 | 35 | public function setIndex($index) |
26 | 36 | { |
27 | 37 | $this->setAttribute(REQUESTOUTPUTPLOTYSERIE_INDEX, $index); |
... | ... | @@ -74,4 +84,4 @@ class RequestOutputPlotYSerieNodeClass extends RequestOutputPlotBaseSerieNodeCla |
74 | 84 | } |
75 | 85 | } |
76 | 86 | |
77 | -?> | |
78 | 87 | \ No newline at end of file |
88 | +?> | ... | ... |