Print Page | Close Window

Constant Line in Chart Control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Chart Control
Forum Description: Topics Related to Codejock Chart Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19386
Printed Date: 24 November 2024 at 9:16pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Constant Line in Chart Control
Posted By: maestro1914
Subject: Constant Line in Chart Control
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net