Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:43:36+00:00 2026-06-18T12:43:36+00:00

I’m trying to have the x-axis on my Bubble chart display its label values

  • 0

I’m trying to have the x-axis on my Bubble chart display its label values in quarters such as “Q1 FY13”, similiar to the charts axis as shown:

Quarter demo

In the API they mentioned using a domain column in the datatable as the role where you could then specify a string such as ‘Q1/09’ (https://developers.google.com/chart/interactive/docs/roles),

role:  domain,   data,       data,   domain,   data,     data
      'Q1/09',   1000,        400,  'Q1/08',    800,      300

But from what I can tell this seems to be restricted by the type of chart you use, and bubble charts first column has to be a number.

This is a picture of what I have currently, using quarters as the axis, but alas you can’t tell what year you’re looking at…

enter image description here

So does anyone know if this possible? If not, is there another workaround I could do to show these labels?

UPDATE:

While the workarounds on the accepted answer should work, here is an answer from google groups that shows how to format the labels as Quarters:

https://groups.google.com/forum/#!topic/google-visualization-api/_qk7DkPmKxU

You can format the axis labels as quarters if you use a “date” axis (support for date axes is not listed in the documentation, but it works): http://jsfiddle.net/asgallant/m5bsr/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:43:38+00:00Added an answer on June 18, 2026 at 12:43 pm

    There are two ways to do this. You can not display the X-axis labels, and then add another div right below it displaying the axis categories (using a line chart, for instance).

    The second chart would have no data at all in it. An example can be found here:

      function drawVisualization() {
        // Create and populate the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('number', 'x');
        data.addColumn('number', 'Cats');
        data.addColumn('number', 'Blanket 1');
        // This dummy series is to extend the chart from 0-5 for padding
        data.addColumn('number', null);
        data.addRows([
          [{v: 1, f:'A'}, 1, 10, null],
          [{v: 2, f:'B'}, 2, 5, null],
          [{v: 3, f:'C'}, 4, 12, null],
          [{v: 4, f:'D'}, 8, 5, null],
          [{v: 5, f:''}, null, null, {v: 0, f:''}]
        ]);
    
        options = {
          curveType: 'function',
          lineWidth: 2,
          hAxis: {
            // Show a baseline at 0
            baseline: 0,
            // 6 Gridlines, 4 labels + left and right for padding
            gridlines: {
              count: 6
            },
            // Hide our labels
            textPosition: 'none'
          },
          vAxis: {
            baseline: 0,
          },
          series: [
            {},
            {},
            // Hide our dummy series
            {
              lineWidth: 0,
              pointsize: 0,
              visibleInLegend: false
            },
          ]
        };
    
        // Add dummy data for the axis labels
        var data2 = new google.visualization.DataTable();
        data2.addColumn('string', 'x');
        data2.addColumn('number', 'dummy');
        data2.addRows([
          ['A', null],
          ['B', null],
          ['C', null],
          ['D', null]
        ]);
    
        chart1 = new google.visualization.LineChart(document.getElementById('visualization'));
        chart1.draw(data, options);
    
        chart2 = new google.visualization.LineChart(document.getElementById('visualization2'));
        chart2.draw(data2,
                    {
                      chartArea: {
                        top:0,
                        height:"0%"
                      },
                      min: 0,
                      max: 0,
                      hAxis: {
                        baselineColor: '#FFFFFF'
                      },
                      vAxis: {
                        baselineColor: '#FFFFFF',
                        direction: -1,
                        textPosition: 'none',
                        gridlines: {
                          color: '#FFFFFF'
                        }
                      }
                    });
      }
    

    This works, but is a bit annoying since you have to work with two separate charts and it is counter-intuitive for anyone who doesn’t know what you’re doing to figure out the code.

    So jeffery_the_wind came up with an awesome solution that uses jquery to hack the SVG for the axis labels. The trick is to align the axis labels with position: in and then to use javascript to loop through the svg looking for properly aligned text elements, and changing their values with the contents of an array. Here is a sample of the code he used:

    /*
     *
     * The following 2 functions are a little hacky, they have to be done after calling the "draw" function
     * The bubble chart originally displays only numbers along the x and y axes instead of customer or product names
     * These 2 functions replace those numbers with the words for the customers and products
     *
     */
    for ( var i = -2; i < products.length + 1; i ++ ){
        $('#customer_product_grid svg text[text-anchor="start"]:contains("'+i+'")').text(function(j,t){
            if (t == i){
                if (i >= products.length || i < 0){
                    return " ";
                }
                return products[i];
            }
        });
    }
    
    for ( var i = -2; i <= customers.length + 3; i ++ ){
        $('#customer_product_grid svg text[text-anchor="end"]:contains("'+i+'")').text(function(j,t){
            if (i >= customers.length + 1 || i <= 0){
                return " ";
            }else if (t == i){                    
                return customers[i-1];
            }
        });
    }
    

    This version is quite awesome, and a bit better for usability. It does, however, have issues if you want to add other text to the chart/align things in certain ways.

    Pick your poison!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.