Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Chart Control
  New Posts New Posts RSS Feed - Constant Line in Chart Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Constant Line in Chart Control

 Post Reply Post Reply
Author
Message
maestro1914 View Drop Down
Newbie
Newbie


Joined: 22 November 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote maestro1914 Quote  Post ReplyReply Direct Link To This Post Topic: Constant Line in Chart Control
    Posted: 05 January 2012 at 12:16pm
I seem to be able to handle click events and recognize which Chart Control component I am clicking. But, when ever I click the ConstantLine component I don't seem to be able to recognize it. I am using the below code to as a proof of concept in order to test being able to register a click on different components:

void CLineView::OnChartClick(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/){
     CPoint cursorPoint;
     GetCursorPos(&cursorPoint);
     m_wndChartControl.ScreenToClient(&cursorPoint);

    CXTPChartElement* chartElement = m_wndChartControl.HitTest(cursorPoint);
    CXTPChartTitleCollection* titleCollection = m_wndChartControl.GetContent()->GetTitles();

    CString text = "Default Text";

    if (titleCollection->GetCount() == 0)
        titleCollection->Add(new CXTPChartTitle());

    if (DYNAMIC_DOWNCAST(CXTPChartSeries, chartElement)){
          CXTPChartSeries* series = (CXTPChartSeries*)chartElement;
        text = series->GetName();
     } else if (DYNAMIC_DOWNCAST(CXTPChartAxisConstantLine, chartElement)){
          CXTPChartAxisConstantLine* trackLine = (CXTPChartAxisConstantLine*)chartElement;
        text = "Success";
    } else if (DYNAMIC_DOWNCAST(CXTPChartLegend, chartElement)){
          CXTPChartLegend* trackLine = (CXTPChartLegend*)chartElement;
        text = "Legend";
    }

    titleCollection->GetAt(0)->SetText(text);
}

My ultimate goal is to be able to register a click on the constant line and then be able to drag it across a chart in order to get the x,y values of a series at the constant line.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.