I have made a plot program based on vector.
The vector is in two dimension.

Code:
vector<CPlot> pPlot;
So this is like two dimension array. the first dimension is for the plot index (multiple plots) and the second dimension is CPlot that contain array of double.

Code:
vector<double> points;
Or more complete class declaration code is something like this:

Code:
class CPlot
{
public:
	CPlot(CString name, COLORREF color);
	~CPlot();

protected:
	// Name of plot which will be displayed on the legend
	CString name;
	// Container for plot points
	vector<double> points;
	// Color of the plot
	COLORREF color;

public:
	// Initialization of plot variables
	void InitPlot(CString name, COLORREF color);
	// Insert a point to the plot
	void InsertPoint(double point);
};

class CYNPlot
{
public:
	// protected constructor used by dynamic creation
	CYNPlot();
	~CYNPlot();

protected:
	CString Title, XName, YName;
	// Containner of plots which will be displayed on the screen
	vector<CPlot> pPlot;

public:
	// Initializing plot variables
	void InitPlot(CString Title, CString XName, CString YName);
	// Draw all graph component to the screen
	void Draw(CDC* pDC);
	// Insert new plot to the graph
	void InsertPlot(CString name, COLORREF color);
	// Insert a point to the selected plot
	int InsertPoint(unsigned int index, double value);	
	// Draw all existing plot
	void DrawPlot();

};
I use this plot for displaying the sensor value (20 sensors) in real time. Every second I update the view 10 times.
The problem is if the number of points is increasing, at about 500 point of 20 sensors/plots, the time of drawing is increasing also.

The looping is something like this:

getdata from 20 sensors -> Add point to 20 plots using points.push_back(point); -> Redraw the plot.

I redraw only 100 last points, not all points. It should be at constant speed, but it is getting slower and slower.

The second program, I make the vector size constant. If I add a new point I remove the first point. And it works, the speed is constant now.

My conclusion is vector dependence with its size? Is that true? Or maybe there are solution to improve the speed of vector operation?