Chartdirector trendline

(7 posts) (2 voices)

Tags:

No tags yet.

  1. maron, Member

    I am trying to create a trendline for a column chart


    select 'dbr.chart.options', 'chartdirector', '$trendLayerObj = $c->addTrendLayer($layer->getDataSet(1), 0x008000, "Trend Line");$trendLayerObj->setLineWidth(2);';

    I've tried multiple things, but the addTrendLayer function expects an array of data as the first parameter - see here http://www.advsofteng.com/doc/cdperldoc/trendline.htm

    I can access the $c chart object, and the $layer object, however, how can I access the resultset (the data) for chartdirector.

    I hope the above is clear enough.

  2. myDBR Team, Key Master

    Hi,
    it is easier that we simply added the trendline as an option. Just run the updater and you can use the new trendline option:

    select 'dbr.chart.options', 'trendline', '0x008000', 'Trendline title', 2;

    The parameters are: color, title, and line width. Title and line width are optional.

    --
    myDBR Team

  3. maron, Member

    That is brilliant - Do I run the updater even if I'm at the latest version?

  4. myDBR Team, Key Master

    Yes, the trendline-option is included in the lastet build. Version number is still 3.9.4.

    --
    myDBR Team

  5. maron, Member

    Hi.

    I updated but this is not working for me - the trendline is not showing.


    select 'dbr.keepwithnext';
    select 'dbr.chart', 'Column','', '400','300';
    select 'dbr.chart.options','format','svg';
    select 'dbr.chart.options','chartdirector','$c->yAxis->addZone(0, 10, 0xff9999);$c->yAxis->addZone(10, 25, 0xffff99);$c->yAxis->addZone(25, 100, 0x99ff99);';
    select 'dbr.chart.options', 'trendline', '0x008000', 'Trendline title', 2;
    select DATE_FORMAT(created_at, '%H'), round(sum((base_row_total) * (comm.value / 100) / 1.255)/1000,1) as gildi
    from prod.order_item it
    inner join prod.entity_decimal comm on it.product_id = comm.entity_id and comm.attribute_id = 565
    where created_at > @START
    group by DATE_FORMAT(created_at, '%H');

  6. myDBR Team, Key Master

    Now the trendline also supports column- and bar-charts. Just run the updater.

    --
    myDBR Team

  7. maron, Member

    Thanks, it's working now.


Reply

You must log in to post.