File: multiplot.h

package info (click to toggle)
aoflagger 3.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,960 kB
  • sloc: cpp: 83,076; python: 10,187; sh: 260; makefile: 178
file content (40 lines) | stat: -rw-r--r-- 976 bytes parent folder | download | duplicates (2)
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
#ifndef MULTIPLOT_H
#define MULTIPLOT_H

#include "../structures/types.h"

#include <vector>

#include "../plot/plotmanager.h"

class MultiPlot {
 public:
  MultiPlot(XYPlot& plot, size_t plotCount);

  void AddPoint(size_t plotIndex, num_t x, num_t y) {
    _points[plotIndex].push_back(Point(x, y));
  }
  void SetLegend(int index, const std::string& title) {
    _legends[index] = title;
  }
  void Finish();
  XYPlot& Plot() { return _plot; }
  void SetXAxisText(const std::string& text) { _xAxisText = text; }
  void SetYAxisText(const std::string& text) { _yAxisText = text; }

 private:
  MultiPlot(const MultiPlot&) = delete;
  MultiPlot& operator=(const MultiPlot&) = delete;
  struct Point {
    Point(num_t _x, num_t _y) : x(_x), y(_y) {}
    num_t x, y;
  };
  typedef std::vector<struct Point> PointList;
  std::vector<std::string> _legends;
  std::vector<PointList> _points;
  size_t _plotCount;
  XYPlot& _plot;
  std::string _xAxisText, _yAxisText;
};

#endif