wkhtmltopdf conflicting with chart.scale

(4 posts) (2 voices)

Tags:

  1. shem, Member

    My report on the web page shows a Pie Chart and a Bar chart side by side.
    It worked fine both on the web page and in the PDF export.
    But then I updated my wkhtmltopdf to the version with QT patches.
    Now, the web page still works nicely.
    However, when I export to PDF, the Bar Chart disappears.

    My report code is as follows:
        # BAR CHART
        select 'dbr.chart', 'Column', '2D Column';
        select 'dbr.chart.options', 'chart.scale', 40; # With wkhtmltopdf QT version this causes the bar chart to disappear in PDF
        SELECT  `Lateness Category`, COUNT(`Lateness Category`) AS `value`, COUNT(`Lateness Category`)
        FROM tmp_table_aging
        GROUP BY `Lateness Category`;

    In doing some testing, I found that removing the line
    select 'dbr.chart.options', 'chart.scale', 40;
    will allow the Bar Chart to be displayed, even with the wkhtmltopdf QT version

    But I need this command in order to decrease the size of the Bar chart so that my Pie Chart and Bar Chart can fit on the page side by side.
    If I don't have it, then they appear one above the other.
    Do you have an alternative to select 'dbr.chart.options', 'chart.scale', 40;?
    p.s.  If I try adding percentages to the first line above e.g.
    select 'dbr.chart', 'Column', '2D Column', '40%', '40%';
    then it also disappears on the PDF export.

    Another unrelated question I have is about my Pie Chart.
        # PIE CHART
        select 'dbr.chart', 'Pie';
        select 'dbr.colstyle', 'value', '{percent|1}% {value}';
        SELECT  `Lateness Category`, COUNT(`Lateness Category`) AS `value`, COUNT(`Lateness Category`)
        FROM tmp_table_aging
        GROUP BY `Lateness Category`;

    It displays on the page nicely, with percentages next to each slice of the pie.
    And When I hover over the mouse, it also displays which grouping the slice belongs to.
    However, when I export to PDF I don't have, of course, the effect of hovering with the mouse.
    Can I display the groupings on the side - per slice color?
    I know that if use chart.js instead of ChartDirector then it will do that, but I want to use ChartDirector.

  2. myDBR Team, Key Master

    The format

    select 'dbr.chart', 'Column', '2D Column', '40%', '40%'; 

    should work. Check a demo

    You can use fixed sizes for the chart. Probably better if you have fixed size for your report element.

    select 'dbr.chart', 'Column', '2D Column', 300, 200;

    It displays on the page nicely, with percentages next to each slice of the pie.
    And When I hover over the mouse, it also displays which grouping the slice belongs to.
    However, when I export to PDF I don't have, of course, the effect of hovering with the mouse.
    Can I display the groupings on the side - per slice color?

    You can show the categore name within your column style:

    select 'dbr.colstyle', 'value', "{percent|1}% {value}\n[name]";

    SELECT  `Lateness Category` as 'name', COUNT(`Lateness Category`) AS `value`, COUNT(`Lateness Category`)
    FROM tmp_table_aging
    GROUP BY `Lateness Category`;

    --
    myDBR Team

  3. shem, Member

    Thank you very much.
    Just curious.
    Why is it "Probably better if you have fixed size for your report element."?

  4. myDBR Team, Key Master

    The default size may change. If you set a fixed size for the chart, it will fit into the space you have reserved.

    --
    myDBR Team


Reply

You must log in to post.