Chart series date misalignment depending on source data

VeeBeeAye453

New Member
Joined
Dec 14, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm having an issue trying to bring multiple data sources with date X-axis values into the same chart with a VBa macro. The chart "scales" to the first series added or whichever is set as the source data. When the other series' are added, I think they might be unwittingly "discretized" into the first series' X-axis values and data loses it's horizontal alignment.

Attached is a screenshot of "10-16" and "10-41" stand-alone charts, and a chart where "10-16" is the first series added - you can see the "10-16" profile retains it's date alignment but "10-41" loses it.

Capture.PNG


These screenshots are of a chart made with the first series of "10-16" data inputted either as Chart.SetSourceData or Chart.SeriesCollection.Add, with the source a range of "A:A,B:B" where A is date data and B is value data.The other series' are added as Chart.SeriesCollection.Add, with a range of "B:B" (i.e. just value data).

If their own date ranges are used and they're inputted with "A:A,B:B" instead, I get the second image which tries to graph the date values as an additional series.

Capture2.PNG


The end result I'm looking for is to have "10-41" and "10-16" stacked over each other in the same manner as they are independently, meaning values across each series aren't vertically aligned - you'd think a scatter chart would solve this but it looks almost exactly the same as the line charts above if I try that.

Thank you!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top