What you probably need is a function that picks gets the min/max values
from your data and sets the min/max values for the chart axes based on
those. This will group your data to get the values you need:
var minmax = google.visualization.data.group(data, [{
column: 0,
type: 'number',
modifier: function () {
// return the same value for all rows
return 0;
}
}], [{
column: 1,
type: 'number',
label: 'X min',
aggregation: google.visualization.data.min
}, {
column: 1,
type: 'number',
label: 'X max',
aggregation: google.visualization.data.max
}, {
column: 2,
type: 'number',
label: 'Y min',
aggregation: google.visualization.data.min
}, {
column: 2,
type: 'number',
label: 'Y max',
aggregation: google.visualization.data.max
}]);
// get the values from min/max and modify (make mins smaller and maxes
larger) to fit the data in your chart
On Tuesday, September 18, 2012 3:17:58 PM UTC-4, Max wrote:
>
> Hi
>
> Thanks a lot for the advise.
>
> This specific chart looks OK with 6 lines in the grid.
> However, different charts look bad (just like I showed) with numbers
> different than 5.
> See attached example of the same chart with 8 grid lines.
>
> Is there any workaround applicable, without adjusting number of lines to
> the specific data?
>
> Thanks
> Max
>
> On Thursday, September 13, 2012 1:35:52 AM UTC+3, asgallant wrote:
>>
>> This seems to be an odd coincidence that only occurs when the values used
>> for the data elements on the outer "edges" of the chart fall within certain
>> parameters. The API attempts to draw the axes such that gridlines will
>> fall on "clean" values, and it just so happens that with the particular
>> values in your chart, the API determined that one of the clean boundaries
>> needed to be exactly the same as one of the data points (this actually
>> happened twice in your chart, once for each axis). If you change the
>> number of gridlines, you change the formula for determining the clean
>> values, and can avoid the problem. Try setting the gridlines.count
>> sub-option for both hAxis and vAxis to something other than 5.
>>
>> On Wednesday, September 12, 2012 4:10:55 PM UTC-4, Max wrote:
>>>
>>> Hi,
>>>
>>> This is my code.
>>>
>>> Thanks for your kindly support.
>>>
>>> Max
>>>
>>>
>>> function(data)
>>> {
>>>
>>> var datatable = new
>>> google.visualization.DataTable(data.datatable);
>>>
>>> var mycolors = (data.colors).split(",");
>>>
>>> var chart = new
>>> google.visualization.BubbleChart(document.getElementById('product-performance-chart'));
>>>
>>> chart.draw(datatable, {
>>>
>>> title : data.title,
>>> colors: mycolors,
>>> hAxis: {viewWindowMode: 'pretty', title: '1-year
>>> performance', titleTextStyle: {fontSize: 14}},
>>> vAxis: {viewWindowMode: 'pretty', title: 'INBEST Rate',
>>> titleTextStyle: {fontSize: 14}},
>>> titleTextStyle: {fontSize: 14},
>>> height: 600,
>>> fontSize: 20,
>>> legend:{position: 'none'},
>>> backgroundColor: '${chartBackgroundColor}'
>>> });
>>>
>>>
>>> }
>>>
>>> On Tuesday, September 11, 2012 6:41:49 PM UTC+3, asgallant wrote:
>>>>
>>>> "pretty" should be the default unless the viewWindow option is not
>>>> null, and it works for everything I've seen. If you post your code or a
>>>> link to the page I'll take a look and see what might be going on.
>>>>
>>>> On Tuesday, September 11, 2012 5:49:48 AM UTC-4, Max wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I need to create a simple bubble chart, all the bubbles should be of
>>>>> the same size and color (product requirement), be numbered 1...N and
>>>>> represent (X, Y)
>>>>>
>>>>> *I see some bubbles being cut by the axes (see attached).*
>>>>>
>>>>> I am using
>>>>> viewWindowMode: 'pretty'
>>>>> for both hAxis adn vAxis
>>>>>
>>>>> Is there any way to prevent this behavior, better than manual
>>>>> calculation of the min/max for each axis?
>>>>>
>>>>>
>>>>> Thanks for any hint.
>>>>> Max
>>>>>
>>>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/DbpUWbv2jlwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.