Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, I can't find any problems with the code you posted. And if you'd
applied a time scale to the line chart category axis you might have pulled it off. Although there may also be a problem with the dates, if the XY chart didn't recognize them as numeric. Here are some pointers: http://peltiertech.com/Excel/Charts/chartvba.html http://peltiertech.com/Excel/ChartsH...ValueAxis.html Why not dump the ranges into a worksheet and plot from these ranges. It makes life much easier. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "IamJD" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a mix of column and scatter chart on one chart. | Charts and Charting in Excel | |||
Creating Pie Chart | Charts and Charting in Excel | |||
Creating a chart(? pie chart) that shows customers,dates and machi | Charts and Charting in Excel | |||
Creating a chart | Charts and Charting in Excel | |||
Creating a chart in C# | Excel Programming |