XY line chart - changing the line color based on a value

(2 posts) (2 voices)

Tags:

No tags yet.

  1. JMitchell, Member

    I have a simple line chart. Im looking for the line color to change if the line drops below 0. Is there a way to conditionally format the color of the line above and below 0?

    Thanks

  2. myDBR Team, Key Master

    There is no way to make the line multicolored. What you could do is to draw a line in zero and color the area between the zero and the line.

    Something like this:

    select 'dbr.chart.options', 'chartdirector', '
    $mark = $c->yAxis->addMark(0, -1, "");
    $mark->setLineWidth(1);
    $mark->setMarkColor(0x000000);
    $c->addInterLineLayer($layer->getLine(), $mark->getLine(), 0xFF000000, 0x80C43647);
    ';

    --
    myDBR Team


Reply

You must log in to post.