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 8615671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:26:12+00:00 2026-06-12T05:26:12+00:00

Does anybody please have an idea how to center-align the new (i.e. svg-based) Google

  • 0

Does anybody please have an idea how to center-align the new (i.e. svg-based) Google Charts?

When I inspect the chart elements at my web page (please scroll down to the jQuery Tabs with several Google Charts at that page), I see that the chart itself is given an absolute position:

<div style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; ">
<svg width="800" height="500" style="overflow: hidden; ">

I’m not sure why Google does it, but it breaks my layout (other than that the charts work well for me):

enter image description here

My CSS-code:

    h1,h2,h3,p,div,form { 
    text-align: center; 
}

And I’ve also tried adding there:

    margin-left: auto; 
    margin-right: auto; 

My JavaScript-code:

var money_data;
var money_chart;
var money_options = {
        width: 800,
        height: 500,
        legend: {position: 'top'},
        areaOpacity: 1.0,
        vAxis: {format: '# $'},
        hAxis: {title: 'Номер недели', titleTextStyle: {color: 'blue'}, slantedText: true, viewWindow: {min: 39, max: 52}},
        colors: ['CCFFCC', '66CC66', 'FF9999'],
        animation: {duration: 1000, easing: 'out'}
};

function initMoney() {
        $.ajax({
                url: '/money-json.php',
                data: { id: 'OK408547485023' },
                dataType: 'json'
        }).done(function(jsonData) {
                money_data = new google.visualization.DataTable(jsonData);
                money_chart = new google.visualization.SteppedAreaChart(document.getElementById('money_chart'));
                google.visualization.events.addListener(money_chart, 'ready', function() {
                        $('#money_slider').slider('enable');
                });
                drawMoney();
        });
}

function drawMoney() {
        money_chart.draw(money_data, money_options);
}

If no CSS-based solution possible here, could I maybe use JavaScript to move the SVG to the same x-position as the money_slider while enabling the latter (please see the above code)?

  • 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-12T05:26:14+00:00Added an answer on June 12, 2026 at 5:26 am

    You could set the size of money_chart DIV to the size of the graph ( I am guessing 800px ) and use auto margins like this.

    #money_chart{
        margin-left: auto;
        margin-right: auto;
        width: 800px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody please have an idea, why do I get the runtime error: RangeError:
Does anybody have any idea why I am getting this error when I try
Does anybody have any idea why this doesn't work? $(document).ready(function() { var loading; var
Does anybody have any idea on how to prevent a spinners OnItemSelectedListener being fired
Does anybody have any idea how to print an excel file programatically using C#
Does anybody try zf2? I can not understand new mechanism of using sessions in
Does anybody have a reference to what the various path names mean on different
Does anybody have a suggestion to use Admob's iOS ads without using the iPhone
First I am new in the forum so please have a little bit patience
Does anybody know how I can get the number of the elements (rows*cols) returned

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.