It is possible to generate that Char in Google Charts?

前端 未结 1 763
暖寄归人
暖寄归人 2021-01-26 16:12

I have a fast question. It is possible to generate that Char in Google Charts? ... And mayby u knew how to do that (any advice or smth)? Chart1

This white area below th

相关标签:
1条回答
  • 2021-01-26 16:52

    it's possible

    use AreaChart with isStacked: true and set the bottom area to 'transparent'

    since isStacked: true, most likely some data manipulation will be required to get the desired outcome

    see following working snippet...

    google.charts.load('current', {
      callback: function () {
        new google.visualization.AreaChart(document.getElementById('chart_div')).draw(
          google.visualization.arrayToDataTable([
            ['Year', 'Bottom', 'Area 1', 'Area 2', 'Area 3'],
            ['2010', 100, 100, 100, 100],
            ['2020', 110, 120, 130, 140],
            ['2025', 120, 160, 180, 200],
            ['2030', 140, 180, 200, 240],
            ['2035', 200, 240, 280, 320],
            ['2040', 260, 300, 320, 380],
            ['2045', 320, 400, 460, 600],
            ['2050', 400, 480, 600, 800]
          ]),
          {
            areaOpacity: 1.0,
            colors: ['transparent', 'cyan', 'yellow', 'magenta'],
            lineWidth: 1,
            isStacked: true,
            series: {
              0: {
                visibleInLegend: false
              }
            }
          }
        );
      },
      packages: ['corechart']
    });
    <script src="https://www.gstatic.com/charts/loader.js"></script>
    <div id="chart_div"></div>

    0 讨论(0)
提交回复
热议问题