Display hh:mm:ss in marks
Display hh:mm:ss in marks
Hello,
In a pie i want to display values in the format hh:mm:ss (it could be for examples 124:18:12)
What is the best way to do that?
Regards
In a pie i want to display values in the format hh:mm:ss (it could be for examples 124:18:12)
What is the best way to do that?
Regards
Hi Calou,
You could add the values to the pie with the time as its label. For example:
And to ensure that the points' labels will be shown at series' marks:
You could add the values to the pie with the time as its label. For example:
Code: Select all
var myTimeString: string;
//...
myTimeString:= '21:06:20';
Series1.Add(StrToDateTime(myTimeString),myTimeString);
Code: Select all
Series1.Marks.Style := smsLabel;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
In order to be more precise
Here is the code that convert the data in date time (hh:mm:ss)
Here is the code that convert the data in date time (hh:mm:ss)
Code: Select all
dt:=FloatToDateTime(frmMain.IBCQryRd.FieldByName('DUREE').AsFloat);
test:=FormatFloat('00',HoursBetween(dt,0))+':'+FormatFloat('00',MinuteOf(dt))+':'+FormatFloat('00',SecondOf(dt));
Hi Calou,
I'm not sure to understand how are you adding your values to the series but anyway, you should have a double as value and a string as label for each point added point.
Then, to show the label as mark and the value at the legend:
And reverse:
I'm not sure to understand how are you adding your values to the series but anyway, you should have a double as value and a string as label for each point added point.
Then, to show the label as mark and the value at the legend:
Code: Select all
Series1.Marks.Style := smsLabel;
Chart1.Legend.TextStyle := ltsValue;
Code: Select all
Series1.Marks.Style := smsValue;
Chart1.Legend.TextStyle := ltsPlain;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Hello,
To solve my problem i have used OnGetMarkText
However i want to use TMarksTipTool and now the hint is always the marks value and i would like to have the legend value
In my example i would like to hint TEST
http://www.cijoint.fr/cjlink.php?file=c ... 1oWlI6.jpg
Here is the code of the event :
thank you for help
To solve my problem i have used OnGetMarkText
However i want to use TMarksTipTool and now the hint is always the marks value and i would like to have the legend value
In my example i would like to hint TEST
http://www.cijoint.fr/cjlink.php?file=c ... 1oWlI6.jpg
Here is the code of the event :
Code: Select all
procedure TfrmMain.Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer;
var MarkText: string);
begin
MarkText:=FormatFloat('00',HoursBetween(Sender.YValue[ValueIndex],0))+':'
+FormatFloat('00',MinuteOf(Sender.YValue[ValueIndex]))+':'+FormatFloat('00',SecondOf(Sender.YValue[ValueIndex]));
end;
Hi Calou,
There is also a OnGetMarkText from Mark Tips Tool that you still could use. Could be something like that:
There is also a OnGetMarkText from Mark Tips Tool that you still could use. Could be something like that:
Code: Select all
procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
var Text: String);
var i: Integer;
tmpText: string;
begin
for i:=0 to Series1.Count-1 do
begin
tmpText := FormatFloat('00',HoursBetween(Sender.Series.YValue[ValueIndex],0))+':'
+FormatFloat('00',MinuteOf(Sender.Series.YValue[ValueIndex]))+':'+FormatFloat('00',SecondOf(Sender.Series.YValue[ValueIndex]));
if (tmpText = Text) then
begin
Text := Series1.Labels.Labels[i];
break;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |