Link to home
Start Free TrialLog in
Avatar of inampudi1
inampudi1

asked on

Position on TChart

hi there,

    I searched for a timeline component as in attachment (please find an attachment screenshot.jpg). Such timeline component is best suitable for my application. But unfortunately I did not get like timeline component. Could you please tell me where can I find such timeline component. If you also don't find such component, could you please tell me using what basic delphi components we can create the timeline component as in attachment.
                  Right now I am using TChart to create timeline component. I made marginleft, margintop, marginbottom, marginright to 0, hence chart1.width is equivalent to actual chart displaying area width. Here whatever the lines you are seeing in the timeline (please find an attachment screenshot1.jpg) are the series and I am able to draw the basic lines. In this timeline I want to provide "If user clicks on the chart I want to draw a vertical line on the clicked position of TChart showing that timeline has moved to user clicked position.  ChartMouseDown is giving X,Y of the Chart in pixels. Now I want to know at which position (not in pixels but in time line position number) I have to draw the line. Is there any direct function of the Chart to get the timeline position just by passing X,Y in pixels.
                   I did some calcuations (please find the code in the code section of this question) to find the timeline position depending on X,Y of chart in pixels, most of the times it is working correct, but not all the time.

                       Please help me.

               
X is the mouse down event parameter. p,q are extended type variables.
 
  p := (Chart1.BottomAxis.Maximum);
  q := Chart1.Width / p;
  x := Round((x / q));
 
  MySeries7.AddXY(x,Chart1.LeftAxis.Minimum);
  MySeries7.AddXY(x,Chart1.LeftAxis.Maximum);

Open in new window

screenshot.JPG
screenshot1.JPG
Avatar of calinutz
calinutz
Flag of Romania image

ASKER CERTIFIED SOLUTION
Avatar of calinutz
calinutz
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of inampudi1
inampudi1

ASKER

                   Yes, It is helpful and has given me good information how to take processes information, but before your reply I solved my issue.
                                                                  Thank you.