Adding new data series changes Excel 2016 chart format - excel

I'm adding a new series to a chart I have and Excel 2016 (Windows 10) keeps changing the format, automatically. I'm a very experienced user and don't recollect ever having this issue. Here is the chart before any changes:
Here is what happens when I add another prices series (same dates as the share price on the chart but adjusted for dividends):
I tried going to Options / Advanced / Charts and unselecting both "Properties follow chart data point for all new workbooks" and "Properties follow chart data point for current workbook" - didn't help.
If I open my Visual Basic Editor and click on "ThisWorkbook", the ChartDataPointTrack is indeed selected to "False".
So what am I missing here?
Extra info #1:
Given 'Terry W' question about data samples, to avoid dumping too much info here, I will describe what they are ( I don't think this is the issue, as there is nothing special on the data; all series are scatter-plots):
the share prices are daily share prices for Coca-Cola [KO]. The original series was the regular share price anyone sees on a day-to-day basis, the series I added was the "Adjusted Price" (i.e., the historical share price adjusted for dividends).
The historical dots in red/light-red are quarterly earnings (annualized) - so not a lot of data
The dots in the future are just one per year - so very little data
Extra info #2:
I noticed that when adding a new series (done by [i] right-clicking on the chart, [ii] clicking on "Select Data..." and [iii] clicking on "Add") but limiting the number of days added, the formating holds! See the picture below: I added 2,000 days of data vs. the 5,500 days I have for the other price series.
I was able to go up to 4,000 days with no issues. As soon as I used "5000", it changed the format. By "used" I mean, changing the reference on the window below you see superimposed to the chart:
Extra info #3:
As you noticed, my charts are in a dark format. This is because I work long hours with spreadsheets and dark formats are much more gentle on my tired eyes (I have posted a macro I wrote to darken spreadsheets here). When converting some charts to dark format, I could have used a macro like the one below. I'm not sure if that was the case for this specific chart, but decided to add the code anyways in case it helps someone to solve the mystery:
Dim s_name As String
For Each Shape In ActiveSheet.Shapes
s_name = Shape.Name
' Format all charts to style #209
If Shape.Type = msoChart Then
ActiveSheet.ChartObjects(s_name).Activate
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 209
ActiveSheet.Shapes(s_name).ZOrder msoSendToBack
End If

I had a similar problem with a macro that would add series to the chart. My issue turned out to be that I was setting the chart type to xlXYScatter before adding the new series. This was resetting the formats of series already on the chart to the default for that type, which is not what I wanted. In my case, leaving the chart type and explicitly setting the new series' format in the macro fixed the problem.
While that was not happening with the original poster's situation, I has me wondering if crossing the data series threshold implicitly changed the chart type.

Related

Excel Line Chart with separate data points for a single line

I have a weird problem that google's not being too kind on results (mostly basic things on how to create a line chart, or combination charts, neither of which I'm after).
I'm trying to automate a report we do each month, I've managed pretty well so far by having a linked excel chart and objects, I have a single sheet in excel I paste my formatted data (set format is consistent each month) then excel picks out the data, creates the charts and when opening powerpoint it reads it all in from there.
Great! Until I was given a new piece of information, there's monthly data and a yearly tally in my data, monthly data is shown with a particular "weighting" applied, year with a different one and it's this that's caused a problem.
The package that's exporting the data can't show these figures contiguously, so we have an export with all the monthly weights, then with annual weights.
So say originally we were looking at C83 to O83 for our data for this year, we're now looking at C83 to N83 and O1364.
I've tried to look at how I would add this to the chart, which currently has the reference:
='Monthly Data to Update'!$C$83:$O$83
But doing anything + or & doesn't seem to work.
So, I decided to just pull all my data in to contiguous set to reference, (so ='Monthly Data to Update'!C83 one cell, ='Monthly Data to Update'!C84 next cell and so on).
This caused a problem for future months that're empty, having 0's in them, so I updated my code to check:
=IF('Monthly Data to Update'!C83=0,NA(),'Monthly Data to Update'!C83)
And this works, my table below my chart is blank for the empty months, my chart doesn't try and plot these empty months. Hurrah!
Now, the wrinkle. The Yearly nets aren't charted but are displayed in the table (I'm not up on Excel charts so how this was originally setup, I just copied the charts from Powerpoint in to Excel and reset the data to where it needed to be before copying it back to Powerpoint as a data linked chart).
First chart I did, works fine, second chart I did it's decided to start plotting the annual net for two of the three lines = \
So, this is how my chart looks like, running off the contiguous (but wrong) data:
And this is how it looks running off the fetched contiguous (correct) data:
It's really baffling, Exceeded and Met now plot the Year to Date figure, whereas Not Met behaves as it should, and they all have the same data layout (on the right) using the same formulas (just pointing at different cells).
I am confused..
I'm hoping to keep this light and simple so have avoided using any macro's to date, so that down the line when I hand this project over to someone any maintenance should be easy to do (say add a chart) without them asking me and me then having to remember what the hell I did a few months ago.. - so if this is doable without going down that line (which, seems like it should be, given my first chart the two lines there worked fine, and one of the three in this is behaving itself).
Apologies for the long winded description, I've given full history so if there's a step further back I could've done better, then happy to fix it up there rather than where I got to.
Ah, so apparently I could've had non-contiguous data with a comma, not a plus or ampersand, so the chart data would be:
=('Monthly Data to Update'!$C$83:$N$83,'Monthly Data to Update'!$O$1404)
So I don't need to rebuild the data in to a contiguous set, and my charts don't cock up when selecting the data this way, win's all around.
Thank you for your time, hopefully this helps someone in the future. (as a saving grace for my lost morning)

