Page 1 of 1

How Do I set parameters like font/bg for a Mark Tips tool?

Posted: Wed Jan 05, 2005 6:35 pm
by 9336617
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 );
}

Posted: Fri Jan 07, 2005 8:20 am
by Marjan
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;