Hi,
From what I can tell, the chart options for setting a specific colour and a legend order don't work together.
I am using chart type 'stackedbar3d'.
I know that I can specify chart series order using (for example):
select 'dbr.chart.options','series', 'a','b','c';
select 'dbr.chart.color','0x00DCEFAE','0x0073ADEF','0x00EFB8B6';
However, if one of these series is missing from my data then the colour is not consistent to the series - i.e. if there is no "b" then "c" is given the second colour. However, I need it to show consistency in different reports and is surely more professional to have the same colour for the same values.
Therefore I tried to specify the colour specifically using:
select 'dbr.chart.options', 'label_color', 'a', '0x00DCEFAE';
etc
However, the order of the series listed in the legend appears in the order those series appear in my data, but I want them in a specific order (not necessarily alphabetical).
Therefore I thought I could use:
select 'dbr.chart.options','series', 'a','b','c';
to set the order.
But this does not work. It appears that the colours are being still set according to the order they are present in my data.
The same is true if I try to set the legend series order by ordering my data in my SQL query. This is because if my first data set does not have any "b" series, then again, "c" seems to be given "b"'s colour.
If this issue is not clear, here is a MyDBR test report to show the issue. In it I specify series "b" to be colour Red, but that is allocated to series "c" instead:
DROP PROCEDURE IF EXISTS sp_DBR_Test_10_Legend
$$
CREATE PROCEDURE `sp_DBR_Test_10_Legend`()
BEGIN select 'dbr.chart', 'stackedbar3d', 'test';
select 'dbr.chart.options','series', 'a','b','c';
select 'dbr.chart.options', 'label_color', 'a', '0x0095B3D7'; -- BLUE
select 'dbr.chart.options', 'label_color', 'b', '0x00DA9694'; -- RED
select 'dbr.chart.options', 'label_color', 'c', '0x00C4D79B'; -- GREEN SELECT '1' AS `category`,
'a' AS `series`,
1 AS `value`
UNION
SELECT '1' AS `category`,
'c' AS `series`,
1 AS `value`
UNION
SELECT '2' AS `category`,
'a' AS `series`,
1 AS `value`
UNION
SELECT '2' AS `category`,
'b' AS `series`,
1 AS `value`
UNION
SELECT '2' AS `category`,
'c' AS `series`,
1 AS `value`; END
$$
Please can you advise me if there is a way around this (i.e. set the colour AND the order the series are listed in the legend).
Thanks,
Justin