EJSC.Series.onBarNeedsColor

See Also: Using Colors

 

Definition

 

string onBarNeedsColor( EJSC.BarPoint point, EJSC.Series series, EJSC.Chart chart )

object onBarNeedsColor( EJSC.BarPoint point, EJSC.Series series, EJSC.Chart chart )

 

Description

 

Fired when a bar needs a color.  This event may return either a string (i.e. "rgb(0,255,0)") or an object with additional styling properties.

 

The object returned is expected to be formatted as:

 

       {

               color:                string,

               opacity:                integer,

               lineOpacity:        integer,

               lineWidth:        integer

       }

 

Example

 

>> Display bars with userdata of "bold" with thicker lines

 

var chart = new EJSC.Chart("chart");

var bar = chart.addSeries(new EJSC.BarSeries(

   data,

   {

      lineOpacity: 80,

      lineWidth: 1,

      onBarNeedsColor: function(point, series, chart) {

 

         if (point.userdata == "bold") {

            return {

               color: "rgb(0,0,0)",

               opacity: 100,

               lineOpacity: 100,

               lineWidth: 100

            };

         } else {

            return "rgb(128,128,128)";

         }

      }

   }

));