Reputation: 55
displayExactValues option doesn't work for me and formatter as well, looks like I'm on the wrong path. Any help? Here's my code:
<script type="text/javascript" src="http://www.google.com/jsapi?ext.js"></script>
<div id="chart_div_9reg"></div>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['line']});
google.setOnLoadCallback(drawCurveTypes);
function drawCurveTypes(){
var data = new google.visualization.DataTable();
data.addColumn('string', 'test');
data.addColumn('number', 'products');
data.addRows([
['2', 12721],
['4', 1621],
['5', 12221],
['6', 12231],
['7', 12221],
]);
var options = {
height: 400,
height: 600,
};
var chart = new google.charts.Line(document.getElementById('chart_div_9reg'));
chart.draw(data, options);
}
</script>
Upvotes: 1
Views: 216
Reputation: 2746
You should add the format to the var options
.
Change your options
the following way:
var options = {
height: 400,
height: 600,
axes: {
y: {
all: {
format: {
pattern: 'decimal'
}
}
}
}
};
You can control the formatting of label numbers with hAxis.format
and vAxis.format
. For instance, {hAxis: { format:'#,###%'} }
displays the values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5. You can also supply any of the following presets:
{format: 'none'}
: displays numbers with no formatting (e.g.,
8000000){format: 'decimal'}
: displays numbers with thousands
separators (e.g., 8,000,000) {format: 'scientific'}
: displays
numbers in scientific notation (e.g., 8e6){format: 'currency'}
:
displays numbers in the local currency (e.g., $8,000,000.00){format: 'percent'}
: displays numbers as percentages (e.g.,
800,000,000%) {format: 'short'}
: displays abbreviated numbers
(e.g., 8M) {format: 'long'}
: displays numbers as full words (e.g.,
8 million)Upvotes: 1
Reputation: 55
problem solved!
var options = {
height: 400,
height: 600,
axes: {
y: {
all: {
format: {
pattern: 'decimal'
}
}
}
},
};
Upvotes: 0