Link to home
Start Free TrialLog in
Avatar of ChLa
ChLaFlag for United States of America

asked on

Two overlapping components

Can I have two charts on my form, both overlapping, by having only one visible at a time ? At design time I would make the first chart invisible before adding the second. At run time a button would control which is visible. Both TCharts would be completely overlapping, in the same exact position. There isn't room on my form for both charts to exist at the same time.
Avatar of gxs
gxs
Flag of United States of America image

Would you clarify your question a little bit?

Because my mind is telling me that this is the answer ( even though rationally it isn't ):

Creating visual components at runtime:

var
  C: TMyVisualComponent;
begin
  C := TMyVisualComponent.Create(Self);
  C.Left := 100;
  C.Top := 100;
  C.Width := 400;
  C.Height := 300;
  C.Visible := True;
  C.Parent := Self; //Any container: form, panel, ...

  C.MyProperty := MyValue,
  //...
end;

Open in new window


Or by setting the first chart visible at design time and then setting it to false by a button click event.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia 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
using TChart, you can add multiple series

when adding the first series you typically calculate the min and max values for x and y
an example: cpu usage versus number of users connected to a database
the cpu usage is from 0% to 100%
the number of users is from 0 to ???, by day about 1000, by night about 50

in the legend an indication is required of how the 2 graphs relate to each other
the cpu usage is easy > the height of the graph is the percentage > 0 to 100
for the users an estimate of 1200 max users would be 100%

example data:
cpu: 86%
actual users: 700 > value (or height) calculated in the graph: 700/1200*100=58.33%

if you make a dependency like this, it's possible to show multiple values graphs in 1 chart
typical example: average speed and altitude over distance during bike race
http://www.steema.com/gallery/mobile/23#
Avatar of ChLa

ASKER

TPageControl looks like a great solution.  Thank you.