Add reference line to category

I have a two-column table I'm using to make a line chart: Date and Value. I'd like to apply an annotation to the chart at a particular date. This would be similar to the Reference Lines described in this help document except applied to the Category (X, not Y).


Numbers doesn't seem to directly support this with any options in the axis formatting, but does anyone have any tricks for doing this? Maybe with a third column in the table, and annotations at the particular date? I can't figure out how I'd chart that column, but it seems like a starting point.



MacBook Pro 15", macOS 10.14

Posted on Jul 4, 2019 8:05 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 5, 2019 1:15 AM

Matthew Pounsett wrote:

when the table gets appended to, the chart will resize and the line will no longer be in the right place. I'm looking for something that is part of the chart itself, not a manual addition.


Have you considered using an error bar to create the vertical line? It will stay in position, though I don't think there is a way to attach a label to it the way you can with reference lines.



You create your 2D Scatter as usual. Add an extra series for the vertical line and enter a value at the desired date. The value you enter should be in the middle of the range for your y-axis values (though it doesn't have to be the "exact" middle because you'll use 100% later).


After inserting chart, click the first series and add a connection line here (and remove the data marker if desired).





Click the second series (the one with the single value) and add Positive and Negative Y Axis Error Bars.




Choose "Percentage" and change range to to 100:





Remove the single point on the vertical line and remove the Data Symbol here:





And click the line (error bar) and remove the ends by selecting the 'Bar Style' here:




Pretty up the axes, etc, as desired until you have the chart looking the way you want.


SG

Similar questions

6 replies
Question marked as Top-ranking reply

Jul 5, 2019 1:15 AM in response to Matthew Pounsett

Matthew Pounsett wrote:

when the table gets appended to, the chart will resize and the line will no longer be in the right place. I'm looking for something that is part of the chart itself, not a manual addition.


Have you considered using an error bar to create the vertical line? It will stay in position, though I don't think there is a way to attach a label to it the way you can with reference lines.



You create your 2D Scatter as usual. Add an extra series for the vertical line and enter a value at the desired date. The value you enter should be in the middle of the range for your y-axis values (though it doesn't have to be the "exact" middle because you'll use 100% later).


After inserting chart, click the first series and add a connection line here (and remove the data marker if desired).





Click the second series (the one with the single value) and add Positive and Negative Y Axis Error Bars.




Choose "Percentage" and change range to to 100:





Remove the single point on the vertical line and remove the Data Symbol here:





And click the line (error bar) and remove the ends by selecting the 'Bar Style' here:




Pretty up the axes, etc, as desired until you have the chart looking the way you want.


SG

Jul 4, 2019 2:03 PM in response to Matthew Pounsett

Hi Matthew,


All of the reference lines described in the article reference specific "values", implying they do not apply to "categories".


Your "Line Chart" is a Category chart, on which each date is a category, not a value..


You might try an x/y Scatter Chart (with connecting lines between data points) in place of the Line Chart. Both x and y axes are Value axes in a Scatter Chart, and I notice the Scatter Chart is not on the list of types that cannot use reference lines.


Or, using a Category chart, you could simply add a line (from the Shapes button), rotate it to vertical, position it where you want the reference line, and label it using a text box.


Regards,

Barry

Jul 4, 2019 2:28 PM in response to Barry

Barry wrote:

All of the reference lines described in the article reference specific "values", implying they do not apply to "categories".

Right. That's why I was asking if anyone knows a way to do something similar with categories.

Your "Line Chart" is a Category chart, on which each date is a category, not a value..

Yes, that's right.

You might try an x/y Scatter Chart (with connecting lines between data points) in place of the Line Chart. Both x and y axes are Value axes in a Scatter Chart, and I notice the Scatter Chart is not on the list of types that cannot use reference lines.

Unfortunately, no. Scatter doesn't seem to understand what to do with a header column of type Date. It just draws a scatter chart where both X and Y are the Values column. Forcing the "Y Value" to the Date column changes both X and Y.

Or, using a Category chart, you could simply add a line (from the Shapes button), rotate it to vertical, position it where you want the reference line, and label it using a text box.

That doesn't work well since, when the table gets appended to, the chart will resize and the line will no longer be in the right place. I'm looking for something that is part of the chart itself, not a manual addition.

Jul 4, 2019 10:57 PM in response to Matthew Pounsett

Hi Matthew,


I can't find a way to add a reference line to a category. Following on from Barry's suggestion of a scatter plot:


Scatter doesn't seem to understand what to do with a header column of type Date.

A scatter plot requires both X and Y values to be in body cells. The column labels should be in a header row.

Table 1 above has no header column and one header row.


Regards,

Ian.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Add reference line to category

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.