Extend horizontal line to edges of chart area - excel

In Excel 2007 I have a chart with a horizontal line (data series) similiar to what this page shows. But, as you notice, the line starts and ends in the middle of the data point. So, if there are bars on the same chart, the horizontal line will not extend to cover the entire first and last bars. How can I extend the horizontal line to touch the chart edges on the left and right sides?
I tried putting in "dummy" points at the beginning and end of the data series that had zero values (for the bars). This looked good, but the x-axis numbering started at zero and ended at one more than my last real data point, which, in my case is unacceptable.
Oh, and I'm creating the charts in VBA, so I need a VBA solution (which may be the same as the manual solution, just coded). Thanks.

If you right click on the horizontal axis and go into axis options. At the very bottom under Position Axis: select "On Tick Marks"

I answered a similar questions here:
Bar and Line charts are not synced when in the same chart area
In the above question the user needed to move the line to the left, but you can do a similar thing for your case.
Use scatter chart for your line chart. Then you need to set the xvalues of the scatter chart to be a bit different than the ones for your column chart. So let's say that your x-axis numbering goes from 1 to 12. Then you should distribute your xvalues for scatter chart from 0.8 to 12.2. That moves the starting point a bit to the left (0.8 instead of 1) and the last point a bit to the right (12.2 instead of 12). The exact number that you should use will depend on your gap and overlap settings of the column chart.

I eventually found an answer here. This worked great for me and did exactly what I needed.

Related

How To Make Line chart,so that the line chart does not overlap

Hi, I have trouble with my line chart here, the line chart is overlaping and it makes another line is not visible or covered up.
If the data is so similar then the lines will overlap.
One thing you can start with is using a false y-axis zero, starting the chart at, say, 50%, this may provide sufficient separation if the values do have differences.
Is this specific type of line chart necessary?
A 3D Line chart might get past the problem.
Image of a 3D chart with similar data in 2 series
If you want to stop similar/identical lines overlapping without changing their actual values, you're going to need to plot one of those lines on a different scale:
in the 'chart design' tab hit 'change chart type'
change it to 'combo chart', ad set both series as lines but in one of them, tick the box for 'plot on secondary axis'. Or, you could set one series as a different type of chart, e.g. a bar chart.
If both are lines and both axes default to the same scale (which is quite probable), you'll want to edit one of them to adjust the scale. Right click on a chart element and hit 'format', then select either 'vertical axis options' or 'secondary vertical axis options' from the dropdown, then click the fourth icon (little bar chart) and adjust the minimum and/or maximum bounds.
Hopefully that should separate the lines out without changing the values they actually depict. However, if it really comes to that, it might be easier to set them as two different charts. Certainly would make it easier to interpret the values.

Excel: Z-Order of Series in Chart and Legend

I have a combo chart in excel, with clustered bar charts (for a box plot) and lines. I am trying to display the bar charts/box plot in front of the lines, but am able to do so.
I tried moving the bar charts to the top and/or bottom in "select data" - but no change.
Any suggestions?
Am using Excel 2013.
Thanks!
I believe it is not possible. You can change display ordering of Excel series by:
changing the plot order of the series (this is what you have done in the "Select data" dialog),
changing the axis on which the series are displayed (series on secondary axis are displayed over the series on the primary axis).
But from my experiments no combination of changes makes the lines appear behind the columns.
There are two workarounds that might or might not help you:
you can create two charts on top of each other and put the chart with the lines behind the one with the columns,
or you could create a line chart (most likely you would need scatter chart), that is not a single line but a series of segments where the columns are not shown (this one is not that easy to do)
What are the lines for? If you are just trying to identify some zones along the value axis, you could instead use stacked areas, which would give a banded appearance. Areas are always drawn behind bars and columns, while lines are always drawn in front of lines and columns.

Excel chart with countries in y-axis, % in x-axis, circles as markers and control groups

