首页 > 解决方案 > 谷歌折线图添加货币符号

问题描述

是否可以在谷歌折线图中添加货币符号?

这是我的代码。

<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {
var data = google.visualization.arrayToDataTable([
  ['Month','Running'],
  <?php
    for($month=$fromdv;$month<=$todv;$month++){
        $monthv = date('M',strtotime($year[0].'-'.$month.'-1'));
        $fd = date('Y-m-d',strtotime($year[0].'-'.$month.'-1'));
        $td = date('Y-m-t',strtotime($fd));
        $running = get_running($team,$fd,$td,'alldevice','overall');
        echo "['".$monthv."',".$running."],";
    }
    ?>
]);

var options = {
  title: 'MOBILE APP SALES',
  curveType: 'none',
  legend: { position: 'bottom' }
};

var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));

chart.draw(data, options);
}
</script>

这是结果

在此处输入图像描述

我想在值中添加美元符号。

谢谢

标签: phpjsongoogle-visualization

解决方案


解决方案

var options = {
  vAxis: {format: 'currency'}
};

推荐阅读