Tooltip

TeeChart for ActiveX, COM and ASP
Post Reply
janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

Tooltip

Post by janjons » Wed Jul 21, 2004 5:25 am

Hi,
Is there an example how to set tooltip text in a pie, from MFC?
I read something about OnGetText event and GetMark but I can't really understand how.
I am using TChartProAtvicex control v6.
/ Jan

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 22, 2004 12:29 am

Hi Jan,

to change the text of the Marks in VC++ you can use similar code to the following in the OnGetMarkText event :

Code: Select all

 CString strLabel(*LabelText);
 strLabel = "My cutom Label";
 strLabel.SetSysString(LabelText);

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 22, 2004 12:30 am

Hi Jan,

sorry, just a modification :

Code: Select all

void CGetXSeriesMarksDlg::OnOnGetSeriesMarkTchart1(long SeriesIndex, long ValueIndex, BSTR FAR* MarkText) 
{
CString strLabel(*MarkText); 
strLabel = "My cutom Label"; 
strLabel.SetSysString(MarkText); 	
}

janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

Post by janjons » Tue Jul 27, 2004 5:28 am

Hi,

I tried this. It just changes the label of the pie slices.
I whant to have a yellow tooltip that is displayed if uses puts mouse over the pie slies.
Pies are somettimes small, and the short text can be hard to understand. So I would like to display a longer description if user put mouse over whatever he dont understand.

/ Jan

janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

OnOnMarkTipToolGetTextTchart

Post by janjons » Tue Jul 27, 2004 5:35 am

I tried to oerwrite "OnOnMarkTipToolGetTextTchart"
without any result.
Id did not display any tooltip at all. Is it need to turn on tooltip somewhere?

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jul 27, 2004 12:44 pm

Hi -
I tried to oerwrite "OnOnMarkTipToolGetTextTchart"
without any result.
Id did not display any tooltip at all. Is it need to turn on tooltip somewhere?
The following code works as expected here:

Code: Select all

void CVCplus60TESTAXv6Dlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);

	m_Chart1.AddSeries(scPie);
	m_Chart1.Series(0).FillSampleValues(10);
	m_Chart1.GetTools().Add(tcMarksTip);
	m_Chart1.GetTools().GetItems(0).GetAsMarksTip().SetSeries(COleVariant("Series0"));
	m_Chart1.Series(0).GetMarks().SetVisible(false);

}

BEGIN_EVENTSINK_MAP(CVCplus60TESTAXv6Dlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CVCplus60TESTAXv6Dlg)
	ON_EVENT(CVCplus60TESTAXv6Dlg, IDC_TCHART1, 37 /* OnMarkTipToolGetText */, OnOnMarkTipToolGetTextTchart1, VTS_I4 VTS_PBSTR)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CVCplus60TESTAXv6Dlg::OnOnMarkTipToolGetTextTchart1(long Tool, BSTR FAR* Text) 
{
	CString strLabel(*Text);
	strLabel += " custom";
	strLabel.SetSysString(Text);

}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

tcMarksTip

Post by janjons » Wed Jul 28, 2004 3:33 am

I can't find the definition for tcMarksTip.
However it is listed in the manual.

TeeChartDefines.h

// EToolClass
const unsigned long tcCursor = 0;
const unsigned long tcDragMarks = 1;
const unsigned long tcAxisArrow = 2;
const unsigned long tcDraw = 3;
const unsigned long tcHints = 4;
const unsigned long tcColorband = 5;
const unsigned long tcColorLine = 6;
const unsigned long tcRotate = 7;

janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

tcMarksTip = 8

Post by janjons » Wed Jul 28, 2004 4:03 am

Hi, Found the constant in manual. Not existing in headerfiles!

So now my tooltip is working. BUT! Major problem, it is one tooltip for hole Pie. I whant to display different tooltip for each item in a serie.
How can I do that?
/ Jan


From help:
Not all development environments support the direct call of TeeChart's Enum constants by name. See note on use of Enum constants for VBScript, MS VC++.

Integer Values:
tcCursor = 0
tcDragMarks = 1
tcAxisArrow = 2
tcDraw = 3
tcHints = 4
tcColorband = 5
tcColorLine = 6
tcRotate = 7
tcMarksTip = 8
tcChartImage = 9
tcAnnotate = 10
tcPageNumber = 11

TeeChart Pro ActiveX Control Documentation. Copyright 1997-2003 Steema Software SL.

janjons
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: sweden
Contact:

Works 100%

Post by janjons » Wed Jul 28, 2004 4:39 am

Hi,
Sorry, it works 100%. you just have to return different text, else it does not continue show the tooltip.
/ Jan

Post Reply