Page 1 of 1

Setting Individual Mark Label

Posted: Tue Jun 17, 2008 1:05 am
by 15048479
I am trying to Set Normal Text to Mark.

I used the code below
(I am using Visual Studio 2008 Professional Edition.)

--below---

Code: Select all

long lSeriesColor = (*m_pChart).Series(iSeriesAnalyzed).GetColor();
long what = (*m_pChart).Series(iSeriesAnalyzed).AddXY(wcstod(strX,NULL),wcstod(strY,NULL),strLabel,lSeriesColor);	
CSeries cseries = (*m_pChart).Series(iSeriesAnalyzed);
CMarks cm  = cseries.GetMarks();
cm.SetStyle(smsLabel);
CStrings cs = cm.GetItem(what).GetText();
cs.SetText(_T("TEXT"));
------------

Code: Select all

cm.GetItem(what)
When I go this Line, Teechart Shows me the Message Box( no
component ) and I also can see this Debug Out put Message

---Output Message---------
Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003).
First-chance exception at 0x7c812a5b in Tester.exe: Microsoft C++ exception: COleException at memory location 0x0012eb14..
--------------------------------

Plz anybody give me a clue. :(

Posted: Tue Jun 17, 2008 8:29 am
by narcis
Hi Ssnsam,

Have you tried doing something like this?

Code: Select all

	long iSeriesAnalyzed = m_Chart1.AddSeries(scPoint);
	long lSeriesColor = m_Chart1.Series(iSeriesAnalyzed).GetColor();
	long what = m_Chart1.Series(iSeriesAnalyzed).AddXY(rand(),rand(),"HELLO WORLD!",lSeriesColor);   
	CSeries cseries = m_Chart1.Series(iSeriesAnalyzed);
	CMarks cm  = cseries.GetMarks();
	cm.SetStyle(smsLabel);
	CStrings cs = cm.GetItem(what).GetText();
	cs.SetText(_T("TEXT"));

Plz Help me :<

Posted: Thu Jun 19, 2008 7:42 am
by 15048479
I tried that way already.
It works fine.
but, in that way , Bottom Axis Text will show that text ,too.
because I want X-axis name to be as a Text.

Confilicting Code is like below.

Code: Select all

(*m_pChart).GetAxis().GetBottom().GetLabels().SetStyle(talText);

Posted: Mon Jun 23, 2008 10:18 am
by Pep
Hello,

in case you only want to modify the text of specific mark text leaving the same labels for bottom axis ( used in the AddXY method ) , the following code should do it :

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scBar
    .Series(0).AddXY 0, 10, "A", clTeeColor
    .Series(0).AddXY 1, 10, "B", clTeeColor
    .Series(0).AddXY 2, 10, "C", clTeeColor
    .Series(0).AddXY 3, 10, "D", clTeeColor
    .Series(0).AddXY 4, 10, "E", clTeeColor
    .Axis.Bottom.Labels.Style = talText
    .Series(0).Marks.Item(0).Text.Text = "Hello"
End With
End Sub
It's VB code , in case you have problems to translate it let us know This way you should be able to see "Hello" for the first series mark having the "A" text for its axis label.