Change Bar color based on x axis value

Options
bcmp
edited February 11, 2022 in Analytics #1

How to change the color of certain bars based on x-axis values. Any samples would be great.

Answers

  • jfranken
    Options

    The following code is not tested and is only for demonstration:

    // chart onRender event handler, SVG bar chart

    function beforeDrawDataPoint( dph, fill, icsc )
    {
    if(dph.getBaseValue().toString() == "insert_x_axis_value") {
    fill.set( 255, 0, 0, 255 ); // make bar red
    }
    }

    Warning No formatter is installed for the format ipb