gpt4 book ai didi

javascript - 谷歌图表栏,该列不显示小数

转载 作者:行者123 更新时间:2023-11-29 22:23:35 25 4
gpt4 key购买 nike

我有这段代码,它从我的 mysql 数据库中选择一些标记。

<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">

// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});

// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);

function drawChart() {

// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(<?=$jsonTable?>);
var options = {
title: 'Statisica note',
is3D: 'true', backgroundColor: "transparent",
width: 872,
height: 300,
min:0, vAxis: { gridlines: { count: 9 } },
max:10
};
// Instantiate and draw our chart, passing in some options.
// Do not forget to check your div ID
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);

一切进展顺利,但条形列上的数字并未显示为“1.22, 2.45”。我必须做什么?

图片:

Example

最佳答案

我做到了。

而不是:

$temp[] = array('v' => (int) $r['Nota']); 

我改变了:

$temp[] = array('v' => (float) $r['Nota']); 

关于javascript - 谷歌图表栏,该列不显示小数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30481916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com