Display simulated data in chart - excel

I am wondering how I could chart the following data in a line chart in Excel:
In the chart below, 20 simulated data points NAV mo+1 are 20 possible values in the first month in the future (mo+1). The next set represents 20 simulated NAVs in the second month (mo+2).
The chart should look something like the one below:
Problem is my charts end up looking more like this:
Thanks for any input!

There are default structures for each chart as defined by Microsoft:
http://office.microsoft.com/en-us/excel-help/select-data-for-a-chart-HA102809318.aspx
However this is not necessarily sufficient. Sometimes you better edit the data source and its mapping manually. This is described here:
http://www.dummies.com/how-to/content/how-to-edit-a-charts-data-source-in-excel-2010.html

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)

Stacked and Clustered Columns Excel

I am trying to recreate the below chart in excel:
Below is the data I am using, it is the same data used to generate the chart.
I can't seem to get the desired output, the data stacks but does not separate into the asset classes as expected, an example of which is below:
Thank you for the help in advance.
This is the box & whisker version of your chart, with some minor editing after the conversion...

Adding new data series changes Excel 2016 chart format

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.

How to print all the chart properties in Python-pptx

I have a existing chart in pptx file, i just want to update its values on daily basis, these charts are already plotted from excel and paste into pptx, i just want to modify the charts ,
but i don't know how many properties are there in charts like series, category and title properties.
i am able to print the chart series and category data, but when i modify these with chart.replace_data(chart_data)
i am getting error like below
return self._chart_part.related_parts[xlsx_part_rId]
KeyError: 'rId4'
I ma using below code to print the values ,
for series in chart.plots:
for i in series.categories:
cat_list.append(i)
for series in chart.series:
for value in series.values:
ser_list.append(value)
the graph looks like below
How can i modify such graphs with updated values which i will be passing from excel to pptx.
I suspect the problem is rooted in the "pasting from Excel" step.
One thing you can try is to right-click on the chart and choose "Edit values in Excel". If that doesn't work for any reason, that would explain the error you're seeing. If it does work, try saving and run the python-pptx code against the saved version.
An alternative, perhaps more reliable fix would be to recreate the chart natively in PowerPoint, starting from adding a new column-chart and adjusting it until you get what you see here. Then you should be able to update it daily with pretty much the code you mentioned (although your ser_list variable will accumulate values for all series in the chart if there is more than one).
To understand why this could be happening, it's important to observe that a chart does not have to have an Excel worksheet "behind" it. It can, and perhaps does in this pasting case, simply have fixed literal values that are embedded in the chart XML itself. The up-side of this is the pasting operation doesn't need to create a whole Excel spreadsheet, which might be tricky in a cut-and-paste context. The down-side is the values can't be conveniently changed using the standard methods.
I haven't tried working with one of those lately so I don't know if editing and saving the data adds a new Excel object created from the embedded values or not, but this might explain the behavior you're seeing.

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

Resources