when I set the axis offset property and after this if I read the maximum/minimum property I got the maximum and minimum values of the axis before the offset, so the values are not the ones displayed at the chart
The question: is it normal ? Seems that I have to calculate by myself the real values of the maximum and minimum of the chart to calculate correctly the increments
It seems that MaximumRound/MinimumRound also does not take in account the offsets or I did not understand how the round works in teechart (see the pic)
Here is the code to show all above.
Code: Select all
Private Sub Command1_Click()
TChart1.Series(0).Clear
TChart1.Series(0).FillSampleValues Rnd * 100
Me.TChart1.Repaint
Me.TChart1.Axis.Bottom.Increment = (Me.TChart1.Axis.Bottom.Maximum - Me.TChart1.Axis.Bottom.Minimum) / 5
Me.TChart1.Axis.Left.Increment = (Me.TChart1.Axis.Left.Maximum - Me.TChart1.Axis.Left.Minimum) / 5
Me.Text1.Text = ""
Me.Text1.Text = ".bottom.minimum=" + Format(Me.TChart1.Axis.Bottom.Minimum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".bottom.maximum=" + Format(Me.TChart1.Axis.Bottom.Maximum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".left.minimum=" + Format(Me.TChart1.Axis.Left.Minimum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".left.maximum=" + Format(Me.TChart1.Axis.Left.Maximum, "#####0.000") + vbCrLf
End Sub
Private Sub Form_Load()
Randomize
Me.Show
TChart1.Series(0).FillSampleValues Rnd * 100
With Me.TChart1
.Panel.Gradient.Visible = False
.Walls.Visible = True
.Walls.Back.Color = vbWhite
.Walls.Back.Gradient.Visible = False
.Axis.Bottom.Ticks.Visible = False
.Axis.Bottom.TickInnerLength = 6
.Axis.Bottom.AxisPen.Color = vbBlack
.Axis.Bottom.TicksInner.Color = vbBlack
.Axis.Bottom.GridPen.Color = &HC0C0C0
.Axis.Bottom.Labels.RoundFirstLabel = False
.Axis.Bottom.MaximumRound = True
.Axis.Bottom.MinimumRound = True
.Axis.Bottom.MinimumOffset = 10
.Axis.Bottom.MaximumOffset = 10
.Axis.Left.Ticks.Visible = False
.Axis.Left.TickInnerLength = 6
.Axis.Left.AxisPen.Color = vbBlack
.Axis.Left.TicksInner.Color = vbBlack
.Axis.Left.GridPen.Color = &HC0C0C0
.Axis.Left.Labels.RoundFirstLabel = False
.Axis.Left.MaximumRound = True
.Axis.Left.MinimumRound = True
.Axis.Left.MinimumOffset = 10
.Axis.Left.MaximumOffset = 10
End With
Me.TChart1.Repaint
Me.TChart1.Axis.Bottom.Increment = (Me.TChart1.Axis.Bottom.Maximum - Me.TChart1.Axis.Bottom.Minimum) / 5
Me.TChart1.Axis.Left.Increment = (Me.TChart1.Axis.Left.Maximum - Me.TChart1.Axis.Left.Minimum) / 5
Me.Text1.Text = ""
Me.Text1.Text = ".bottom.minimum=" + Format(Me.TChart1.Axis.Bottom.Minimum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".bottom.maximum=" + Format(Me.TChart1.Axis.Bottom.Maximum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".left.minimum=" + Format(Me.TChart1.Axis.Left.Minimum, "#####0.000") + vbCrLf
Me.Text1.Text = Me.Text1.Text + ".left.maximum=" + Format(Me.TChart1.Axis.Left.Maximum, "#####0.000") + vbCrLf
End Sub