Pivot chart (Excel) fails to render the data the way I want

I'm creating a piece of Java code to fill data into an excel file. The file is pre-created, inlcuding a pivot chart and some vba code.
Though the java code works, I have some problems getting the pivot chart itself to work. I've included a screenshot with some demodata.
There are several Problems I'd like to solve:
The X-Achis seems to behave like a category-axis, though it is formatted as a date-axis.
Symptoms:
Dates are not ordered automatically, but only if I order the according column in the pivot-table
All dates have the same distance, though there is a gap of 1.5 years in the data
The chartline of cathy has a gap. But i do want the line rendered, even if there are dates without data for cathy
Am I using the wrong chart, did I miss the an important checkbox in the chart options or do I really have to interpolate the data programmatically for every day before filling it into the table?
The last option would be not only be disappointing, but also distort the chart since I want to have the datapoints marked with symbols (like the squares and diamonds on the screenshot)
Any help is appreciated.
Edit
By now this is my solution:
First of all: pivot charts are great, unless you want to visualize randomly ordered dates
I'm going to copy the pivot-data via vba into another sheet and use a regular chart
Gaps in the chartline can be avoided by using a point-diagram (X/Y-data) and selecting "connect datapoints with line" in the Dialog in "datasource > hidden and empty cells" (roughly translated from the german locale)
The vba-code will be extended to set up the diagram to my needs (adjusting range of input data and so on)
Still I'm kind of disappointed. I would have thought this was a usual usecase.
I set up trial workbook.
I based a line chart on a range of data that had a column of dates.
It was NOT pivot chart, just an ordinary one
When I went to the x-axis formatting options and chose "Date axis" I was presented with choices about how to span the dates out (to do what you want).
When I created a chart based on a pivot table using the same data, the x-axis formatting options did not give me the same choices
It would seem that pivot charts do not allow dates to be spanned out.
So you might like to consider basing your chart on a range of data not a pivot table.
I also found this useful page, all about this sort of thing:
here
Harvey

Excel Pivot Chart Help - Pulling names that contributed to count (VBA?)

