繁体   English   中英

如何在Jqplot中绘制半饼图

[英]How to plot a half pie chart in Jqplot

我有这样的形式

<form>
<table>
<tr><th colspan="2">Table1 Content</th></tr>
<tr><td><div align="left">International Services</div></td><td><input type="text" name="expenditure[]"/></td></tr>
<tr><td><div align="left">Public sector debt interest</div></td><td><input type="text" name="expenditure[]"/></td></tr>
<tr><td><div align="left">Defence</div></td><td><input type="text" name="expenditure[]"/></td></tr>
</table>
<table>
<tr>
        <th colspan="2">
         Table2 content
        </th></tr>
      <tr><td><div align="left">VAT</div></td><td><input type="text" name="revenue[]"/></td></tr>
      <tr>
        <td><div align="left">Other taxes, royalties & adjustments</div></td><td><input type="text" name="revenue[]"/></td></tr>

      <tr>
        <td><div align="left">Interest and dividends</div></td><td><input type="text" name="revenue[]"/></td></tr>
      <tr>
</table>
</form>

用户将在不同的文本框中输入数字,我必须使用JqPlot绘制饼图,其中饼图的一半应显示表1的内容,另一半将显示table2的内容

Jqplot的基本脚本如下

<script>
$(document).ready(function(){
  var data = [
    ['Heavy Industry', <?php echo $_POST['q_1']?>],['Retail',<?php echo $_POST['q_2']?>], ['Light Industry', <?php echo $_POST['q_3']?>],
    ['Out of home', <?php echo $_POST['q_4']?>],
  ];
  var plot1 = jQuery.jqplot ('chart1', [data],
    {
      seriesDefaults: {
        // Make this a pie chart.
        renderer: jQuery.jqplot.PieRenderer,
        rendererOptions: {
          // Put data labels on the pie slices.
          // By default, labels show the percentage of the slice.
          showDataLabels: true
        }
      },
      legend: { show:true, location: 'e' }
    }
  );
});
</script>

有人可以帮我吗

我只想知道我将如何使用这些值在180度图表而不是360度图表中进行绘制

提前致谢

看一下这个,

这是一种骇人听闻的解决方案,但应该可以让您得到绘制半圆形饼图的预期结果

startAngle: 180

https://jsfiddle.net/96vog3h1/5/

暂无
暂无

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

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