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 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


Comments

  • Healing Erectile Dysfunction In Diabetics: Can Gene Treatments Balance The blue pill Efficacy?

    Posted by anieffifielm on 06/21/2013 03:18am

    The strategy to Select Best Erectile Dysfunction Treatment? Having trouble maintaining an erection before or during sexual intercourse [url=http://rxhealth.pw ] viagra y cialis generico [/url] read far more Erectile Dysfunction Cure

    Reply
  • Problem with compilation

    Posted by Legacy on 02/26/2004 12:00am

    Originally 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.

    Reply
  • I found the one

    Posted by Legacy on 02/24/2004 12:00am

    Originally posted by: mingligar

    Thanks. your projet is The one I want to find. I get it.

    Reply
  • can it display infinite data?

    Posted by Legacy on 10/31/2003 12:00am

    Originally posted by: edward

    can this display data as much as I like, or huge quantities?

    Reply
  • Here is the solution of drawing negative value.

    Posted by Legacy on 08/06/2003 12:00am

    Originally posted by: Taghi

    << In the class file >>
    
    Change the "LPtoDP(T X,T Y)" function as the folowing :

    template<class T>
    CPoint CScrollChart<T>::LPtoDP(T X,T Y)
    {
    int nY;
    int nX;
    CRect rectClient;
    GetClientRect(rectClient);
    nY = ((rectClient.Height() * (Y-m_MinValue) * 0.95) /( m_MaxValue-m_MinValue));
    nX = ((rectClient.Width() * (X - m_pointIni)) / m_nHzRange);
    return CPoint(nX, rectClient.Height() - nY);
    }


    << In your program >>
    And if you want to refresh the min vertical limit textbox
    as in the demo program only in "OnNewLimits" message
    mapped function uncomment the folloing statment:

    //else m_TextVerMax.SetWindowText(strTmp);

    So that the whole function can looked as follow:

    void CTest02Dlg::OnNewLimits(WPARAM wParam, LPARAM lParam)
    {
    CString strTmp;
    strTmp.Format("%d",wParam);
    if ( (GetCurrentMessage()->message) == WM_NEWHORZLIMITS) m_TextHozMin.SetWindowText(strTmp);
    else m_TextVerMin.SetWindowText(strTmp);
    strTmp.Format("%d",lParam);
    if ( (GetCurrentMessage()->message) == WM_NEWHORZLIMITS) m_TextHozMax.SetWindowText(strTmp);
    else m_TextVerMax.SetWindowText(strTmp);
    }


    Reply
  • Problem with the .Create

    Posted by Legacy on 04/28/2003 12:00am

    Originally 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

    Reply
  • Concern about memory size

    Posted by Legacy on 08/13/2002 12:00am

    Originally 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

    Reply
  • To Delete control(sonia's solution not working)

    Posted by Legacy on 08/02/2002 12:00am

    Originally 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
    Amit

    Reply
  • Problem Adding Lines..

    Posted by Legacy on 06/25/2002 12:00am

    Originally 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,
    Jeremy

    Reply
  • Print

    Posted by Legacy on 06/19/2002 12:00am

    Originally posted by: Helena

    How can I print the graph?

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

  • The impact of a data loss event can be significant. Real-time data is essential to remaining competitive. Many companies can no longer afford to rely on a truck arriving each day to take backup tapes offsite. For most companies, a cloud backup and recovery solution will eliminate, or significantly reduce, IT resources related to the mundane task of backup and allow your resources to be redeployed to more strategic projects. The cloud - can now be comfortable for you – with 100% recovery from anywhere all …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds