X and Y Axis not conforming to Min/Max value

662 views
Skip to first unread message

tnt...@yahoo.com

unread,
Feb 21, 2013, 11:31:09 AM2/21/13
to google-visua...@googlegroups.com
I am experiencing a problem where I want a defined set limit on my X and Y axis regardless of where the bubbles fall into the screen. 
I set limits but the grid does not seem to want to comply with the parameters. For instance, below I want a minimum value of 1.25 and a max for 4 on both the X and Y and have set the options as that... however when the chart is rendered it says my minimum is 0.8 (not 1.25). 

How do i get the minimum Y and X to be 1.25? Could it be that it really is set to this but just displaying the wrong number for some reason as a label? 
  My code is below. Thank you in advance!


    

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
          // Create and populate the data table.
          var data = google.visualization.arrayToDataTable([
            ['ID', 'X', 'Y', 'LABEL',                 'SIZE'],
            ['85',    2.39,              1.94,          '85',                     720.1],
            ['118',   2.14,              1.53,          '118',                  136.436],
            ['34',    2.26,               2.60,          '34',                    1669.49],
            ['142',   2.09,              2.33,          '142',                   183.121],
            ['143',   2.41,              1.53,             '143',                119.614],
            ['147',   2.44,              2.00,           '147',                   177.838],
            ['122',   2.53,              1.63,          '122',                    159.944],
            ['58',    2.29,              2.38,          '58',                      2893.088],
            ['64',    2.28,               1.47,          '64',                      2.155]
          ]);
      
      
      
          // Create and draw the visualization.
          var chart = new google.visualization.BubbleChart(
              document.getElementById('visualization'));

          chart.draw(data, {
 
 sizeAxis:{maxSize:'1'},
sizeAxis:{minSize:'1'},
  hAxis: {
                maxValue: 4,
                minValue: 1.25,
gridlines: {color: '#1E4D6B'},
//gridlines: {count: '0'},
            },
            vAxis: {
                maxValue: 4,
                minValue: 1.25,
gridlines: {color: '#1E4D6B'},
//gridlines: {count: '0'},
            }
 });
      }
      

      google.setOnLoadCallback(drawVisualization);
    </script>
    </p>
    <div id="visualization" style="width: 800px; height: 600px;"></div>

</body>
</html>

asgallant

unread,
Feb 21, 2013, 11:45:19 AM2/21/13
to google-visua...@googlegroups.com
Use the h/vAxis.viewWindow.min/max options:

hAxis: {
    viewWindow: {
        max: 4,
        min: 1.25
    },
    gridlines: {color: '#1E4D6B'}
    //gridlines: {count: '0'},
},
vAxis: {
    viewWindow: {
        max: 4,
        min: 1.25
    },
    gridlines: {color: '#1E4D6B'}
    //gridlines: {count: '0'},
}
Reply all
Reply to author
Forward
0 new messages