This should be easy to do, but I cannot figure it out.
Using TeeChartPro v6 under BCB6.
I have several line series on Chart1, and I want lebels on the chart, where the label text is the series name (so 1 label for each series). Is there a built-in method to add a label to each series specifying the series name?
Thanks,
Doug
Label TLineSeries series by series name?
Hi, Dough.
Try setting the TChartSeries.Title property.
Please not the difference between series Title and Name properties-The Title property is used in the Legend to draw the series descriptions. If set, it will be displayed instead of Series.Name in the Chart Editor and/or TChartListBox. Series.Title can be multi-worded whereas as Series.Name is a Delphi component name.
Try setting the TChartSeries.Title property.
Code: Select all
Series1.Title := 'Series1Title';
Series2.Title := 'Series2Title';
Hi Marjan,
Thanks for your reply, I will use ->Title for the legend. However, I would really like to have a Label directly on the Chart also, on top of or next to the actually plotted Series. This is similar to Series 'Marks', but instead of labelling an actual point in the Series (as the Marks is used for), I simply want to label the line, with for example the series Title, or some other text if I want.
Is there a built in method for that? If not, can you point me in the right place for manually building and placing these labels?
Thanks,
Doug
Thanks for your reply, I will use ->Title for the legend. However, I would really like to have a Label directly on the Chart also, on top of or next to the actually plotted Series. This is similar to Series 'Marks', but instead of labelling an actual point in the Series (as the Marks is used for), I simply want to label the line, with for example the series Title, or some other text if I want.
Is there a built in method for that? If not, can you point me in the right place for manually building and placing these labels?
Thanks,
Doug
Hi Doug,
to do this you could use the OnGetMarkText event as in the following example :
Josep Lluis Jorge
http://support.steema.com
to do this you could use the OnGetMarkText event as in the following example :
Code: Select all
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Series1->FillSampleValues(10);
Series2->FillSampleValues(10);
Series1->Marks->Visible = true;
Series2->Marks->Visible = true;
Series1->Name = "Name1";
Series2->Name = "Name2";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Series1GetMarkText(TChartSeries *Sender,
int ValueIndex, AnsiString &MarkText)
{
if (ValueIndex == 4) MarkText = Sender->Name;
else MarkText = "";
}
http://support.steema.com