Why google candlestick fallingColor and risingColor are not working for this?

92 views
Skip to first unread message

Kiran Kumar

unread,
Nov 6, 2015, 2:13:06 AM11/6/15
to Google Visualization API

I am working on Google Visulization charts .

I am trying to draw candlestick charts with sample data , the issue i am facing is that the falling color and raising color are being represented in single color only

This is my code

var mydata = [['13-Oct',1109.95,1132,1097.95,1113.45],['14-Oct',1113.45,1117,1095.6,1101.15],['15-Oct',1116,1132,1092.1,1129.2],['16-Oct',1130,1182.4,1130,1170.3],['19-Oct',1174,1182.2,1144.5,1162.15]];

function drawChart() {

    var data = google.visualization.arrayToDataTable(mydata, 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);
}

and this is my fiddle

http://jsfiddle.net/pdmpb9w1/7/

Could you please let me know how to resolve this issue ??

Sergey Grabkovsky

unread,
Nov 6, 2015, 8:08:12 AM11/6/15
to Google Visualization API
You need to enter your data properly. In your jsfiddle, all of your data is falling (going from large to small), so all of it will be rendered with the fallingColor. I updated your jsfiddle with some data that rises, and you can see that it indeed colors it correctly: http://jsfiddle.net/4626vgu0/

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/56c6eda7-b9ea-414b-a608-4c97f04b6780%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
unnamed.gif 
Sergey Grabkovsky | SWE  | gra...@google.com
Reply all
Reply to author
Forward
0 new messages