• Resolved raypierce

    (@raypierce)


    I have several charts that have queries based on the current year. The charts look at data from our database. On the new year many of the charts are rendered empty since there is no new data for the year. I am unable to access the charts queries to modify them and make a correction. the only way to make our site work is to unpublish the affected charts. But even when unpublished, I cannot access the underlying queries to make corrections. There should be a means to get to the problem queries in the Chart builder.

    I can’t send you a link to the page since unpublishing the charts makes the page load but no charts are viewable. You need to make the code for problem charts available. Currently the only fix I can think of is to delete the charts and rebuild them. That seems like a problematic way to go about fixing a chart.

    The charts in question should simply display a message “No Data”. It seems odd that a chart that has a value of 0 would completely break a website. I have other charts on the site that function this way, displaying a “No Data” Message at the new year.

    • This topic was modified 1 year, 2 months ago by raypierce.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Jasmine

    (@hyenokian)

    Dear @raypierce,

    Thank you for your topic.

    To better assist you, could you please provide the following information so we can check and better understand the issue:

    1. What version of the Chart Builder plugin are you using?
    2. What is your PHP version?
    3. The specific queries being used in the charts.
    4. What type of chart are you using?
    5. Is it connected to an external database?
    6. Are there any specific errors in the error.log related to our plugin?

    Looking forward to hearing from you.

    Thank you.

    Thread Starter raypierce

    (@raypierce)

    The site works fine as long as there is data to retrieve. When the year rolls over, all the data is reset to zero. I use Google Charts on other sites and at the charts simply show the message “No data” until the new year starts getting input to the database

    • What version of the Chart Builder plugin are you using? – Version 20.0.7.1 
    • What is your PHP version? PHP Version ea-php82
    • What type of chart are you using? Pie charts and Vertical bar charts
    • The specific queries being used in the charts. there are nearly 20 charts. The underlying queries are now inaccessible as I mention in my original post. If I place false data into the database the chart query is accessible here is one such sample below. All affected queries are similar in nature.
    • Is it connected to an external database? Yes
    • Are there any specific errors in the error.log related to our plugin? There has been a critical error on this website.

    Sample pie chart query

    SELECT haskellc_diary2.findings.risk, COUNT(haskellc_diary2.findings.risk) AS "COUNT"

    FROM haskellc_diary2.audit

    INNER JOIN haskellc_diary2.findings ON haskellc_diary2.audit.audit_id = haskellc_diary2.findings.aud_id

    WHERE haskellc_diary2.audit.audit_group = "Manager" AND YEAR(haskellc_diary2.audit.date) = YEAR(NOW())

    GROUP BY haskellc_diary2.findings.risk
    Plugin Support Jasmine

    (@hyenokian)

    Dear @raypierce,

    Thank you for your response and detailed information.

    My apologies for the late reply. We were not working on account of the Christmas Holidays.

    As can be understood, the problem comes from the WHERE condition of the SQL query.
    It is written like this: YEAR(NOW())

    It will return the current year, that is 2025. Due to this, the old data (2024) is not displayed on the chart.
    Please change the WHERE condition in the Query and set it like this:

    WHERE haskellc_diary2.audit.audit_group = “Manager” 
    AND (YEAR(haskellc_diary2.audit.date) = YEAR(NOW()) OR YEAR(haskellc_diary2.audit.date) = 2024)

    Then, check the case again and let us know about the outcome.

    Thank you.

    Thread Starter raypierce

    (@raypierce)

    Hi Jasmine,

    I do not want the prior year data (2024) hence the query YEAR(NOW()). At the new year there will be no data. This is as expected. As I mentioned in my original post, I use Google charts on other dashboards to illustrate only the current years data. Those Google charts function by displaying “No Data” at the new year rather than rendering the page as disabled and showing a critical error message. You have told me in the past that yo are also using Google charts for your plugin. You should be able to get the same functionality. Since this is a WordPress site I am unable to implement the Google charts without using a plugin.

    I have pasted the code for a pie chart I use on another dashboard using Google Charts. This chart and many others I have work fine at the new year, displaying “No Data” until the database is populated for the new year. I am not showing the database connection for security reason as you no doubt understand.

    I hope you can help me. It is an issue that would require me to find another way to get the chart functioning at the new year. I am about to retire and don’t want to leave my company with a dashboard that breaks on the next new year.

    I am using a free chart plugin on my wordpress sites that simply shows a zero in bar charts if there is no data for the new year. Or simply a blank chart in the case of Pie charts. But the page is still accessible to view other items of information. I prefer using your plugin as it is more versatile except for this issue. I must manually go into the wordpress dashboard and unpublish the affected charts in order to gain access to any page that has a Chartify chart on it.

    Thank you.

        <script type="text/javascript">

    // Load Charts and the corechart package.
    google.charts.load('current', {'packages':['corechart']});

    // Draw the pie chart for Risk Rating when Charts is loaded.
    google.charts.setOnLoadCallback(drawRiskRatePieChart);

    // Draw the pie chart for Risk Rating2 when Charts is loaded.
    google.charts.setOnLoadCallback(drawRiskRate2Chart);

    // Callback that draws the pie chart for RiskRate1.
    function drawRiskRatePieChart() {



    // Create the data table for RiskRate1.
    var data = google.visualization.arrayToDataTable([
    ['risk', 'count'],
    <?php
    // read all rows from database table
    $sql = "SELECT project, data, rank FROM
    risk_data WHERE project = $project_id ORDER by rank ASC";
    $result = $connection->query($sql);
    //read data of each row
    WHILE($row = $result->fetch_assoc()){
    echo $row["data"] ;
    }
    ?>
    ]);

    // Set options for RiskRate1 pie chart.
    var options = {
    title: 'Audit Deficiency Found',
    colors: ['#31B404', '#f9ab32', '#d332f9', '#FF0000'],
    backgroundColor: 'transparent',
    width: 450,
    height: 350,
    pieHole: 0.3,
    is3D: true
    };

    // Instantiate and draw the chart for RiskRate1.
    var chart = new google.visualization.PieChart(document.getElementById('risk_rate'));

    chart.draw(data, options);
    }

    </script>

    Below is the mySQL view query that pulls the data from the database for the chart above.

    SELECT
    haskellc_diary2.audit.project AS project,
    haskellc_diary2.audit.findings AS rank,
    haskellc_diary2.audit.date AS date,
    CONCAT(
    '[',
    '\'',
    haskellc_diary2.audit.risk,
    '\'',
    ',',
    ' ',
    COUNT(haskellc_diary2.audit.project),
    ']',
    ','
    ) AS data,
    COUNT(0) AS sort
    FROM
    haskellc_diary2.audit
    WHERE
    (
    YEAR(haskellc_diary2.audit.date) = YEAR(NOW()))
    GROUP BY
    haskellc_diary2.audit.risk,
    haskellc_diary2.audit.project
    ORDER BY
    haskellc_diary2.audit.risk
    Plugin Support Jasmine

    (@hyenokian)

    Dear @raypierce,

    Thank you for your reply.

    We’ve noticed that you are using an older version of the plugin. Please make sure to update to the latest version (20.0.9) and check the case again.

    Here is the Update Guide:
    https://ays-pro.com/how-to-update-upgrade-ays-pro-plugins

    You can make a DB backup before upgrading for your safety (you can use UpdraftPlus).

    After updating, kindly check if the issue persists.
    The problem could be related to the older version, and it might have been resolved in the latest release.

    As you are using the Pro version of the plugin, please contact us via this form for premium support. Our customer care specialists will always be happy to help you.
    Commercial products are not supported in these forums.

    Thank you.

    Plugin Support Jasmine

    (@hyenokian)

    Dear @raypierce,

    We’re closing this ticket for now as we last heard from you 1 week ago.

    If the query is unresolved, drop us a line and we’ll get back to you at the earliest and the ticket will be re-opened.
    For a new query, feel free to open a new topic. Our Customer Care Specialists will be happy to help you.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘The New Year Breaks my Charts’ is closed to new replies.