Page 1 of 1

Tooltip

Posted: Wed Jul 21, 2004 5:25 am
by 9078645
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

Posted: Thu Jul 22, 2004 12:29 am
by Pep
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);

Posted: Thu Jul 22, 2004 12:30 am
by Pep
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); 	
}

Posted: Tue Jul 27, 2004 5:28 am
by 9078645
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

OnOnMarkTipToolGetTextTchart

Posted: Tue Jul 27, 2004 5:35 am
by 9078645
I tried to oerwrite "OnOnMarkTipToolGetTextTchart"
without any result.
Id did not display any tooltip at all. Is it need to turn on tooltip somewhere?

Posted: Tue Jul 27, 2004 12:44 pm
by Chris
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);

}

tcMarksTip

Posted: Wed Jul 28, 2004 3:33 am
by 9078645
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;

tcMarksTip = 8

Posted: Wed Jul 28, 2004 4:03 am
by 9078645
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.

Works 100%

Posted: Wed Jul 28, 2004 4:39 am
by 9078645
Hi,
Sorry, it works 100%. you just have to return different text, else it does not continue show the tooltip.
/ Jan