Home Forums Chart Support Why in “Candle Stick Chart With …” the surrounding color is red?

Why in “Candle Stick Chart With …” the surrounding color is red?

Viewing 2 posts - 1 through 2 (of 2 total)
  • #44913

    I want to have a green bar that is totally green, and a red bar that is totally red.
    Can I?

    #44921

    @ranc,

    You can set the datapoint color based on the datapoint value, whether it’s rising or falling as shown in the code snippet below:

    function changeBorderColor(chart){
      var dataSeries;
      for( var i = 0; i < chart.options.data.length; i++){
        dataSeries = chart.options.data[i];
        for(var j = 0; j < dataSeries.dataPoints.length; j++){
          dataSeries.dataPoints[j].color = (dataSeries.dataPoints[j].y[0] <= dataSeries.dataPoints[j].y[3]) ? (dataSeries.risingColor ? dataSeries.risingColor : dataSeries.color) : (dataSeries.fallingColor ? dataSeries.fallingColor : dataSeries.color);
        }
      }
    }

    Please check this JSFiddle for a working example.


    Thangaraj Raman
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.