Changing set chart colours with dbr.chart.color

(8 posts) (2 voices)


No tags yet.

  1. jjr, Member

    Hi, please can someone help me solve this problem:

    I seem to be having an issue whereby if I set the chart colours using dbr.chart.color,
    I then cannot change them later on using another dbr.chart.color command (or any other colour - related commands).

    I want to do do this because I have a default value for dbr.chart.color being set for all my charts but then I'd like to change this on exception.

    Even if I try putting two dbr.chart.color commands one after the other it appears that the second one does not overwrite the first one, which is what I would expect.

    Have I misunderstood the required logic here or am I making a mistake?



  2. myDBR Team, Key Master

    can you show how you use the dbr.chart.color command? What do you mean when you say "cannot change them later"?

    When you issue dbr.chart.color- command and then issue it another time on same chart, the second one does not override the first one.

    Let's say you have a pie-chart with three values:

    select 'A', 1
    select 'B', 2
    select 'C', 3;

    When you issue a first dbr.chart.color- command

    select 'dbr.chart.color', '0xFF0000', '0x00FF00';

    it will set the color of 'A' to red and the 'B' to green. Issuing the second dbr.chart.color-command sets the color for 'C':

    select 'dbr.chart.color', '0000FF';

    So the 'C' will get blue color.

    myDBR Team

  3. jjr, Member


    I'm using like in your example (i.e select 'dbr.chart.color', '0xFF0000', '0x00FF00';).

    I was expecting the second command to override the first but you're saying that it adds to it, which would explain what I am seeing.

    I also tried using the 'select 'dbr.chart.options', 'color' ,'bcolour';' command that is referred to in this post:
    Which also does not seem to override the first value.

    I also tried using the select 'dbr.chart.options', 'label_color' command, again with no effect.

    Is there a way to 'reset' the dbr.chart.color command so that I can issue a new one, or a way to override it with alternative commands?

    I know that I can add some logic to not set it in the first place if need be, but I would rather keep the earlier logic generic if I can.



  4. myDBR Team, Key Master

    there is no "override" option in colors you have set. You set the color and subsequent use of the command adds to it.

    Why not just set the colors you want to use?

    As for indivudual options not working, without seeing your code it is hard to give advises.

    myDBR Team

  5. jjr, Member

    As explained earlier, I am setting default colours generically in shared code so it would be useful not to have to adjust this which will affect other reports I have already built.

    Are you saying that

    select 'dbr.chart.options', 'color';

    select 'dbr.chart.options', 'label_color'

    should override the original 'dbr.chart.color' or not?

    If MyDBR cannot do this then yes, I will need to revisit my use of generic code across my reports. That's fine, just thought I'd ask.

    If these options should override 'dbr.chart.color', here is some code which looks like they do not (if I am using these commands wrongly then please let me know):

    CREATE PROCEDURE `sp_DBR_Test_09_Colour`()
    select 'dbr.chart', 'stackedbar3d', 'test';
    select 'dbr.chart.color', '0x0095B3D7', '0x00DA9694', '0x00C4D79B', '0x00B1A0C7', '0x0092CDDC';
    select 'dbr.chart.options', 'color', '[colour]';
    select 'dbr.chart.options', 'label_color', 'bar1', '0x0092CDDC'; SELECT 'category' AS `category`,
    'bar1' AS `split`,
    2 AS `value`,
    '0x00C4D79B' AS colour
    SELECT 'category' AS `category`,
    'bar2' AS `split`,
    3 AS `value`,
    '0x00B1A0C7' AS `colour`;


  6. myDBR Team, Key Master

    as said, there is no "override" option in colors you have set. You set the color and subsequent use of the command adds to it.

    What is it that you are trying to do with the initial color settings? If you are trying to set your own color scheme, you can do that in user/defaults.php.

    myDBR Team

  7. jjr, Member

    The initial colour settings are just to provide the default for use in most cases. It is fine if I can't override them, I just wanted to understand what is possible to make sure I designed my reports in the right way and now I know I will just alter the the way I use default settings in the first place.

  8. myDBR Team, Key Master

    myDBR has initial set of colors and you *can* override it with your own if you like. Just not the way you were trying to do it.

    myDBR Team


You must log in to post.