动态更改myDBR堆积条形图的颜色

时间:2015-01-21 17:30:07

标签: mydbr

早上好,

我需要在MyDBR堆积条形图中动态设置条形段的颜色。我的任务是显示不同引擎在一天中打开或关闭的经过时间。

我几乎只使用前三个字段here在堆积条形图中得到了我需要的东西但是,我需要' on'酒吧的一部分是绿色的,而且是“关闭”。根据第四个字段中的值,红色线段为红色,点火'。

我有一个MySQL过程,它返回一个包含四个字段的结果集:

Engine   DateTime              Elapsed    Ignition
111      2015-01-02 01:03:12   01:03:15   On

我想我几乎已经得到了以下代码的答案:

从结果集中选择不同的' dbr.chart.options',' bar_segment ???',Ignition,' 0xFF0000' Ignition =' Off'

从结果集中选择不同的' dbr.chart.options',' bar_segment ???',Ignition,' 0x00FF00' Ignition =' Off'

非常感谢任何帮助,

mleary2001

1 个答案:

答案 0 :(得分:0)

得到了myDBR人员的大力帮助,以便得出答案。

/* call stored procedure to make myTable, described above */
CALL stored_procedure;

/*myDBR chart code */
select 'dbr.chart', 'StackedBar';
select 'dbr.chart.options', 'label_color', DateTime, if (Ignition='On', '0x42B64A^', '0xE85854') from myTable;

/* select data from the temp table created above */
SELECT
    Asset,
    event_date,
    Elapsed,
    Ignition
FROM
    myTable;

这会产生一个堆积条形图,条形段根据需要动态着色。 :)

相关问题