I am looking to develop a pivotchart of meaningful data related to employees. Lets say it's a graph of employees with infractions by month.
We have a graph that graphs it based on the COUNT of employees that got an infraction for that month. What I am looking to do is make it very easy for management to see the graph and then see the names that contributed to a large count for a month.
However, upon selecting a certain pivot chart cell (Lets say March had a LOT of infractions on the chart and we want to know who was a part of it). Upon double clicking the cell, it then brings up a "Show Detail" window, we select the cell Name since we want to know the names - however that doesn't help because it just puts the names as part of the legend and screws up the chart.
What are some ways to get it to display the names that contributed to the count for the month? I am thinking something along these lines:
-Upon mousing over the data point of the pivot chart, the tooltip is a list of the names
-Upon clicking on it, it displays a table at the bottom that shows the data from the table that contributed to that month (including names).
Anything along those lines. Any help is much appreciated, I do have experience with VBA - but sadly not in Excel yet.E
The best solution would be to check the PivotTable associated with the PivotChart.
When you show detail on the chart the change will be mirrored in the PivotTable.
For more information check out Overview of PivotTable and PivotChart reports # office.microsoft.com

load VBA data to line chart

I need to feed data into a line chart with VBA. I need to give a basic unidimensional range when I do it with Excel in a raw test. The thing is that now I need to hide some things in VBA code, so that the user just sees a curve resulting of some basic input at the click of a button.
I think there are at least two options for me :
either have the chart object placed in the Excel before, and having it point to some VBA snippet. In this case, should I somehow point to VBA from Excel ? Or would VBA access the chart area by some ID ?
create everything dynamically from VBA, the chart window, the chart, and the series input. This might be trickier to figure out maybe as I have frozen panes, so there would be the question of which pane is active (I'd like to avoid to have to do Selects to select the right one)
What would you recommend ? And in either case, how to actually do it ? What type of data to put in ?
Thank you so much !
I was involved in a project a couple of years ago that might be relevant.
A report was created monthly for the organisation's management board which contained dozens of charts. It was a near full time job for a statistician to collate and process data from across the organisation that provided the source data for these charts. I was asked to automate what could be automated.
It became clear that the appearance of the chart could not be automated. The statistician and the management board's staff held regular discussions and often agreed minor changes which they thought would better present the organisation's performance.
I could automate the collection of the data, its processing and placing of the results in the ranges from which the charts got their data. The most I ever did with a chart was change the size of a source range.
What would be the parameters that would control your macro's changes to a chart? How would your macro get the determine: type of chart, nature of the axes, text, etc?
Hope these thoughts help. I could look out my notes if my experience seems particularly relevant.

Excel 2003 Charting: Chart Data Too Complex

I have written a macro in excel 2007 to log water-level readings. Once logged, it automatically charts the data for each of the 30 wells. However, when the workbook is opened in Excel 2003, the chart does not work complaining that the chart data is too complex to be displayed (works fine in 2007).
There is one series per well (each well data is logged on a separate worksheet) and has the following formula (so that it will automatically update the chart):
=IF(COUNTA('DW1'!$D:$D)-3>0,OFFSET('DW1'!$D$6,1,0,COUNTA('DW1'!$D:$D)-3), 0)
Where DW1 is the worksheet name containing the data for well DW1.
Any ideas about what is going on? I am using the if statement so that the chart doesn't throw errors if there is no data for a well.
I am thinking that the formulas together exceed the limit of the Series data. Anyway to shorten this or change the formula?
In Excel 2003 and older versions, there is an unavoidable limit of 32,000 data points per series in a chart.
In order to display the chart, you need to reduce the number of data points. Either narrow the limits of the X-axis or use a filtering algorithm to remove some of the 'uninteresting' data points. You probably don't want to just decimate the data indiscriminately, as that may remove some of the highs and lows in the data series that are of interest.
Going to run individual charts for each PZ. Pretty sure I am hitting some kind of limit with the data series formulas, not the data points (as there are really not that many).
I do not have an answer to your question, sorry, but a workaround that might be useful.
I worked on a project about 10 years ago where we were exceeding Excel's data-point limit for charts. As much as I wanted to use Excel for the task, I couldn't get it to work.
I resorted to using Gnuplot for the charts. It was a hassle to introduce another technology, but it performed very well on the task.
Josh -
What's the series formula? What you've posted is a worksheet formula.
The 32k limit on points per series is the same in 2007 as in 97-2003.

Resources