The color of the rod behind the candlestick
How can I change the bar depending on the candlestick in Google Charts Api?
candlestick:{fallingColor:{fill:"red", strokeWidth:0.5,stroke:'black'},
risingColor:{fill:"yellowgreen",strokeWidth:0.5,stroke:'black'}}}
Option stroke
changes the color of the window, but not the stick behind. I get this weird black box color combination with green or red and blue verse. Can't find it in the docs
+3
source to share
2 answers
The parameter colors
will change the color of the "stick". This specifies the default colors for each chart series.
eg. change the stick to red for the first episode and brown for the second episode:
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Mon', 20, 28, 38, 45],
['Tue', 31, 38, 55, 66],
['Wed', 50, 55, 77, 80],
['Thu', 77, 77, 66, 50],
['Fri', 68, 66, 22, 15]
// Treat first row as data as well.
], true);
var options = {
legend: 'none',
colors: ['red','brown'],
candlestick: {
fallingColor:{ fill: "orange", strokeWidth:0.5, stroke:'black'},
risingColor:{ fill: "yellowgreen", strokeWidth:0.5, stroke:'black'}
}
};
var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
+4
source to share