javascript - 堆叠列每列两个值

标签 javascript jquery html css highcharts

在 highcharts 中有没有办法堆叠每列有两个值的列。未完成元素与已完成元素我想要的是 Aaron 的一列具有不完整和已完成的值,然后是 Johns Team 的下一列具有不完整和已完成的值?在此先感谢您的帮助 我的代码如下:

$(function() {
  $('#container').highcharts({
    chart: {
      type: 'column'
    },
    title: {
      text: 'Complete vs Incomplete Tasks (by Team)'
    },
    xAxis: {
      categories: ['Aarons Team' /*,'Johns Team' */ ]
    },
    yAxis: {
      min: 0,
      title: {
        text: 'Tasks'
      }
    },
    legend: {
      reversed: true
    },
    plotOptions: {
      series: {
        stacking: 'normal'
      }
    },
    series: [{
        name: 'Aarons Team',
        data: [4]
      }, //incomplete projects
      {
        name: 'Aarons Team',
        data: [2]
      } // completed projects
      /* {name: 'Johns Team', data:[6]},              //incompleted projects
         {name: 'Johns Team', data:[4]}               // completed projects
       */

    ]

  });
});
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>

最佳答案

我想通了。 对于每个额外的列,您必须为前一列放置 0 或 NULL。

     { name: 'Aarons Team', data:[4] },  //incomplete projects
        { name: 'Aarons Team', data:[2]}    // completed projects
         {name: 'Johns Team', data:[0,6]},              //incompleted projects
         {name: 'Johns Team', data:[0,4]}               // completed projects

关于javascript - 堆叠列每列两个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42209627/

相关文章:

JavaScript 对象检测

javascript - 从 Controller 输出到 HTML 表单

javascript - 在 Canvas 上绘制时的偏移

html - 如何在 Bootstrap 中使图像居中

php - 使用 CSS 和 PHP 创建 DIV 网格的逻辑错误

javascript - Twitter个人资料图片 uploader 如何在客户端显示图片预览

javascript - 如何使用 JavaScript 计算一行中的字符数

javascript - Ajax调用angularJs调用方法

javascript - 无法使用 'in' 运算符在 null 中搜索 'error'

css - 使用 CSS 在 HTML5 中使按钮居中