简体   繁体   English

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

[英]Fomatting labels on Y-axis in Highcharts with Data from HTML table

Please, I'm stuck here trying to format the Y-axis in Highcharts so it indicates currency symbol but mainly, i need the unit abbreviations to show. 请,我在这里尝试在Highcharts中格式化Y轴,以便它指示货币符号,但主要是我需要显示单位缩写 Here is my Html and javascript. 这是我的HTML和javascript。 It gets data from an HTML table. 它从HTML表获取数据。 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]

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM