谷歌图表烛台颜色 [英] google chart candlestick colors
问题描述
我正在尝试根据Google图表自定义烛图.
I am trying to customize candlecharts from google charts.
我已经找到了如何自行改变蜡烛颜色的方法,但没有找到指示最高和最低值的那一行:
I have found how to change the color of the candle themselves, but not the one of the line indicating the highest and lowest value:
这些是我提供的选项:
let options = {
legend: 'none',
candlestick: {
risingColor: {stroke: '#4CAF50', fill: 'white'},
fallingColor: {stroke: '#F44336'}
}
}
您可以在此jsFiddle上尝试: https://jsfiddle.net/El_Matella/h5p36t3w/2/
You can try it on this jsFiddle: https://jsfiddle.net/El_Matella/h5p36t3w/2/
我在文档中找不到如何更改它,有人知道吗?( https://developers.google.com/chart/interactive/docs/gallery/candlestickchart )
I can't find in the documentation how to change it, does someone have an idea? (https://developers.google.com/chart/interactive/docs/gallery/candlestickchart)
推荐答案
如果您希望所有行都是相同的颜色,
您可以使用 colors
选项...
if you want all the lines to be the same color,
you can use the colors
option...
请参阅以下工作摘要...
see following working snippet...
google.charts.load('current', {'packages':['corechart']});
google.charts.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',
candlestick: {
risingColor: {stroke: '#4CAF50', fill: 'white'},
fallingColor: {stroke: '#F44336'}
},
colors: ['magenta']
};
var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
这篇关于谷歌图表烛台颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!