No more legend on pie charts

(5 posts) (2 voices)

Tags:

No tags yet.

  1. Alex35580, Member

    Hi,
    since the last update of MyDBR (OEM license), we do not have legends on pie anymore.

    Please find below our settings and code. If you can help me solving this issue it should be very useful.

    Thanks for your help

    Configuration :
    DB : 10.4.19-MariaDB-1:10.4.19+maria~xenial Server : APACHE2 Modules : Charts (ChartDirector 7.0) Graphviz charts 2.43.0 (0) wkhtmltopdf (0.12.1 (with patched qt)) ionCube PHP loader (12.0.2)

    Example of my code which was running one month ago :
    select 'dbr.title', 'All Graphs'; select 'dbr.chart', 'Pie', 'TOP 5 OF CUSTOMERS SINCE 2020'; select 'dbr.chart.options', 'title_color', '0xFF0000'; select 'dbr.chart.options', 'format', 'PNG'; select 'dbr.chart.options', 'title_font_size', '10'; select 'dbr.chart.options', 'imagechart'; select 'dbr.chart.color', '0x3005C3DD', '0x30384967', '0x309EA2A2', '0x30F2827F', '0x30E03E52', '0x309B6EB6', '0x300075BB', '0x3071B790'; select 'dbr.chart.options', 'font','Arial',7; select 'dbr.chart.options', 'label_font_color', '0xDDFF00'; select 'dbr.chart.options', 'padding_right', 0; select 'dbr.chart.options', 'showValues', 'data'; select 'dbr.chart.options', 'legend.position', 'left'; select 'dbr.subtitle', 'TOP 5 OF CUSTOMERS'; select 'dbr.chart.options', 'pie_label_format', '0'; select 'dbr.chart.options', 'timevalue', 1; SELECT REPLACE(UPPER(COMPANY),'_',' ') as CUSTOMER, SUM(DURATION_SECONDS) as TOTALSECONDS from MYDB.MYTABLE WHERE (COMPANY NOT LIKE "INT_%" AND COMPANY NOT LIKE "GUEST") GROUP BY COMPANY ORDER BY TOTALSECONDS DESC LIMIT 5;

  2. myDBR Team, Key Master

    Hi,
    the Pie chart that use ChartDirector byt deault do not have labels (under any license). The labels are shown in pie sectors.

    You can add a legend wih some additions to your customization (here the modified/added options):

    select 'dbr.chart', 'Pie', 'TOP 5 OF CUSTOMERS SINCE 2020', 800, 400;
    select 'dbr.chart.options', 'chartdirector', '$c->addLegend(0, 140)->setFontColor(0xFF0000);';
    select 'dbr.chart.options', 'radius', 140;
    select 'dbr.chart.options', 'padding_left', 100;

    You can also use chartjs Pie-chart which draws the legends by default.

    --
    myDBR Team

  3. Alex35580, Member

    Thank you, unfortunately, the legend is still empty. Do you have any idea ?

    select 'dbr.title', 'All Graphs'; select 'dbr.chart', 'Pie', 'TOP 5 OF CUSTOMERS SINCE 2020',800,400; -- select 'dbr.chart.options', 'title_color', '0xFF0000'; select 'dbr.chart.color', '0x3005C3DD', '0x30384967', '0x309EA2A2', '0x30F2827F', '0x30E03E52', '0x309B6EB6', '0x300075BB', '0x3071B790'; /* select 'dbr.chart.options', 'font','Arial','7'; select 'dbr.chart.options', 'legend_font','Arial'; select 'dbr.chart.options', 'legend_font_size', '7'; select 'dbr.chart.options', 'legend.position', 'left'; select 'dbr.chart.options', 'label_font_color', '0xDDFF00';*/ select 'dbr.chart.options', 'showValues', '1'; select 'dbr.chart.options', 'chartdirector', '$c->setBackground($c->linearGradientColor(0, 0, 0, 100, 0x99ccff, 0xffffff), 0x888888);'; select 'dbr.chart.options', 'chartdirector', '$c->setRoundedFrame();'; select 'dbr.chart.options', 'chartdirector', '$c->setDropShadow();'; select 'dbr.chart.options', 'chartdirector', '$c->addTitle("TOP 5 OF CUSTOMERS SINCE 2020", "Times New Roman Bold Italic", 18)->setMargin2(0, 0, 16, 0);'; select 'dbr.chart.options', 'chartdirector', '$c->setPieSize(300, 165, 110);'; select 'dbr.chart.options', 'chartdirector', '$c->set3D(25);'; select 'dbr.chart.options', 'chartdirector', '$b = $c->addLegend(500, 175, true, "Arial Bold Italic", 10);'; select 'dbr.chart.options', 'chartdirector', '$b->setAlignment(Left);'; select 'dbr.chart.options', 'chartdirector', '$b->setBackground(Transparent);'; select 'dbr.chart.options', 'chartdirector', '$b->setRoundedCorners();'; select 'dbr.chart.options', 'chartdirector', '$b->setMargin(16);'; select 'dbr.chart.options', 'chartdirector', '$b->setKeySpacing(0, 5);'; select label, value from ( select "totot" as label, 12 as "value" -- SELECT REPLACE(UPPER(COMPANY),'_','-') as label, SUM(DURATION_SECONDS) as value from MYDB.MYTABLE WHERE (COMPANY NOT LIKE "INT_%" AND COMPANY NOT LIKE "GUEST") GROUP BY COMPANY ) X ORDER BY value DESC LIMIT 5;

    https://ibb.co/3d78dGS

    Any idea please ?

  4. myDBR Team, Key Master

    Alex,
    The code itself is ok (other than that you have two titles).

    Most likely you are using PNG charts and your ChartDirector installation is missing fonts. To fix this, copy the fonts directory found in ChartDirector/lib to the PHP extension directory.

    Alternatively you can use SVG-charts which render the chart in the browser and therefore uses client's fonts.

    Btw, you can combine the select 'chartdirector'-options into one option:

    select 'dbr.chart.options', 'chartdirector', '
    $c->setBackground($c->linearGradientColor(0, 0, 0, 100, 0x99ccff, 0xffffff), 0x888888);
    $c->setRoundedFrame();
    $c->setDropShadow();
    $c->addTitle("TOP 5 OF CUSTOMERS SINCE 2020", "Times New Roman Bold Italic", 18)->setMargin2(0, 0, 16, 0);
    $c->setPieSize(300, 165, 110);
    $c->set3D(25);
    $b = $c->addLegend(500, 175, true, "Arial Bold Italic", 10);
    $b->setAlignment(Left);
    $b->setBackground(Transparent);
    $b->setRoundedCorners();
    $b->setMargin(16);
    $b->setKeySpacing(0, 5);
    ';

    --
    myDBR Team

  5. Alex35580, Member

    Thanks for your help, it was well the fonts directory missing in the lib folder

    Have a nice day


Reply

You must log in to post.