mirror of
				https://github.com/aportelli/LatAnalyze.git
				synced 2025-10-31 14:54:33 +00:00 
			
		
		
		
	Plot: dashed lines
This commit is contained in:
		| @@ -356,6 +356,17 @@ void LineWidth::operator()(PlotOptions &option) const | |||||||
|     option.lineWidth = static_cast<int>(width_); |     option.lineWidth = static_cast<int>(width_); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Dash constructor /////////////////////////////////////////////////////////// | ||||||
|  | Dash::Dash(const string &dash) | ||||||
|  | : dash_(dash) | ||||||
|  | {} | ||||||
|  |  | ||||||
|  | // Dash modifier ////////////////////////////////////////////////////////////// | ||||||
|  | void Dash::operator()(PlotOptions &option) const | ||||||
|  | { | ||||||
|  |     option.dashType = dash_; | ||||||
|  | } | ||||||
|  |  | ||||||
| // LogScale constructor //////////////////////////////////////////////////////// | // LogScale constructor //////////////////////////////////////////////////////// | ||||||
| LogScale::LogScale(const Axis axis) | LogScale::LogScale(const Axis axis) | ||||||
| : axis_(axis) | : axis_(axis) | ||||||
| @@ -470,6 +481,7 @@ void Plot::initOptions(void) | |||||||
|     options_.label[1]     = ""; |     options_.label[1]     = ""; | ||||||
|     options_.lineColor    = ""; |     options_.lineColor    = ""; | ||||||
|     options_.lineWidth    = -1; |     options_.lineWidth    = -1; | ||||||
|  |     options_.dashType     = ""; | ||||||
|     options_.palette      = Palette::category10; |     options_.palette      = Palette::category10; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -505,6 +517,11 @@ Plot & Plot::operator<<(PlotObject &&command) | |||||||
|             commandStr         += " lw " + strFrom(options_.lineWidth); |             commandStr         += " lw " + strFrom(options_.lineWidth); | ||||||
|             options_.lineWidth  = -1; |             options_.lineWidth  = -1; | ||||||
|         } |         } | ||||||
|  |         if (!options_.dashType.empty()) | ||||||
|  |         { | ||||||
|  |             commandStr        += " dt " + options_.dashType; | ||||||
|  |             options_.dashType  = ""; | ||||||
|  |         } | ||||||
|         if (options_.title.empty()) |         if (options_.title.empty()) | ||||||
|         { |         { | ||||||
|             commandStr += " notitle"; |             commandStr += " notitle"; | ||||||
|   | |||||||
| @@ -199,6 +199,7 @@ struct PlotOptions | |||||||
|     std::string              label[2]; |     std::string              label[2]; | ||||||
|     std::string              lineColor; |     std::string              lineColor; | ||||||
|     int                      lineWidth; |     int                      lineWidth; | ||||||
|  |     std::string              dashType; | ||||||
|     std::vector<std::string> palette; |     std::vector<std::string> palette; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -264,6 +265,19 @@ private: | |||||||
|     const unsigned width_; |     const unsigned width_; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | class Dash: public PlotModifier | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     // constructor | ||||||
|  |     explicit Dash(const std::string &dash); | ||||||
|  |     // destructor | ||||||
|  |     virtual ~Dash(void) = default; | ||||||
|  |     // modifier | ||||||
|  |     virtual void operator()(PlotOptions &option) const; | ||||||
|  | private: | ||||||
|  |     const std::string dash_; | ||||||
|  | }; | ||||||
|  |  | ||||||
| class LogScale: public PlotModifier | class LogScale: public PlotModifier | ||||||
| { | { | ||||||
| public: | public: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user