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);
}
Click the Chart button in the top right of the toolbar. OR, in the menu, select the Insert tab; you will see a chart option, choose that. In Chart type, Select “Combo Chart.”
A combo chart is a combination of two column charts, two line graphs, or a column chart and a line graph. You can make a combo chart with a single dataset or with two datasets that share a common string field. Combo charts can answer questions about your data, such as: What are the trends for the same categories?
Click anywhere in the chart you want to change to a combo chart to show the CHART TOOLS. Click DESIGN > Change Chart Type. On the All Charts tab, choose Combo, and then pick the Clustered Column - Line on Secondary Axis chart.
The "line" series is the 2nd data series, not the 6th, so your series option should be:
series: {
1: {
type: 'line'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With