Constant Line in Chart Control |
Post Reply |
Author | |
maestro1914
Newbie Joined: 22 November 2011 Status: Offline Points: 3 |
Post Options
Thanks(0)
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. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |