ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Xvalues to an array of date, but the x-scale not correct (https://www.excelbanter.com/excel-programming/276285-re-set-xvalues-array-date-but-x-scale-not-correct.html)

Alan Pong

Set Xvalues to an array of date, but the x-scale not correct
 
Sorry for missing information.
It is excel 97, line curve (the default one)

When i set xvalues (say "=Sheet1!$A$2:$A$5") in chart wizard, it is ok.
But when i set it by program or in macro's debug window, not ok.


"Tom Ogilvy" wrote in message ...
Are you using a scatter plot. If not, that is the only type chart that
would do what you describe.

--
Regards,
Tom Ogilvy

Alan Pong wrote in message
om...
a = array(cdate("2003/12/5"), cdate("2008/9/3") ,cdate("2013/9/2"),
cdate("2033/8/28"))
activesheet.chartobjects(1).chart.seriescollection (1).xvalues=a

b = array(.93, 3.26 , 4.35, 5.21)
activesheet.chartobjects(1).chart.seriescollection (1).values=b

what i see is that the x distance between two consecutive points is
uniform.
(the fourth point should be more far away.)

any cue?
thanks.
rgds.
alan


Jon Peltier[_3_]

Set Xvalues to an array of date, but the x-scale not correct
 
Alan -

If the chart is a Line type, it may have applied a purely Category axis
type. You can change this to a time-scale axis type as follows:

ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlTimeScale

Or you can convert the chart to an XY Scatter type, as Tom suggested:

ActiveChart.ChartType = xlXYScatterLines

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Alan Pong wrote:
Sorry for missing information.
It is excel 97, line curve (the default one)

When i set xvalues (say "=Sheet1!$A$2:$A$5") in chart wizard, it is ok.
But when i set it by program or in macro's debug window, not ok.


"Tom Ogilvy" wrote in message ...

Are you using a scatter plot. If not, that is the only type chart that
would do what you describe.

--
Regards,
Tom Ogilvy

Alan Pong wrote in message
.com...

a = array(cdate("2003/12/5"), cdate("2008/9/3") ,cdate("2013/9/2"),
cdate("2033/8/28"))
activesheet.chartobjects(1).chart.seriescollect ion(1).xvalues=a

b = array(.93, 3.26 , 4.35, 5.21)
activesheet.chartobjects(1).chart.seriescollect ion(1).values=b

what i see is that the x distance between two consecutive points is
uniform.
(the fourth point should be more far away.)

any cue?
thanks.
rgds.
alan




Alan Pong

Set Xvalues to an array of date, but the x-scale not correct
 
Thanks Jon and Tom!


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com