chartdirector options

(2 posts) (2 voices)
  1. -nth-, Member

    I'm attempting to get a chart director piechart to show percentages in the label. By default it's showing the numerical value.

    After reviewing chart director documentation I thought this command would take care of it:


    select 'dbr.chart.options', 'chartdirector', '$layer->setLabelFormat("{label} ({percent}%)");';

    No pie chart displays and it shows this error: Fatal error: Call to a member function setLabelFormat() on a non-object in C:\inetpub\wwwroot\reporting\lib\chart2.php(70) : eval()'d code on line 1

    I'm also trying to move the pie chart labels to the side (they overlap when displayed around the pie chart). After consulting the chartdirector documentation again, I figured this would work:


    select 'dbr.chart.options', 'chartdirector','$piechart->setLabelLayout("SideLayout");';

    But I get no chart and this error: Notice: Undefined variable: piechart in C:\inetpub\wwwroot\reporting\lib\chart2.php(70) : eval()'d code on line 1 Fatal error: Call to a member function setLabelLayout() on a non-object in C:\inetpub\wwwroot\reporting\lib\chart2.php(70) : eval()'d code on line 1

    I figure I'm missing something on how the chartdirector commands translate to mydbr. In a previous example of "setAggregateLabelFormat" the notation in the chartdirector documentation is "layer.setAggregateLabelFormat" but in mydbr it's "layer->setAggregateLabelFormat". I figured then that the other commands would be the same, i.e. change the "." to a "->". Did I miss something in my logic or would this be a case of not having valid data to display?

    Thanks,
    -nth-

  2. myDBR Team, Key Master

    After reviewing chart director documentation I thought this command would take care of it:
    view source
    print?

    select 'dbr.chart.options', 'chartdirector', '$layer->setLabelFormat("{label} ({percent}%)");';

    Simply put:

    select 'dbr.chart.options', 'showvalues', 0;

    This will toggle values into percentages.

    If you want to use setLabelFormat, the setLabelFormat is member of the chart-object so use $c->setLabelFormat

    I'm also trying to move the pie chart labels to the side (they overlap when displayed around the pie chart). After consulting the chartdirector documentation again, I figured this would work:

    select 'dbr.chart.options', 'chartdirector','$piechart->setLabelLayout("SideLayout");';

    setLabelLayout is also member of the chart-object so use the $c->setLabelLayout("SideLayout");

    I figure I'm missing something on how the chartdirector commands translate to mydbr. In a previous example of "setAggregateLabelFormat" the notation in the chartdirector documentation is "layer.setAggregateLabelFormat" but in mydbr it's "layer->setAggregateLabelFormat". I figured then that the other commands would be the same, i.e. change the "." to a "->". Did I miss something in my logic or would this be a case of not having valid data to display?

    Native ChartDirector calls in myDBR are in PHP, where the notation is always $object->method(). Make sure you have PHP version of the ChartDirector documentation.

    As for object variables, myDBR exposes two objects from the chart $c which is the chart-object and $layer which is the layer object. When you manipulate the chart see the ChartDirector class library which object variable to use with the methods.

    Direct ChartDirector calls allow great flexibility when dealing with charts. To keep the report code easy to maintain, try to separate the most often used customizations behind separate procedure call.

    --
    myDBR Team


Reply

You must log in to post.