在Highcharts中使用HTML表格中的数据格式化Y轴上的标签

时间:2013-09-25 03:27:46

标签: javascript highcharts

拜托,我在这里试图格式化Highcharts 中的 Y轴,所以它表示货币符号,但主要是,我需要单位缩写来显示。这是我的Html和javascript。它从HTML表中获取数据。 HTML:

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="jquery-1.9.0.min.js"></script>
<script src="highcharts.src.js"></script>
<script src="jquery.highchartTable.js"></script>
<script>
$(document).ready(function() {
$('table.highchart').highchartTable();
});
</script>

</head>
<body>


<table class="table table-bordered table-condensed table-striped table-primary table-vertical-center checkboxs highchart" data-graph-container-before="1" data-graph-type="column" data-graph-yaxis-1-formatter-callback="graph_ValueFormatter" data-graph-height="350">
                                                                  <thead>
                                                     <tr>
                                                        <th data-graph-hidden="1">Location</th>
                                                        <th class="center" style="width: 100px;">Sales</th>
                                                        <th class="center" style="width: 100px;">Pipeline</th>
                                                        <th class="center" style="width: 100px;">Projected</th>
                                                   </tr>
                                                 </thead>
                                                                  <tbody> 
                                                  <!-- Item -->
                                                  <tr class="selectable">
                                                     <td><strong>Africa Re, VI Lagos</strong></td>
                                                     <td class="center">31,977</td>
                                                     <td class="center">1,230</td>
                                                     <td class="center">31,977</td>
                                                  </tr>
                                                  <!-- // Item END -->
                                                  <!-- Item -->
                                                  <tr class="selectable">
                                                     <td><strong>Muliner Towers, Ikoyi Lagos</strong></td>
                                                     <td class="center">28,756</td>
                                                     <td class="center">1,079</td>
                                                     <td class="center">28,835</td>
                                                  </tr>
                                                  <!-- // Item END -->
                                                  <!-- Item -->
                                                  <tr class="selectable">
                                                     <td><strong>Somewhere, London</strong></td>
                                                     <td class="center">13,328</td>
                                                     <td class="center">1,833</td>
                                                     <td class="center">14,161</td>
                                                  </tr>
                                                  <!-- // Item END -->
                                                  <!-- Item -->
                                                  <tr class="selectable">
                                                     <td><strong>Somewhere, Johanesburg</strong></td>
                                                     <td class="center">38,893</td>
                                                     <td class="center">3,430</td>
                                                     <td class="center">38,893</td>
                                                  </tr>
                                                  <!-- // Item END -->
                                                  <!-- Item -->
                                                  <tr class="selectable">
                                                     <td><strong>Someplace, Nairobi</strong></td>
                                                     <td class="center">241,178</td>
                                                     <td class="center">2,247</td>
                                                     <td class="center">243,425</td>
                                                  </tr>
                                                  <!-- // Item END -->



                                            </tbody>
                                                               </table>
 </body>
  </html>![enter image description here][1]

1 个答案:

答案 0 :(得分:0)

您可以在yAxis标签中使用格式化程序:http://api.highcharts.com/highcharts#yAxis.labels.formatter