Scroll Chart Control

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.





Click here for larger image

Environment: Win2K SP2, VC6 SP4

Simply, this is a chart with support for “history”. For bugs and improvements mail me, Thz.

The class has the following features:

  • Any number of lines.

  • Different styles, colors and width for each line.

  • Unlimited number of points per line, or you can put limit if you want.

  • Configurable grid.

  • Hscroll.

  • Automatic adjustment to vertical values.

How to use

1. Declare a CScrollChart object — it’s a template you must use to specify a type of data.

CScrollChart< float > m_wndChart;

2. Use Create (See help file for values).

m_wndChart.Create( WS_VISIBLE | GS_NOTIFY,
rectChart,
this,
IDR_CHART);

3. Add lines.

m_wndChart.AddLine(ID_LINE1, RGB(255,0,0));

m_wndChart.AddLine(ID_LINE2, RGB(0,0,255), LS_POINT | LS_HORZAUTO);

You can add new lines at any moment.

4. Add data to line.

m_wndChart.AddData(ID_LINE1, 3, 9);

m_wndChart.AddData(ID_LINE1, 10, 2);
m_wndChart.AddData(ID_LINE2, 3);
m_wndChart.AddData(ID_LINE2, 5);

m_wndChart.AddData(ID_LINE2, 34);

Downloads

Download demo project – 14 Kb

Download source – 2 Kb

Download help – 7 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read