当前位置:  开发笔记 > 程序员 > 正文

需要多个系列的堆积柱形图

如何解决《需要多个系列的堆积柱形图》经验,为你挑选了1个好方法。

我一直在努力获得多个系列的堆积柱形图.使用谷歌图表或高图任何适合.

我需要实现如下图像: 图表演示

非常感谢提前.



1> 小智..:

ZingChart可以使用一个库来制作这种具有多个系列的堆叠柱形图.

这是ZingChart库中图表的小提琴:

var myConfig = {
  "type": "bar",
  "labels": [{
    "background-color": "green",
    "x": "65%",
    "y": "23px",
    "height": "15px"
  }, {
    "text": "Win",
    "font-size": "20px",
    "x": "68%",
    "y": "15px"
  }, {
    "background-color": "red",
    "x": "82%",
    "y": "23px",
    "height": "15px"
  }, {
    "text": "Loss",
    "font-size": "20px",
    "x": "85%",
    "y": "15px"
  }],
  "stacked": true,
  "stack-type": "normal",
  "background-color": "#FFFFFF",
  "title": {
    "text": "Win Loss Report ",
    "font-family": "arial",
    "x": "40px",
    "y": "5px",
    "align": "left",
    "bold": false,
    "font-size": "16px",
    "font-color": "#000000",
    "background-color": "none"
  },
  "plot": {
    "-bar-width": "25px",
    "hover-state": {
      "visible": false
    }
  },
  "scale-x": {
    "values": [
      "JAN",
      "FEB",
      "MAR",
      "APR",
      "MAY",
      "JUN",
      "JUL",
      "AUG",
      "SEP"
    ],
    "line-color": "#7E7E7E",
    "tick": {
      "visible": false
    },
    "guide": {
      "visible": false
    },
    "item": {
      "font-family": "arial",
      "font-color": "#8B8B8B"
    }
  },
  "scale-y": {
    "values": "0:70000:10000",
    "short": true,
    "line-color": "#7E7E7E",
    "tick": {
      "visible": false
    },
    "guide": {
      "line-style": "solid"
    },
    "item": {
      "font-family": "arial",
      "font-color": "#8B8B8B"
    }
  },
  "series": [{
    "values": [
      15000,
      12000,
      42000,
      13000,
      19500,
      9750,
      11500,
      36500,
      11750
    ],
    "stack": 1,
    "background-color": "red"
  }, {
    "values": [
      13000,
      8000,
      5000,
      20000,
      17000,
      10000,
      34000,
      6000,
      5500
    ],
    "stack": 1,
    "background-color": "green"
  }, {
    "values": [
      13000,
      8000,
      5000,
      20000,
      17000,
      10000,
      34000,
      6000,
      5500
    ],
    "stack": 2,
    "background-color": "red"
  }, {
    "values": [
      15000,
      12000,
      42000,
      13000,
      19500,
      9750,
      11500,
      36500,
      11750
    ],
    "stack": 2,
    "background-color": "green"
  }, {
    "values": [
      8000,
      3000,
      9000,
      25000,
      12000,
      18000,
      37000,
      9900,
      8800
    ],
    "stack": 3,
    "background-color": "red"
  }, {
    "values": [
      11000,
      10000,
      32000,
      10000,
      10500,
      8250,
      9500,
      30500,
      9750
    ],
    "stack": 3,
    "background-color": "green"
  }, {
    "values": [
      23000,
      9000,
      6000,
      30000,
      27000,
      10000,
      44000,
      7000,
      6500
    ],
    "stack": 4,
    "background-color": "red"
  }, {
    "values": [
      12000,
      22000,
      52000,
      33000,
      29500,
      8750,
      12500,
      38500,
      21750
    ],
    "stack": 4,
    "background-color": "green"
  }],
  "tooltip": {
    "visible": false
  }
};

zingchart.render({
  id: 'myChart',
  data: myConfig,
  height: 400,
  width: 600
});

    
  

  
    
推荐阅读
勤奋的瞌睡猪_715
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有