Excel Dual Y Axis (one on top of the other) - excel

I am wanting to create a line graph with the same variables, but two different machines. There are 16 total variables so overlapping 16 lines would look so messy. I don't want the user to have to copy and paste two charts at the end of each week to email, so I am wondering if it would be possible to create a chart like the one attached. Any help is awesome, thank you!

Yes, but it may not be as pretty as you want. Just assign half the series to the secondary axis, then change the display ranges for the two axes. Here is how you figure out what to set them to.
Axis 1 minimum = Actual Data Minimum - Actual Data Maximum
Axis 1 maximum = Actual Data Maximum
Axis 2 Minimum = actual data minimum
Axis 2 maximum = Actual data maximum * 2
Since you have percentages in your example, this would be:
Primary axis minimum = -100%, maximum = 100%
Secondary axis minimum = 0%, maximum = 200%
Then you can play around with where the labels display etc to try to clean it up, but it won't look nearly as good as 2 charts (which you have ruled out).

Related

Plotting of multiple graphs on a single tablet screen

I m designing an application that is suppose to plot multiple graphs for sensor data on a single tablet screen.All the graphs shall have common x-axis that displays time(1 sec to 2 mins) but y axis data for all the plots is different. I was able to successfully plot all the graphs but not sure how to display a common x- axis for the graphs? Has anyone tried doing this?
You can definitely display multiple plots (each containing it's own graph space) with identical domain (xAxis) labeling. The key to doing this is constraining each plot's boundaries in the same way.
Let's say that for the sake of this example your series data uses a time offset in milliseconds as it's x values. For 1 second that gives us:
xMin = 1000 (1 second)
xMax = 120000 (2 minutes)
which translates to:
plot.setDomainBoundaries(1000, 12000, BoundaryMode.FIXED);
If you're using real timestamps instead of offsets, the same principle applies. You'll just have to decide what the starting timestamp should be and then calculate the ending timestamp by adding 120000 to it.

Envelope plot in excel

I am trying to plot the envelope (maximum) values of a series of data. What I need is not the maximum value of the y-axis as the value of x-axis increase but an envelope or spectrum which joins only the maximum points as the values of x-axis increase.
My data look like:
If I ask for the maximum y-values as the values of the x-axis increase, I will get this one (the black line is the maximum of all data as x is asceding):
But I need a line which joins only the next maximum points till x=30 and then the maximum values, which descend (from x=30 to x=100). The curve I need should be smooth and not follow the values of the data but only join the next maximum.
The next curve is the envelope but only after the absolute maximum point. At the left of the absolute maximum point the envelope is not the wished one:
After posting my questions (as comments), I think the following will do what you want (here I'm assuming I understood what you need):
1) At any point along the X axis, you already know how to recognize a maximum,
2) If (1) is correct, you will take into account a maximum (i.e. make it part of the envelope curve) if and only if:
a) All the points to the right are lower than the current maximum, and/or
b) All the points to the left are lower than the current maximum.
Intuitively, this should work.
EDIT:
Assuming that data is arranged in columns, say between B and D and rows 10 to 100, define in cell E10 the following:
=IF(AND(MAX(B10,D10)>MAX(B9:D9),AND(MAX(B10,D10)>MAX(B11:D11)),MAX(B10,D10),"")
This formula will result into a value if you have a local maximum in rows 11 to 99 or blanks otherwise. Then, drag the formula till row 100 and voilĂ !!!
Note that the first and last point (i.e. rows 10 and 100) might yield a wrong result though. To prevent that, just alter the formula in those two rows.
Hope this is what you were looking for.

Dynamic Milestone Trend Analysis Graph needs same y-axis as x-axis in Excel with VBA

After a couple hours of work I come to you guys with this graphing problem. I need to create a Milestone-Trend-Analysis which can be seen on the german wikipedia , though not in the english version.
General Information
In short, the diagram has report dates on the x-axis (for now, on every first of the month, another report is due).
The y-axis should mirror the x-axis completely. In length and also the tickmarks. The dates get bigger from the bottom to the top.
In my case the x-Axis is on top of the diagram.
Every report consists of a number of "due-dates", one for each assignement in progress. They are the estimated "finishing dates" of that particular assignement.
If the estimated finishing date stays the same in the next report period, the graph for that assignement stays on the same level. If the estimate is earlier, the graph trends down. Normally they go up, since the assignement has some delay :-D
The x-axis needs to be dynamic, since the whole project is basically finished when its last assignement is finished. If one of the assignements is running late, the whole project gets delayed an thus the x-axis needs to be longer/get more ticks.
Since the y-Axis mirrors that, it has to change too.
MY PROBLEM
The x-axis has a number of discreet values, since the reports come in every month, or every two weeks. But that does not change.
The values for the finishing dates are continuous, since the assignements can be terminated whenever.
That leaves me with the problem of having to cut the y-axis in equal-size chunks, although the months of the year are not equal in size. At least that is, what I think excel forces me to do.
I can assign a max limit and a min limit for the y-axis and I can assign a distance between each main tickmark. Since Excel works with a continous number for each date, the 2014/01/01 would be 41640. And 2015/01/01 is 42005. Since I have 12 month on the x-axis and I need 12 on the y axis, I would have to have the main Ticks at a distance of 30.42 ... which gives me the following Months on my axis
January January March .... December December
Does anyone know an answer for this? Is there a way to have excel make the tickmarks on the y-axis not equal distance?
Any input greatly appreciated.
Kaz
I did not find a way to make Excel have variable tick mark distances. But since I coud not have it that way, I had to make the month equally long.
This works for me now:
'calculate the norm for different type of month including Schaltjahr
Select Case cellMonth
'February
Case 2
'Schaltjahr and Schaltjahrhundert
If (cellYear Mod 4 = 0) Or (cellYear Mod 400 = 0) Then
resultDay = (30 / 29) * cellDay
Else
resultDay = (30 / 28) * cellDay
End If
'31 day months
Case 1, 3, 5, 7, 8, 10, 12
resultDay = (30 / 31) * cellDay
'30 day months
Case Else
resultDay = cellDay
End Select
Now I just have to scale the axis to numberOfMonths * 30. It now leaves adjusting the names of the y-Axis, which seems to be a whole different story.
Kaz
You can put arbitrary labels along the Y axis by adding a dummy XY series.
Here is some data that I think captures your issue, plus a line chart showing the data, plus the data that I'll use to construct a dummy Y axis.
I used a line chart so the X axis at least would be easy. You just have to make sure that the axis is formatted as a date axis with Base Unit of Days.
Here is how I built the axis.
Top Left Chart Below: I copied the dummy axis data, both columns of the data includingt the header row. I selected the chart, and used Paste Special to add the data as a new series, data in columns, series names in first row, categories in first column (but don't replace existing categories).
Top Right Chart Below: I right-clicked on the added series, clicked on Change Series Chart Type, and selected XY Scatter with Lines and Markers. Excel also put this series onto the secondary axes.
Middle Left Chart Below: I formatted the added series to be plotted on the Primary axis.
Middle Right Chart Below: I changed the scale of the vertical axis, giving it a minimum of the first date and a maximum of the last (1/1/16 to 9/1/16).
Bottom Left Chart Below: I formatted the vertical axis to show no labels.
Bottom Right Chart Below: Format format format. I formatted the dummy axis series so it used light gary lines (matching the horizontal axis) and light gray cross markers (simulating tickmarks). I changed the tickmarks of the horizontal axis so they crossed the axis, matching the cross markers of the dummy series. I added data labels to the left of the dummy series points, simulating vertical axis labels.

Excel Chart doesn't keep format

I have a table (came from a pivot table) where I have formatted the column 4 cells to show 1 billion as 1. But when I select the table and insert a chart, I am getting my units in millions. So the 14.8 billion number for Mexico is showing up as 14,800 on the chart. Why might this be happening and how can I fix this? This is also making all my other bars negligibly small. Note that the first three columns are not in billions and are totally different things. Some are percentages, some are other small numbers.
Table:
Chart:
You need a secondary horizontal axis and some formatting on the Axes.
In Excel 2013
First change the Chart Type to Combo and select Clustered Bar for both sets of data, then Check
Secondary Axis for the Percentage Series.
Then set up the axis limits so they match, e.g.
Percentage: min -.5 max 2
Billions: min -5e9 max 20e9
Then set the percentage format on the source data to a custom Number format of "";(0)%;0%
Then set the Billions format as 0,,,;"";0
You will get something like this:
EDIT
Now that we have the general principles, we can apply them to your specific data.
I will also switch to Excel 2010 do show the different menus.
The data selection looks like this
Select the non-Billion series (plural!) and check the secondary axis
If the larger data is always positive then you can use custom formatting to clean up the axis
Align the primary and secondary axes so that the grid lines match on both
The end result is clean and readable.
Mixing percentages and numbers for the smaller numbers is not handled by this but I would suggest that that would be confusing anyway?
The simplest way to fix this might be to plot cells containing the billions values divided by 10^9 rather than to plot the billions themselves, though via a secondary axis may be possible.
Using Excel 2007. For the purple bars, the example on the left uses ColumnE values, on the right ColumnF values. E1 contains =F1/10^9 and F1 contains =14800000000:
It appears that there are 3 questions here: 1) "Why might this be happening", 2) "how can I fix this", and 3) something like "how can I plot data which lie on two widely differing ranges, and make them all reasonably visible anyway", even if there was no explicit question on this.
There are several ways to solve issue #2 about the units (e.g., billions) and numbers (e.g., 14.8 vs. 14,800.0) shown in the axis, each one with its own pros and cons:
Use Format Axis -> Axis Options -> Display units.
This might be the answer to your issue #1 as well, you might have the following selection: Display units -> Millions, and unchecked Show display units... Otherwise, I wouldn't know why you chart shows what it shows.
Use faked tick marks, as indicated in the (excellent) site of Jon Peltier
http://peltiertech.com/Excel/Charts/ArbitraryAxis.html
It gives detailed instructions on how to create tick marks on an axis with arbitrary labels (which may be text, numbers, etc.), which is more generic than what the OP wants here. In this particular case, the labels will be the desired numbers.
Create new cells containing data that would be plotted exactly the way you want.
As for your issue #3, I guess the only option is to have a Secondary Axis (see the answer by pnuts).
Thus, to come up with the best final chart for you might use a combination of one of the options I gave here and a secondary axis.

