Scroll Chart Control
Posted
by Juan Carlos Sanchez
on November 19th, 2001
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 KbDownload source - 2 Kb
Download help - 7 Kb

Comments
Problem with compilation
Posted by Legacy on 02/26/2004 12:00amOriginally posted by: Petr Hracek
Hey all,
It's very great work. It's excelent.
I have one big problem. I tried compile this demo code
and MSVC++.NET2003 sow me message that _GetBaseMessageMap is not a member of CScrollChart <T>.
And other error:
d:\Temp\test\cldemo.cpp(47): error C2440: 'static_cast' : cannot convert from 'void (__thiscall CDialogMain::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
Can you help me anybody?
Petr.
ReplyI found the one
Posted by Legacy on 02/24/2004 12:00amOriginally posted by: mingligar
Thanks. your projet is The one I want to find. I get it.
Replycan it display infinite data?
Posted by Legacy on 10/31/2003 12:00amOriginally posted by: edward
can this display data as much as I like, or huge quantities?
ReplyHere is the solution of drawing negative value.
Posted by Legacy on 08/06/2003 12:00amOriginally posted by: Taghi
ReplyProblem with the .Create
Posted by Legacy on 04/28/2003 12:00amOriginally posted by: Maarten
CScrollChart::Create
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
nID
Specifies the chart control's ID.
What is the chart control's ID? Is is the scrollbar?
This header looks wonderfull but I can't get it running...
In the example it has value 101. Why? I can't find the reason...
Thanks for help!!
Greetz
ReplyConcern about memory size
Posted by Legacy on 08/13/2002 12:00amOriginally posted by: Amit
Thanks
Emil,
for your help.That u have suggested is one away solution and i also find other solution
as
Create pointer
CScrollChart *myscrollchart;
myscrollchart=new CScrollChart();
this work fine
Now I have concern about memory size.
when I put four scrollchart controls having 3 to 4 lines each with 0 timer the memory uses increases drastically.And CPU usage is also 99% which affect other application's working.
So can any one suggest how to clip the control.
Window display as of size of control would be sufficient for me.
Amit
ReplyTo Delete control(sonia's solution not working)
Posted by Legacy on 08/02/2002 12:00amOriginally posted by: Amit
Hi
I want to delete the control on the fly. but code suggested by sonia seems to be not working in my case.
It is giving error while creating pointer of the template class CScrollChart .If any one knows the solution please help me
thanks
ReplyAmit
Problem Adding Lines..
Posted by Legacy on 06/25/2002 12:00amOriginally posted by: Jeremy
Hello, thanks for the control. It looks very useful. I am able to draw the chart, but when I do AddLine and AddData nothing happens - I can't draw any lines on the chart.
Can you give me any info that may help with this issue?
Thanks,
ReplyJeremy
Print
Posted by Legacy on 06/19/2002 12:00amOriginally posted by: Helena
How can I print the graph?
Replyhow to clear graph
Posted by Legacy on 06/12/2002 12:00amOriginally posted by: hnf
how clear the graph and restart an other
ReplyLoading, Please Wait ...