RESOLUTION
There are two ways to deal with this issue:
- Formatting the number to 15 or fewer decimal places.
- Using the SetData property on each data point.
Workaround 1
Before setting the chart to the variant array, "truncate" the decimal
values to 15 places or less as seen in the form_load event below:
Private Sub Form_Load()
Dim data_pts(1 To 3, 1 To 2) As Variant
dim i as integer
data_pts(1, 1) = "R1"
data_pts(1, 2) = 5.48487730596136E-02
data_pts(2, 1) = "R2"
data_pts(2, 2) = 7.04216678154124E-02
data_pts(3, 1) = "R3"
data_pts(3, 2) = 3.10863837084563E-04
For i = 1 To 3
data_pts(i, 2) = CDbl(Format(data_pts(i, 2), "0.000000000000000"))
'Truncate data_pts to 15 decimal places of precision
Next
MSChart1 = data_pts
End Sub
Workaround 2
Use the SetData method to add the data to the chart instead of setting the
chart to the variant array. To use this workaround, rewrite the Form_Load
event to look like this instead:
Private Sub Form_Load()
With MSChart1
.RowCount = 3
.ColumnCount = 1
.DataGrid.SetData 1, 1, 5.48487730596136E-02, False
.DataGrid.SetData 2, 1, 7.04216678154124E-02, False
.DataGrid.SetData 3, 1, 3.10863837084563E-04, False
End With
End Sub