brno792
brno792

Reputation: 6799

Google Chart ComboChart Candlesticks with Line

I have looked at the docs for combo charts and am able to reproduce a bar chart with a line as a different series. But how do I have a candlestick chart with a line as a different series?

When I try, I get the error Last domain does not have enough data columns (missing 3). Yes, I am adjusting my datatable so it has the right number of variables (columns).

Date, Low, Open, High, Close, Average

I can create a candlestick combo chart with only one series when my data looks like:

Date, Low, Open, High, Close

What is happening when I add another column?

Update:

    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);  
    function drawChart() {
        var data = google.visualization.arrayToDataTable([
            ['Date',     'Low', 'Open', 'High', 'Close', 'Average'],
            ['2014/05',   200,   300,    500,    400,     350],
            //...
        ]);

        var options = {
            seriesType: "candlesticks",
            series: {
                5: {type: "line"}
            }
        };

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

Upvotes: 6

Views: 6424

Answers (1)

asgallant
asgallant

Reputation: 26330

The "line" series is the 2nd data series, not the 6th, so your series option should be:

series: {
    1: {
        type: 'line'
    }
}

Upvotes: 9

Related Questions