Hi Eva,
There is an example in ChartDirector for a normal distribution chart. You can shift the bars by simply modifying the x-coordinates of the bars (in the Layer.setXData method). This will not affect the spline layer.
https://www.advsofteng.com/doc/cdcom.htm#histogram.htm
For your existing chart, it seems you are using a "label based x-axis" (the x-axis is configured using Axis.setLabels, and no x-coordinates are provided for the BarLayer and SplineLayer). If you prefer to use a label based x-axis, you can use the following code to shift the bar by 0.5 label spacing to the left:
' Assume this is your bar layer
Set layer = c.addBarLayer(data, &H6699bb)
' Shift by 0.5 label distance to the left
Call layer.setXData(-0.5, Ubound(data) - 0.5)
' **** Do not use setLabels ****
'Call c.xAxis().setLabels(labels)
' Instead, use setLinearScale2 for the x-axis labels
Call c.xAxis().setLinearScale2(0, Ubound(labels), labels)
Hope this can help.
Regards
Peter Kwan |