Reputation: 27
I'm making a software where i plot samples measured from an electric circuit on a teechart chart.
The user needs to be able to select the time window of the samples on the screen. For example, the chart has 10 fixed divisons on the screen, and each of these divisions can represent a 0,5s, 1s, 2s or 5s window.
The problem is that teechart only has fixed datetime increments, for example 1 second or 5 seconds. What i need to do is be able to select custom increments on a datetime bottom axis on teechart.
I'm setting the bottom axis increment with this code:
Form1.Osc.BottomAxis.Increment := DateTimeStep[dtonesecond];
Upvotes: 1
Views: 553
Reputation: 34899
The Increment
property is a TDateTime
type, which is declared as a Double
.
So, just use normal math to set a custom increment.
Examples how to set different increments:
Form1.Osc.BottomAxis.Increment := 0.5*DateTimeStep[dtonesecond]; // 0.5 sec
Form1.Osc.BottomAxis.Increment := DateTimeStep[dtonesecond]; // 1 sec
Form1.Osc.BottomAxis.Increment := 2*DateTimeStep[dtonesecond]; // 2 sec
Form1.Osc.BottomAxis.Increment := 5*DateTimeStep[dtonesecond]; // 5 sec
or
Form1.Osc.BottomAxis.Increment := 0.5*(1.0/SecsPerDay); // 0.5 sec
Form1.Osc.BottomAxis.Increment := 1.0/SecsPerDay; // 1 sec
Form1.Osc.BottomAxis.Increment := 2.0/SecsPerDay; // 2 sec
Form1.Osc.BottomAxis.Increment := 5.0/SecsPerDay; // 5 sec
Upvotes: 3