Differentiating StackedBar colors

(5 posts) (2 voices)

Tags:

No tags yet.

  1. duane, Member

    Hi. I'm using 'dbr.chart.options', 'category_order' to define the order on a StackedBar chart. Sometimes when I do this, two of the default colours (blue and purple) are next to each other and for some colorblind people make it harder to differentiate.

    Is there a way to either ensure these colours are separated or otherwise, how do I change the default colours used (I couldn't figure out what needed to change in default.php since none of the colours seemed to be defined there).

  2. myDBR Team, Key Master

    There is actually number of ways to define the colors:

    1) dbr.chart.color - define the colors to be used in order
    2) select 'dbr.chart.options', 'label_color', 'Label text', '0x006F00'; - define specific color for label "Label text"
    3) Define your own color scheme by overriding the $mydbr_defaults['chart']['colors'] array

    We can also shift/remove/change the used purple color from the default color scheme for colorblind.

    --
    myDBR Team

  3. duane, Member

    I can't seem to get any of these options to work. I've tried:

    SELECT 'dbr.chart.options', 'label_color', 'Label text', '0x006BA4', '0xFF800E', '0xABABAB', '0x595959', '0x5F9ED1', '0xC85200', '0x898989', '0xA2C8EC', '0xFFBC79', '0xCFCFCF';

    and adding the following to the user/default.php file just makes all of the mydbr interface blank
    $mydbr_defaults['chart']['colors'] = (0x0099CC,0xF6BD0F,0x8BBA00,0xA66EDD,0xF984A1,0xCCCC00,0x999999,0xAFD8F8,0xFF0000,0x006F00,0x0099FF,0xFF66CC,0x669966,0x7C7CB4,0xFF9933,0x9900FF,0x99FFCC,0xCCCCFF,0x669900,0x1941A5);

    $mydbr_defaults['chart']['colors'] = ('0x0099CC','0xF6BD0F','0x8BBA00','0xA66EDD','0xF984A1','0xCCCC00','0x999999','0xAFD8F8','0xFF0000','0x006F00','0x0099FF','0xFF66CC','0x669966','0x7C7CB4','0xFF9933','0x9900FF','0x99FFCC','0xCCCCFF','0x669900','0x1941A5');

    $mydbr_defaults['chart']['colors'] = '0x0099CC','0xF6BD0F','0x8BBA00','0xA66EDD','0xF984A1','0xCCCC00','0x999999','0xAFD8F8','0xFF0000','0x006F00','0x0099FF','0xFF66CC','0x669966','0x7C7CB4','0xFF9933','0x9900FF','0x99FFCC','0xCCCCFF','0x669900','0x1941A5';

    In all cases, the colour of the graph bars (and labels) don't change.

    Could there be something else overriding this?

  4. myDBR Team, Key Master

    Duane,
    the label_colors-option gives a color for selected label. See an example from myDBR demo.

    To override the default color scheme (mydbr/defaults.php), define the colors as an array in mydbr/user/defaults.php:

    $mydbr_defaults['chart']['colors'] = array(
    0x0099CC,
    0xF6BD0F,
    0x8BBA00,
    0xA66EDD
    );

    --
    myDBR Team

  5. duane, Member

    Thanks! All working now.

    Duane


Reply

You must log in to post.