Blame view

src/ParamOutputImpl/Plot/Scatter/XYPlot.hh 3.8 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * XYPlot.hh
 *
 *  Created on: 29 oct. 2013
 *      Author: CS
 */

#ifndef XYPLOT_HH_
#define XYPLOT_HH_

#include "PanelPlotOutput.hh"
#include "NodeCfg.hh"
#include "XYPlotNode.hh"

namespace plot {

/**
 *  @brief Plot that draws f(x).
 */
class XYPlot: public PanelPlotOutput {
public:
	XYPlot(AMDA::Parameters::ParameterManager& manager,
			boost::shared_ptr<Panel> panel);
	virtual ~XYPlot();

	/**
	 * @overload plot::PanelPlotOutput
	 */
	virtual const std::string typeName() {
		return XYPLOT_NODENAME;
	}

	/**
	 * @overload plot::PanelPlotOutput::preparePlotArea()
	 */
	virtual void preparePlotArea(double startTime, double stopTime, int intervalIndex);

	/**
	 * @overload plot::PanelPlotOutput::createParameters()
	 */
	virtual void createParameters(std::list<std::string>& usedParametersId_);

	/**
	 * @brief Gets parameter that is it-self or a component on xAxis.
	 */
	virtual ParameterAxes& getParameterAxeOnXAxis(const std::string& xAxisId);

	/**
	 * @brief Gets x serie configured on a given x axis id.
	 */
	virtual XSeriesProperties& getSerieOnXAxis(const std::string& axisId);

	/**
	 * @brief Gets x serie from a parameter configured on a given x axis id.
	 * @throw PanelPlotOutputException if not found
	 */
	virtual XSeriesProperties& getSerieOnXAxisfromParameter(
			const std::string& axisId_, ParameterAxes& parameter_);

	/**
	 * @overload PanelPlotOutput::getLayoutConstraint (void)
	 * @brief Defines the layout constraint to be used for the panel when used within a layout
	 */
	virtual PanelConstraint getLayoutConstraint (void) {
		return PanelConstraint::Square;
	}

	/**
	 * @brief Flag to make x axis and y axis have the same length
	 */
	bool _isIsotropic;

protected:
	/**
	 * @overload PanelPlotOutput::calculatePlotArea(Bounds const& pPanelBounds)
	 * @brief Calculate and draw plot area.
	 */
	virtual void calculatePlotArea(Bounds& bounds_);


	/**
	 * @brief Format a date / time according to a given format.
	 */
	virtual std::string formatDateTime (double dateTime, const std::string &format);
	/**
	 * @brief Draw time ticks for a serie on plot.
	 */
	virtual void drawTimeTicks(SeriesProperties& pSeries, AMDA::Common::ParameterIndexComponent pParamIndex,
			double* timeValues, int nbTimeValues);

	/**
	 * @overload PanelPlotOutput::drawSeries(double startDate, double stopDate, std::string pParamId, SeriesProperties const& pSerie)
	 * @brief Draw series of parameter on plot.
	 */
	virtual void drawSeries(double startDate, double stopDate, int intervalIndex, std::string pParamId,
			SeriesProperties& pSerie,
			AMDA::Common::ParameterIndexComponent pParamIndex, ParameterAxes& param,
			bool moreThanOneSerieForAxis);

	/**
	 * @overload PanelPlotOutput::drawCurvePlot(CurvePlot &curvePlot)
	 * @brief Draw curvePlot for a panel.
	 */
	virtual void drawCurvePlot(CurvePlot &curvePlot);

	/*
	 * Dumps properties for test.
	 */
	virtual void dump(std::ostream& fileName_);

	/*
	 * @brief Get computed X values (in relation with the x axis definition) for a serie and a time interval
	 * Do not forget to delete computedValues !!
	 * Don't delete timeValues !!
	 */
	bool getXComputedValuesFromSerieAndInterval(double startDate, double stopDate, SeriesProperties &rSeriesProperties,
			double** computedValues, double** timeValues, int& nbValues);

	/*
	 * @overload PanelPlotOutput::getSerieParamsLegendString Return the associated params legend to a xy serie
	 */
	virtual std::string getSerieParamsLegendString(SeriesProperties &rSeriesProperties,
			AMDA::Common::ParameterIndexComponent& index, std::string originalParamId);

private:
	/**
	 * @brief Configure series color (symbols and line) and range of axis (depending of parameters series to draw).
	 */
	void configureSeriesAxis();

	/**
	 * @brief Configure axis legend with paramInfo.
	 */
	void configureAxisLegend();
};

} /* namespace plot */
#endif /* XYPLOT_HH_ */