FVANCOP / ChartNew.js

MIT License
420 stars 142 forks source link

Line chart : Colour coding for each data point depending on Y-axis value #382

Closed kew11 closed 8 years ago

markosko commented 8 years ago

if u mean point's data/value then this should work image

function setColor(area,ctx,data,statData,posi,posj,othervars)
{
  if(data.datasets[posi].data[posj]*1 > 56)return("RED"); 
  else return("GREEN");
  //change content of this function for color of points based solely on their value
}
var mydata1 = {
    labels : ["January","February","March","April","May","June","July"],
    datasets : [
        {
            fillColor : "rgba(220,220,220,0.3)",
            strokeColor : "rgba(220,220,220,1)",
            pointColor :setColor,
            pointStrokeColor : setColor,
            data : [95,53,99,,73,27,82],
            title : "2014",
            iter:"last"
        }
    ],

} ;

but i think there should be some parameter for this which access directly value of point