I have two series - Called Male and Female with values alf and John in one and anne, georgina and rose in the other
I do a stacked bar chart, set the legend to the values so it looks like two bars with legends showing the individual names - perfect. The "marks" however show M or F NOT the names as per the legend - is this a bug.... Can I get round it??
Am just being stupid?
Running D7 and Teechart Pro 7...
Showing legend names (not series names) as bar marks....
Hi,
to show the Series Names in the Marks you will have to customize the MarkText using the OnGetMarkText event like :
to show the Series Names in the Marks you will have to customize the MarkText using the OnGetMarkText event like :
Code: Select all
procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
ValueIndex: Integer; var MarkText: String);
begin
MarkText := Sender.Title;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com
Thnaks BUT....
Two things
Firstly there may be 50 series of which 49 are temporary so how can you allocate the getmarkseries function to a series by its number?
Secondly, its not the title of the series I am after but the value of the item within the series - ie fred, ann or bill...
Thank you thus far
Two things
Firstly there may be 50 series of which 49 are temporary so how can you allocate the getmarkseries function to a series by its number?
Secondly, its not the title of the series I am after but the value of the item within the series - ie fred, ann or bill...
Thank you thus far
Hi.
A simple for loop should do the trick:Firstly there may be 50 series of which 49 are temporary so how can you allocate the getmarkseries function to a series by its number?
Code: Select all
procedure TForm1.YourOnMarkTextEvent(Sender: TChartSeries;
ValueIndex: Integer; var MarkText: String);
begin
MarkText := Sender.XLabels[ValueIndex];
end;
for i := 0 to Chart1.SeriesCount-1 do
Chart1.Series[i].OnGetMarkText := YourOnMarkTextEvent;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Thank you...
Here's a different tack that seems to work (only on stacked charts though)
procedure Trewritealone.ChartTool1GetText(Sender: TMarksTipTool;
var Text: String);
var t,tmp:integer;
x,y:double;
begin
chart1.Series[0].GetCursorValues(x,y);
for t:=0 to chart1.seriescount-1 do
begin
tmp:=chart1.Series[t].GetCursorValueIndex;
if tmp<>-1 then
text:=chart1.series[t].title+' '+floattostr(chart1.series[t].YValue[tmp]);
end;
end;
Here's a different tack that seems to work (only on stacked charts though)
procedure Trewritealone.ChartTool1GetText(Sender: TMarksTipTool;
var Text: String);
var t,tmp:integer;
x,y:double;
begin
chart1.Series[0].GetCursorValues(x,y);
for t:=0 to chart1.seriescount-1 do
begin
tmp:=chart1.Series[t].GetCursorValueIndex;
if tmp<>-1 then
text:=chart1.series[t].title+' '+floattostr(chart1.series[t].YValue[tmp]);
end;
end;