Re: CandleStick Charts, Changing the color of the high and low bars

4,302 views
Skip to first unread message

Hoa Hoang

unread,
Oct 20, 2012, 7:19:38 PM10/20/12
to google-visua...@googlegroups.com
So I was able to change the color of the vertical bar to black by editing the series option.
series: {    0:{color: "Black"},
1: {type: "line"}, 
2: {type:"line"}}

However, this changes the colors for all the series, instead of just the ones I want.
Ideally, the falling numbers will have a red vertical high/low bar, 
and the rising numbers should have a green vertical bar.

Any ideas on how I can accomplish this?

On Saturday, October 20, 2012 4:25:01 PM UTC-6, Hoa Hoang wrote:
I'm trying to customize the candlestick charts.
I want the rising candlesticks to be hollow and falling candlesticks to be red.
However, when I try to change the stroke and the fill, the horizontal bars representing the high and the low stay the default blue color.

I end up with this: http://imgur.com/NoAzr
Here's what my options look like.
var options = {
 candlestick: {hollowIsRising : true,
     risingColor: {stroke: "Green"},
     fallingColor : {color: "DarkRed",fill : "DarkRed", stroke: "DarkRed",strokeWidth: 1 }},
          title : 'Monthly Coffee Production by Country',
          vAxis: {title: "price"},
          hAxis: {title: "Month"},
          seriesType: "candlesticks",
          series: { 
1: {type: "line"}, 
2: {type:"line"}}
        };

asgallant

unread,
Oct 20, 2012, 11:00:51 PM10/20/12
to google-visua...@googlegroups.com
The wicks of the candlestick are colored by the series color and not by the rising/falling state, and there is no way to force them to be colored by rising/falling state.  You could try using a DataView to separate out the rising and falling values into their own series and graphing them accordingly.  This would get you the colors you want, but your candles would be misaligned in the horizontal space (as each would have an empty spot where a candle from the other series would have been placed next to it).

Rogerio Takejame

unread,
Sep 13, 2016, 7:38:27 PM9/13/16
to Google Visualization API
There is an enhancement request about this issue on https://github.com/google/google-visualization-issues/issues/1014, but the priority is low. If more people star this issue, they may work on it earlier.
Reply all
Reply to author
Forward
0 new messages