Print Page | Close Window

ChartElement type

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=19585
Printed Date: 28 April 2024 at 3:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ChartElement type
Posted By: Minieggs
Subject: ChartElement type
Date Posted: 20 March 2012 at 9:45am
Hi All
 
When using ChartElement how can you tell what type of element the returned handle points to ?
 
Thanks
 



Replies:
Posted By: SuperMario
Date Posted: 28 March 2012 at 9:21am
Something like this:

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

CXTPChartElement* pElement = m_wndChartControl.HitTest(pt);

if (DYNAMIC_DOWNCAST(CXTPChartTitle, pElement))
{
CXTPChartTitle* pTitle = (CXTPChartTitle*)pElement;

SetTitle(pTitle);
}
else if (DYNAMIC_DOWNCAST(CXTPChartAxis, pElement))
{
CXTPChartAxis* pAxis = (CXTPChartAxis*)pElement;

pAxis->GetTitle()->SetVisible(TRUE);
pAxis->GetTitle()->SetText(_T("Clicked On Axis"));

//SetTitle(pTitle);
}
else if (DYNAMIC_DOWNCAST(CXTPChartSeriesPoint, pElement))
{
CXTPChartSeriesPoint* pPoint = (CXTPChartSeriesPoint*)pElement;

TRACE(_T("Clicked on point with value: %i and argument: %s\n"), (int)pPoint->GetValue(0), pPoint->GetArgument());
}
else
{
SetTitle(NULL);
}
}



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