Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TChart Series Label (not in legend but on graph itself)

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
Hi,

I have several line-series drawn on a TChart. I would like to mark each series with a text label on the graph itself i.e. not on the axis nor using a legend. How should I go about this?

I'm using the standard TChart component that comes with Delphi 6.

Your help would be much appreciated. Clive [infinity]
 
hi Clive

I did a similar thing with my own Hint type form and showed it with the chart's onClick event - setting the hint form's top, left to the x,y values in the event.

The only other way I can think of is see if you can get the chart component's x,y position from the series' plotted values(I'm sure you can but can't think of it at the mo.) and display a label of your own.

lou
 
Thanks for the answer Lou. I was wondering if anyone knew of an already existing property that could be set to visibly identify each series. The problem is that I draw the series in different pen styles (when the user has selected to print in mono) but they don't show up too well so I wanted to identify each series by placing a label just above it (on the chart itself i.e. on its canvas) with a numbering system. In the legend, the numbering system could then be matched against the series names.

Incidentally, I developed a hint form too which appears when you hover your mouse over the series. If you wanna know how to do this instead of having to do a mouse-click event then let me know! Clive [infinity]
 
hi Clive

Sorry, can't help you any further with your inital query but I'd be interested in your 'hover' code [rednose].

Could you email me the snippet?

lou
alwestwell@onetel.net.uk
 
I did this in D5 by defining an OnGetMarkText handler that overrides the default label with the custom value. See TChart help for more info.

Series.OnGetMarkText:= GetMarkText
....
procedure TNodeReportForm.GetMarkText(Sender: TChartSeries; ValueIndex: Integer; var MarkText: String);
begin
MarkText:= 'custom text';
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top