Do you know if this chart, as shown in the following image, can be done in Excel?
Chart:
I don't even know how this kind of chart is named, so I cannot search in the web for tutorials. I don't need to display three points on every row as in this chart (one is enough), and even I can mark the control group manually.
Yes this can be done in Excel.
If you want vertical orientation like on the picture above, then you should probably use the Scatter chart with quite some modifications. You would set the x values of the series to your values and the y values can be just 1,2,3,4,5.... The biggest problem with this approach would be how to display the correct categories. There is a tool to help you do that and it is discussed here: https://superuser.com/questions/485883/how-to-create-dynamic-scatter-plot-matrix-with-labels-and-categories-on-both-axi
For horizontal one you can use a normal line chart - with hidden line and only markers visible (Excel doesn't support vertical line graphs).
Even three groups are easy to do, you just need to add three series and format them accordingly.
The lines are also quite easy to do, you add minor / major gridlines to the chart and then format those as well.

How to draw line X=1?

I know how to draw a line with scatter plot options where X is the independent and Y the dependent variable.
In the scatter plot of that data I need to add another line: X=2. I have the following data:
But how to draw a line X=1 ?
Maybe you want something like this:
I hear that charting is more different than many other aspects of Excel between versions and that perhaps my version (Excel 2007) is one of the least ‘friendly’ hence some of the reason for “not very easy” but the principle is as #Bill the Lizard has described. In view of some weird behaviour with (my?) Excel 2007 however I recommend being careful about the sequence in which the lines are drawn.
First I suggest getting your chart right for all aspects but the green line. Then add another series with X values of 1 and 1 and Y=2 values of 10 and -2 (or whatever the limits are of your chosen y-axis as displayed). Select and copy that array (four cells) select your chart and Paste Special…, and Add cells as New Series, Columns, Categories (X Values) in First Column, OK.
This should add a vertical line of the same chart type as the existing (ie XY (Scatter) Scatter with Straight Lines and Markers). The colour can be changed, by selecting that series (click on it and Format Data Series…, Line Color etc) and presumably you would want the markers removed. It was these that for me at first refused to disappear to order – but persistence paid off. Click on either of the data points, and under Marker Options choose none for Marker Type. If necessary, repeat for the other data point – and keep repeating if required!
Also, I selected what was showing as Series3 (text) in the legend and deleted that.
Forgot to mention that for anything to do with Excel charts Jon Peltier is the ultimate authority (eg) and that an alternative approach is to use an error bar and a secondary vertical axis.

Partially missing gridlines on log-scale charts in Excel 2007

I'm using Excel 2007 to create a log-scale chart of numbers (specifically the Zimbabwean dollar exchange rate) over time. I'm using an x-y scatterplot and noticing one odd quirk.
The range of y values (numbers) spans a factor of about 10^30. On every chart I make using this data, half the gridlines are missing. Specifically, only the gridlines corresponding to the largest values show up. In fact, regardless of the total range only the top factor of 10^13 or so have gridlines. This is not dependent on the log base.
Am I doing something wrong? Is this a known bug? I can't find any references to this issue on google or microsoft's bug reports.
Silly work around as well, but if you are going to be presenting your graph in Powerpoint, you can make the background color of the graph "no fill" and then when you paste it into Powerpoint (I paste it as a PDF). You can draw grid lines and match them up with the ticks on the y-axis. Arrange your graph "bring to front" when you are finished drawing so that the lines won't appear in front of your data. You can group it all to make sure the lines don't shift while making your presentation and so that they re-size properly if you re-size your graph.
I'm having the same problem, it's definitely a bug.
Try a sequence 1, 10, 100, 1e+12, 1e+30 vs 0..4 and plot x,y scatter, and clearly the scale grid is messed-up even in linear, and in log is the behaviour you described.
My workaround was to make a transformation of the values and depict them scaled down (by a Million factor). That way the data the graph is handling is never above 10e9 (the value I started to hit issues).
So, my suggestion is: graph a Log version of the data (and clearly make a legend for it)
I was able to replicate your problem and come up with a pseudo-workaround.
The formatting goes a bit funny, but all the lines show up if you right-click on the axis, select Format Axis. Under the Axis Options, there is a Horizontal Axis Crosses setting. Changing it from Automatic to Maximum Axis Value causes all the gridlines to appear.
Ran into same thing: Will not show log grid lines for y-axis ranging below 1e-7. Have need for dynamic range of 1e5 down to 1e-15. Tagging auto or max will show grid, but puts axis labels in non-useful place for display.
My workaround: used Open Office to get what I needed. Could not find useful solution in Excel 2010.

Resources