TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
mLapido
- Newbie
- Posts: 24
- Joined: Wed Mar 24, 2004 5:00 am
- Location: Brasil
-
Contact:
Post
by mLapido » Wed Jan 05, 2005 6:35 pm
Apparently setting the parameters for the marks in design time or programatically does not work.
here's what I did and didn't work...
Code: Select all
void __fastcall TFGPS::chtVolByVar_OnGetMarkText(TChartSeries *Sender,
int ValueIndex, AnsiString &MarkText)
{
TMarksItem *pMarks = Sender->Marks->Item[ValueIndex];
TPointSeries *p = dynamic_cast<TPointSeries *>(Sender);
double x = p->XValue[ValueIndex],
y = p->YValue[ValueIndex];
pMarks->Font->Name = "Tahoma";
pMarks->Font->Size = 7;
pMarks->Color = 0x00E4E4EA;
pMarks->Frame->Color = clGray;
MarkText.sprintf( "%s\n%d%%\nR$%.2f", MarkText,
(int)x, y );
}
-
Marjan
- Site Admin
- Posts: 745
- Joined: Fri Nov 07, 2003 5:00 am
- Location: Slovenia
-
Contact:
Post
by Marjan » Fri Jan 07, 2005 8:20 am
Hi.
To customize individual series marks, you have to use slightly different code:
Code: Select all
// customize mark...
TMarksItem *mark = Series1->Marks->Item[3];
mark->Font->Size = 14;
mark->Color = clSilver;
// customize another mark...
mark = Series1->Marks->Item[5];
mark->Font->Size = 12;
mark->Font->Color = clWhite;
mark->Color = clNavy;
mark->ShapeStyle = fosRoundRectangle;
mark->Shadow->Size = 4;
mark->Shadow->Transparency = 60;
mark->Shadow->Color = clDkGray;
Using the code above (you can place it in OnGetMarkText event or anywhere else, providing series marks have already been drawn/created) you should be able to customize each series mark individually. Of course, if you want to use the same properties for *all* series marks, you can use much simpler code:
Code: Select all
Series1->Marks->BackColor = clLime;
Series1->Marks->Color = clLime;
Series1->Marks->Font->Name = "Arial Narrow";
Series1->Marks->Visible = true;