Dashed Line

(13 posts) (3 voices)

Tags:

  1. nsepetys, Member

    Hello myDBR Representative,

    How are you doing today? I was wondering if there is a way that myDBR directly supports changing the style of line in a chart to something like a dashed, instead of solid, line?

    - Noah

  2. myDBR Team, Key Master

    Hi,
    you can, by using native ChartDirector commands. To use a dashed red line in a line chart, you would use:

    select 'dbr.chart.options', 'chartdirector', '
    $dataset = $layer->getDataSet();
    $dataset->setDataColor($c->dashLineColor( 0xFF0000, DashLine ));';

    --
    myDBR Team

  3. nsepetys, Member

    Thank you! That seems to have done the trick to some extent. I think I need to access a different layer or something because I have 3 datasets for the "MSlineDY" chart type I am using and the error I am getting when trying to access the 3rd dataset is "Fatal error: Error converting object pointer to type P7DataSet in /var/www/html/reporting/mydbr/lib/external/ChartDirector/phpchartdir.php on line 1936". I am using the following to try and access the 3rd line that uses the 2nd Y-axis:
    select 'dbr.chart.options', 'chartdirector', ' $dataset = $layer->getDataSet(2); $dataset->setDataColor($c->dashLineColor( 0xFF0000, DashLine ));';

    Let me know if you have any ideas.

  4. myDBR Team, Key Master

    Easiest will be that we will add an chart option to define the line type. It's a reasonable feature request.

    The code itself if ok, but unfortunately the MSlineDY uses two layers (one for each axis) and the second layer is not passed into the $layer so it is unaccessible from chartdirector option.

    Stay tuned.
    --
    myDBR Team

  5. nsepetys, Member

    Alright. I'll be patient. Thanks!

  6. myDBR Team, Key Master

    While we add the option, you can run the updater and use format:

    select 'dbr.chart.options', 'chartdirector', '
    $dataset = $layer[1]->getDataSet(0);
    $dataset->setDataColor($c->dashLineColor( 0xFF0000, DashLine ));';

    Where the $layer is an array with the two layers.

    --
    myDBR Team

  7. nsepetys, Member

    OOh! Very nice. I will try this once I can get that update. Thanks for your expedient reply.

  8. myDBR Team, Key Master

    Noah,
    There is now a new chart option line.style. Format is:

    select 'dbr.chart.options', 'line.style', style;

    for single series line chart and

    select 'dbr.chart.options', 'line.style', series_name, style;

    for multiseries line chart.

    The 'style' can be 'dash', 'dot', 'dotdash' or 'altdash' all representing different lines.

    See a demo.

    --
    myDBR Team

  9. nsepetys, Member

    Thanks for getting this feature out there. I suppose we'll need to do another update to get this piece so I'll ask our net ops guy if we can update again. Before I do that any chance you can test the tooltip feature on your end for the "MSlineDY" chart type? Even after removing the chart director code you guys provided I cannot get tooltips to show. MSColumn and even MSLine charts do not seem to be directly affected as far as I can tell.

  10. myDBR Team, Key Master

    Tooltips are there.

    --
    myDBR Team

  11. nsepetys, Member

    The latest update appears to have addressed this issue. Thanks for the quick turn-around to you and your team.

  12. cris, Member

    I think this question is similar to the above question. I have a MSColumnLineDY chart and am trying to change the gap color between NULL values. I tried a bunch of different ways:

    select 'dbr.chart.options', 'chartdirector', '$dataset = $layer[1]->getDataSet(1);$dataset->setDataColor($c->setGapColor( 0xFF0000 ));';

    select 'dbr.chart.options', 'chartdirector', '$dataset = $layer[1]->getDataSet(1);$dataset->setDataColor($layer->setGapColor( 0xFF0000 ));';

    select 'dbr.chart.options', 'chartdirector', '$dataset = $layer[1]->getDataSet(1);$dataset->setDataColor($layer->LineLayer.setGapColor( 0xFF0000 ));';

    select 'dbr.chart.options', 'chartdirector', '$dataset = $layer[1]->getDataSet(1);$layer->setGapColor(0xFF0000);';

    Did I at least get close?

    Thanks for the help,

    Cris

  13. myDBR Team, Key Master

    Quite close.

    The $layers contains all the layers from the chart. In MSColumnLineDY-chart, the line-layer is the topmost layer (is shown on top of the bars if they overlap). To set the gap color (and width) you access the topmost layer and call the setGapColor-method.

    select 'dbr.chart.options', 'chartdirector', '$layer[sizeof($layer)-1]->setGapColor(0xC4C4C4,1);';

    --
    myDBR Team


Reply

You must log in to post.