I am sending this line of code ,I set the automatic increment for Axes to false and Evaluate the Axes on the basis of values assigned to Chart.
The labels on the Axes or not properly displayed ,The Minimum value for X and Y axis is not properly labled at the Crossing point of X,Y axis.
I sending Code and also attachment for description.
Code: Select all
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.ClearChart
TChart1.Panel.Color = vbWhite
'
' Remove grid lines
'
TChart1.Axis.Bottom.GridPen.Visible = False
TChart1.Axis.Left.GridPen.Visible = False
TChart1.Aspect.View3D = False
TChart1.Legend.LegendStyle = lsSeries
TChart1.Axis.Left.Title.Caption = " Left Title"
TChart1.Axis.Bottom.Title.Caption = "Right Title"
TChart1.Header.Text.Clear
TChart1.Header.Text.Add ("Test Chart")
TChart1.AddSeries scLine
TChart1.Series(0).XValues.Order = loNone
TChart1.Series(0).YValues.Order = loNone
TChart1.Series(0).Color = vbBlue
TChart1.Axis.Left.AutomaticMaximum = False
TChart1.Axis.Left.AutomaticMinimum = False
TChart1.Axis.Bottom.AutomaticMaximum = False
TChart1.Axis.Bottom.AutomaticMinimum = False
' set start up value for X and Y-Axis
TChart1.Axis.Bottom.Maximum = 273.15
TChart1.Axis.Bottom.Minimum = 273.15
TChart1.Axis.Left.Maximum = 0.000439826
TChart1.Axis.Left.Minimum = 0.000439826
AddValue 273.15, 0.0243884
AddValue 275, 0.0221781
AddValue 277, 0.019932
AddValue 279, 0.0178038
AddValue 281, 0.0157854
AddValue 283, 0.013871
AddValue 285, 0.0120655
AddValue 287, 0.0103616
AddValue 289, 0.00875473
AddValue 291, 0.00724847
AddValue 293, 0.00584231
AddValue 295, 0.00454165
AddValue 297, 0.00334514
AddValue 299, 0.00225734
AddValue 301, 0.0012822
AddValue 303, 0.000439826
AddValue 304.22, 0
'TChart1.Axis.Bottom.Minimum = 273.15
'TChart1.Axis.Bottom.Maximum = 305
TChart1.Axis.Bottom.Increment = 2
TChart1.Axis.Bottom.Labels.ValueFormat = "0.00"
'TChart1.Axis.Left.Maximum = 0.0243884
'TChart1.Axis.Left.Minimum = 0.000439826
TChart1.Axis.Left.Increment = 0.005
TChart1.Axis.Left.Labels.ValueFormat = "00.00"
End Sub
Code: Select all
Private Sub AddValue(X As Double, Y As Double)
If X = 0 Or Y = 0 Then
TChart1.Series(0).AddXY X, Y, "", clNone
Else
TChart1.Series(0).AddXY X, Y, "", clTeeColor
'
' Evaluate minimum/maximum value for Y-Axis
'
If Y > TChart1.Axis.Left.Maximum Then
TChart1.Axis.Left.Maximum = Y
End If
If Y < TChart1.Axis.Left.Minimum Then
TChart1.Axis.Left.Minimum = Y
End If
'
' Evaluate minimum/maximum value for X-Axis
'
If X > TChart1.Axis.Bottom.Maximum Then
TChart1.Axis.Bottom.Maximum = X
End If
If X < TChart1.Axis.Bottom.Minimum Then
TChart1.Axis.Bottom.Minimum = X
End If
End If
End Sub