我想完成谷歌堆积面积图。

这是js小提琴:
Js Fiddle

我还尝试添加堆叠区域的选项:

var options_fullStacked = {
          isStacked: 'relative',
          height: 300,
          legend: {position: 'top', maxLines: 3},
          vAxis: {
            minValue: 0,
            ticks: [0, .3, .6, .9, 1]
          }
        };


可以在Google图表的文档中找到:stacked area

我要显示它,如下图所示:
javascript - Google堆积面积图不起作用-LMLPHP

请忽略此图中的所有其他内容,但折线图和地图之间显示的堆积面积图除外

最佳答案

似乎在这里工作,还有更多可以分享的内容吗?

请参阅以下示例...

isStacked: true



google.charts.load('current', {
  callback: function () {
    new google.visualization.AreaChart(document.getElementById('chart_div')).draw(
      google.visualization.arrayToDataTable([
        ['Year', 'Sales', 'Expenses'],
        ['2013',  1000,      400],
        ['2014',  1170,      460],
        ['2015',  660,       1120],
        ['2016',  1030,      540]
      ]),
      {
        title: 'Company Performance',
        isStacked: true,
        hAxis: {title: 'Year',  titleTextStyle: {color: '#333'}},
        vAxis: {minValue: 0}
      }
    );
  },
  packages:['corechart']
});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
}

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>





isStacked: false



google.charts.load('current', {
  callback: function () {
    new google.visualization.AreaChart(document.getElementById('chart_div')).draw(
      google.visualization.arrayToDataTable([
        ['Year', 'Sales', 'Expenses'],
        ['2013',  1000,      400],
        ['2014',  1170,      460],
        ['2015',  660,       1120],
        ['2016',  1030,      540]
      ]),
      {
        title: 'Company Performance',
        isStacked: false,
        hAxis: {title: 'Year',  titleTextStyle: {color: '#333'}},
        vAxis: {minValue: 0}
      }
    );
  },
  packages:['corechart']
});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
}

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>

10-08 09:08