Excel chart: on/off values with timestamp

I have 3 columns of data, eg:
http://i.stack.imgur.com/XjGmu.jpg
When Excel creates a line graph of this, the blue line is what i get.
This is not correct because the time stamp shows the time when something is switched on (255) or off (0) (could also be the current state eg 16:08). So I'd like a graph like this - see the red line (with a time-based X axis off course):
http://i.stack.imgur.com/vNvPk.jpg
Anyone can help? Thanks
As #Jon49 indicated, you need to plot additional data points--two y values for each x value: one to plot the point at y=255 and one to plot y=0.
If the time-span of the data is at least a few days, you can use a line chart. But in your case since the values are within a day, the scatter chart with straight lines is the only option due to the limitations of the scale units for line charts.
The key is the values need to be in the correct order. Each y=255 value needs to be followed by the next time-stamp's 255 value followed by it's 0 value, followed by the next time-stamp's 0 value:
Excel doesn't support this type of discrete value graph (at least not excel 2k3 that I am using); your best bet is to use a bar graph and then go into the settings and set the gap width down to zero.
Not sure what the best way is but I would automate what I describe below on how to do (unless this is a one time deal, then just brute force it):
Separate the 255s from the 0s. Make sure for every 0 time there is a corresponding 255 time. Take the zero times and put in a scatter plot then add a y-error bar and make the fixed value equal to 255. Format to how you like it.
Now for the 255s. Add those to the chart by pairs. Make the chart type for these pairs scatter plot with a line. Format how you would like them to look.
Let me know if that doesn't make sense to you.

Resources