How to add target line in google column chart?

后端 未结 4 1623
感情败类
感情败类 2020-12-15 17:03

How to add the target line in google column chart like this.

\"google

4条回答
  •  离开以前
    2020-12-15 17:29

    You can use a Stepped Area series to achieve this. It's a little awkward but works well.

    var data = google.visualization.arrayToDataTable([
        ['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', ''],
        ['2004/05',  165,      938,         522,             998,           450,      250],
        ['2005/06',  135,      1120,        599,             1268,          288,      250],
        ['2006/07',  157,      1167,        587,             807,           397,      250],
        ['2007/08',  139,      1110,        615,             968,           215,      250],
        ['2008/09',  136,      691,         629,             1026,          366,      250]
    ]);
    
    var options = {
        seriesType: "line",
        series: {5: {
          type: "steppedArea", 
          color: '#FF0000', 
          visibleInLegend: false, 
          areaOpacity: 0}
        }
    };
    
    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));    
    chart.draw(data, options);
    

    Example

    Stepped Area Google Chart Example

提交回复
热议问题