Label (Time) at at intersection

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
cssesuc
Newbie
Newbie
Posts: 44
Joined: Wed Apr 08, 2015 12:00 am

Label (Time) at at intersection

Post by cssesuc » Tue Nov 03, 2015 11:41 pm

Hi,
I am trying to display the starting DateTime at the intersection of the BottomAxis with the LeftAxis and it seems not to really work.
I tried to tune the LabelsSeparation property but the result is not really convincing and I fail to display the first DateTime.
How can I force the Chart BottomAxis to have a label at its intersection with the LeftAxis, and get this time value (00:35:00) displayed.
I arranged a small example and I would appreciate to know if this is feasible at all with the 2013 version of TeeChart.
Many thanks for any hint on how to proceed here.
Attachments
Capture.JPG
Capture.JPG (46.85 KiB) Viewed 9896 times
LabelAtIntesection.zip
(78.6 KiB) Downloaded 643 times
thanks,
Nabil Ghodbane (PhD. Habil)

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Label (Time) at at intersection

Post by Yeray » Wed Nov 04, 2015 9:37 am

Hello,

The easiest would be manually drawing your label. Ie:

Code: Select all

procedure TForm2.Chart1AfterDraw(Sender: TObject);
var tmpValue: Double;
    tmpXPos: Integer;
    tmpS: String;
begin
  tmpValue:=Chart1.Axes.Bottom.Minimum;
  tmpS:=FormatDateTime(Chart1.Axes.Bottom.DateTimeFormat, tmpValue);
  if Chart1.Axes.Bottom.LabelsMultiLine then
    tmpS:=ReplaceChar(tmpS,' ',TeeLineSeparator);

  tmpXPos:=Chart1.Axes.Bottom.CalcPosValue(tmpValue);
  Chart1.Axes.Bottom.DrawAxisLabel(tmpXPos, Chart1.Axes.Bottom.PosAxis + Chart1.Axes.Bottom.TickLength + 1, Chart1.Axes.Bottom.LabelsAngle, tmpS);
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

cssesuc
Newbie
Newbie
Posts: 44
Joined: Wed Apr 08, 2015 12:00 am

Re: Label (Time) at at intersection

Post by cssesuc » Wed Nov 04, 2015 10:45 pm

Hi,
many thanks for the approach, but unfortunately it does not really work in all scenarios. The label which is drawn using the approach you suggest overlaps with the first time label which is drawn.
I tried to play on the width of the label without any success. I also tried to not plot this item if the first item of the BottomAxis (Axes.Bottom.Items) is at the same position, but this does not really help as well.

Is there a plan to have something implemented centrally, say as one BottomAxis option ? It would be much easier.
thanks,
Nabil Ghodbane (PhD. Habil)

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Label (Time) at at intersection

Post by Yeray » Thu Nov 05, 2015 1:20 pm

cssesuc wrote:The label which is drawn using the approach you suggest overlaps with the first time label which is drawn.
I tried to play on the width of the label without any success. I also tried to not plot this item if the first item of the BottomAxis (Axes.Bottom.Items) is at the same position, but this does not really help as well.
How would you expect it to behave exactly?
At the moment, the labels in the bottom axis are drawn from right to left. If you want the minimum to be automatically calculated so it matches the next label, you can set:

Code: Select all

    BottomAxis.AutomaticMinimum:= True;
    BottomAxis.MinimumRound:=True;
But it doesn't look exactly as your first image:
first label.png
first label.png (3.88 KiB) Viewed 9819 times
Or maybe you'd like the labels to be drawn from left to right? I'm not sure if it would be easy to implement that.

Worth to mention here you always have the possibility to Clean all the labels Items in the bottom axis and Add those you want.
cssesuc wrote:Is there a plan to have something implemented centrally, say as one BottomAxis option ? It would be much easier.
This is a quite specific feature. It would be interesting if there was a considerable amount of customers interested.
Before deciding that, we should define what is the exact behaviour to expect.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

cssesuc
Newbie
Newbie
Posts: 44
Joined: Wed Apr 08, 2015 12:00 am

Re: Label (Time) at at intersection

Post by cssesuc » Thu Nov 05, 2015 1:46 pm

Hi,
thanks for your feedback. Yes you're right, in the case of a Minimum time which is say 00:00 or 00:30, it works, but in my case, I need to handle scenarios for which the Minimum time, is, say 00:05 or 00:37.
In that case, the Chart does not display that value.
So what I want to have displayed at the intersection of the bottom/left axes, is the start time. Setting the label as you suggested in your first reply does the job, but unfortunately, it overlaps with the first item of the BottomAxis.Items. I tried to compare the distance of the label I insert to the first item and if the do overlap, simply remove the first item, but it does not really work.
So I had basically two questions:
1- is there a smart approach you could suggest to ovoid this overlap between the label and the first item ?
2- you said that in order to implement this centrally, you need to have a sufficient number of users who request this feature. what is the "threshold " here?

thanks for clarifying the two points above.
thanks,
Nabil Ghodbane (PhD. Habil)

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Label (Time) at at intersection

Post by Yeray » Fri Nov 06, 2015 8:27 am

Hello,
cssesuc wrote:1- is there a smart approach you could suggest to ovoid this overlap between the label and the first item ?
I'm still not sure about how would you expect the rest of the labels to be.
If we take the example you attached above and we modify the bottom axis minimim and maximum as follows:

Code: Select all

    BottomAxis.Minimum:= StrToDateTime('03/11/2015 22:32:00');
    BottomAxis.Maximum:= StrToDateTime('06/11/2015 0:32:00');
I understand you'd expect one label at "03/11/2015 22:32:00". But what other exact labels would you expect?
cssesuc wrote:2- you said that in order to implement this centrally, you need to have a sufficient number of users who request this feature. what is the "threshold " here?
First we should define a concrete feature request, and at the moment I'm not sure what would be the exact definition of the same.
The time until we can fix a bug or implement a new feature also depends on other variables such as the complexity of the problem, impact and the number of issues with even higher priority that claims our team attention.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply