13

I've tried using the built-in scatter plot chart and the Google scatter plot gadget. I haven't been able to figure out how to get either one to allow me to label the points in the chart. I have data like the following:

| Name1 | 36 | 1 | 
| Name2 | 22 | 3 |
| Name3 | 21 | 6 |
| Name4 |  4 | 2 |
| Name5 |  8 | 2 |

How do I label the point at (8,2) on the scatter plot as Name5, and so on?

0

Using a cell_object instead of just a value worked for me

var data = google.visualization.arrayToDataTable([
          [ {v: 36, f: 'Name1 - 36'}, 1],
          [ {v: 22, f: 'Name2 - 22'}, 3],
          [ {v: 21, f: 'Name3 - 21'}, 6],
          [ {v: 4, f: 'Name4 - 4'}, 2],
          [ {v: 8, f: 'Name5 - 8'}, 2]
        ]);
  • 2
    that's using the api, right? How would I do that within my google docs spreadsheet? – digitaljoel Sep 26 '12 at 13:50
  • 2
    Yes that is using the api. Using a google docs spreadsheet the only way I can work out how is by using a Bubble chart and formatting like you have in the questions – Glen Blanchard Sep 28 '12 at 1:09
  • 1
    The bubble chart is new since I asked this question. I was able to add it to my chart and it worked alright. Thanks for the pointer. – digitaljoel Oct 1 '12 at 16:06
15

Today's Google announced that now it's possible to add data labels.

For the data included in the question,

  1. Move the first column to the rightmost position.

     | A | B |  C   |
    -+---+---+------+
    1| 36|  1|Name1 |
    2| 22|  3|Name2 |
    3| 21|  6|Name3 |
    4|  4|  2|Name4 |
    5|  8|  2|Name5 |
    

    Note: Labels should be text. If the labels are numbers, dates, times, durations convert them to text. For this we could use TO_TEXT, TEXT, to add an ' as prefix or set the cell formatting to text.

  2. Then insert the chart and choose the scatter plot chart.

Example

NOTE: If you want to play with the example please make a copy instead to ask permission to edit it. To make a copy click on File > Make a copy.

  • 2
    This should be the correct answer. If it does not work for you right away you have to deselect and select the scatter plot in the overview. – Framester Dec 7 '15 at 19:15
  • Is there a way to only show labels for select points? – Dmitry B. Jan 8 '16 at 21:41
  • @DmitryB. That should be posted as a question. See How to Ask. – Rubén Jan 8 '16 at 23:20
  • 2
    Heads up! If the label column is numerical (as with house numbers), it needs to be changed into a string. Otherwise it will try to plot that data. – Daniel Bidulock Jan 12 '17 at 18:20
  • 1
    I'm trying the example (which looks great), but can not reproduce the results. I have tried selecting the data, then Insert -> Chart (which defaults to trying to give me a column chart). – James McLellan Dec 19 '18 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.