G
Guest
I have created a chart that I would like to display with a line graph (or XY
Scatter). I use VBA to dynamically update the chart. I am using Excel 2000
and 2003.
The source data is stored in a user-defined variable which contains two
arrays. One is type "date" and the other is type "single".
The code will go through the spreadsheet populating the array with the
appropriate numbers.
I use the single type array for the y-values and the date type array for the
x-values. If I leave the chart as a line graph, it plots the chart fine with
one exception, the x-axis points are not spaced appropriately. If one point
is on 1/1/2006 and another is at 2/1/2006 they are they same distance apart
as if the two dates were 1/1/2006 and 6/1/2006. Basically, it doesn't
understand the difference between the dates, it just places the next one
right after the other.
I did some research and found that this is how it is for line graphs, so I
switched to XY Scatter plot as was suggested. Unfortuneately, the same thing
happens. It's just that instead of dates on the x-axis it shows just
incrementing numbers (1, 2, 3, etc....).
I know the values in the array are correct, because I looked at it as the
code was running. I think this has something to do with assigning the
XValues property of the chart to an array, but not 100% sure.
Any help possible would be appreciated.
Scatter). I use VBA to dynamically update the chart. I am using Excel 2000
and 2003.
The source data is stored in a user-defined variable which contains two
arrays. One is type "date" and the other is type "single".
The code will go through the spreadsheet populating the array with the
appropriate numbers.
I use the single type array for the y-values and the date type array for the
x-values. If I leave the chart as a line graph, it plots the chart fine with
one exception, the x-axis points are not spaced appropriately. If one point
is on 1/1/2006 and another is at 2/1/2006 they are they same distance apart
as if the two dates were 1/1/2006 and 6/1/2006. Basically, it doesn't
understand the difference between the dates, it just places the next one
right after the other.
I did some research and found that this is how it is for line graphs, so I
switched to XY Scatter plot as was suggested. Unfortuneately, the same thing
happens. It's just that instead of dates on the x-axis it shows just
incrementing numbers (1, 2, 3, etc....).
I know the values in the array are correct, because I looked at it as the
code was running. I think this has something to do with assigning the
XValues property of the chart to an array, but not 100% sure.
Any help possible would be appreciated.