簡體   English   中英

直線下線圖谷歌圖表?

[英]Straight line down on line chart google chart?

可以從折線圖谷歌圖表中的點做一條線(點線和直線)?

function drawChart() {
    var data = google.visualization.arrayToDataTable([
        ['Year', 'Sales'],
        ['2004', 1000],
        ['2005', 1170],
        ['2006', 660],
        ['2007', 1030]
    ]);

var options = {
    title: 'Company Performance',
    pointSize: 10
};

var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);

這個概念是這樣的...... 在此輸入圖像描述

http://jsfiddle.net/TD92C/

您可以使用ComboChart並使用DataView復制數據系列來偽造這些行。 將一個系列設置為“line”類型,將第二個系列設置為“bar”類型。 禁用條形圖上的交互性並從圖表圖例中刪除該系列。 使用bar.groupWidth選項縮小繪制的條形,使它們類似於線條:

bar: {
    // use this to set the width of the vertical lines
    groupWidth: 2
},
series: {
    0: {
        // this is the line series
        type: 'line',
        pointSize: 10
    },
    1: {
        // this creates the vertical "lines" down from the points
        type: 'bars',
        color: '#666666',
        enableInteractivity: false,
        visibleInLegend: false
    }
}

請參閱此處的示例http://jsfiddle.net/asgallant/TD92C/1/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM