Setting Individual Mark Label

TeeChart for ActiveX, COM and ASP
Post Reply
Ssnsam
Newbie
Newbie
Posts: 6
Joined: Mon Mar 03, 2008 12:00 am
Contact:

Setting Individual Mark Label

Post by Ssnsam » Tue Jun 17, 2008 1:05 am

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. :(

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 17, 2008 8:29 am

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"));
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Ssnsam
Newbie
Newbie
Posts: 6
Joined: Mon Mar 03, 2008 12:00 am
Contact:

Plz Help me :<

Post by Ssnsam » Thu Jun 19, 2008 7:42 am

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);

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

Post by Pep » Mon Jun 23, 2008 10:18 am

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.

Post Reply