Scroll Chart Control | CodeGuru

Scroll Chart Control

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Nov 19, 2001
1 minute read
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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.