Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9006717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:29:14+00:00 2026-06-16T01:29:14+00:00

Suppose that I have the PHP function code as below: function.php function PMTA_CHART($contentID, $chartName,

  • 0

Suppose that I have the PHP function code as below:

function.php

 function PMTA_CHART($contentID, $chartName, $file, $order) {
    $cate = '';
    $total = '';
    $fail = '';
    $chart = array();
    $title = "";
    $PercentBlue = 0;
    $PercentRed = 0;
    if (file_exists($file)) {
        $files = fopen($file, 'r');
        while (!feof($files)) {
            $data = explode(";", fgets($files));
            if ($title == "") {
                $title = $data[0];
            }
            if (!empty($data[5])) {
                $cate = $data[5];
                $PercentBlue = ((int)$data[6] - (int)$data[7]);
                $PercentRed = (int)$data[7];
                if (!empty($order)) {
                    $PercentBlue = (100 - (int)$data[8]);
                    $PercentRed = (int)$data[8];
                    $chart[] = array($PercentBlue, $PercentRed, $cate);
                } else {
                    $PercentBlue = (100 - (int)$data[8]);
                    $PercentRed = (int)$data[8];
                    $chart[] = array($PercentRed, $PercentBlue, $cate);
                }
            }
        }
        arsort($chart);
        $cate = '';
        $PercentBlue = 0;
        $PercentRed = 0;
        if (!empty($order)) {
            foreach ($chart as $arr) {
                $cate.= ',' . "'$arr[2]'";
                $PercentBlue.= ',' . $arr[0];
                $PercentRed.= ',' . $arr[1];
            }
        } else {
            foreach ($chart as $arr) {
                $cate.= ',' . "'$arr[2]'";
                $PercentBlue.= ', ' . $arr[1];
                $PercentRed.= ', ' . $arr[0];
            }
        }
        fclose($files);
    } else {
        echo "No such file";
    }
?>       

    <?php echo $chartName ?> = new Highcharts.Chart({
    chart: {
        renderTo: '<?php echo $contentID ?>',
        type: 'column'
    },
    title: {
        text: '<?php echo $title; ?>'
    },
    xAxis: {
        categories: [<?php echo substr($cate, 1); ?>],
        labels: {
            rotation: 90,
            align: 'left'
        }
    },
    yAxis: {
        min: 0,
        title: {
            text: '% envoi'
        }
    },
    tooltip: {
        formatter: function() {
            return ''+
                this.series.name +': '+ this.y +' ('+ Math.round(this.percentage) +'%)';
        }
    },

    plotOptions: {
        column: {
            stacking: 'percent'
        }
    },
        series: [{
        name: 'Total mail succesful',
        data: [<?php echo substr($PercentBlue, 2); ?>]
    }, {
        name: 'Total mail fail',
        data: [<?php echo substr($PercentRed, 2); ?>]
    }]
});

pmtaChart.php

<?php
include('include/function.php');
$pmta3_emetteur_file = '../stats_domain_emetteur.affinitead.net.'.date("Y-m-d").'.txt';
$pmta4_emetteur_file = '../stats_domain_emetteur.switchcall.com.'.date("Y-m-d").'.txt';
$pmta5_emetteur_file = '../stats_domain_emetteur.unitead.eu.'.date("Y-m-d").'.txt';
$order = isset($_POST['txt_order_blue'])?$_POST['txt_order_blue']:'';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chart</title>
<script type="text/javascript" src="js/jquery.min.js"></script> 
<script type="text/javascript">
$(function () {
var chart3, chart4, chart5;
$(document).ready(function() {
    <?php PMTA_CHART('PMTA3', 'chart3', $pmta3_emetteur_file, $order); ?>
    <?php PMTA_CHART('PMTA4', 'chart4', $pmta4_emetteur_file, $order); ?>
    <?php PMTA_CHART('PMTA5', 'chart5', $pmta5_emetteur_file, $order); ?>
});

});
</script>
</head>

<body>
<script src="js/highcharts.js"></script>
<script src="js/exporting.js"></script>
<form action="pmtaEmetteur.php" method="post">
<input type="submit" name="txt_order_red" id="txt_order_red" title="Order Red" value="Order Red"/>
<input type="submit" name="txt_order_blue" id="txt_order_blue" title="Order blue" value="Order blue"/>
</form>
<div id="PMTA3" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
<div id="PMTA4" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
<div id="PMTA5" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>

As you see in code I have 2 buttons, order red and order blue,when I click on button order red it will sort red,and click on button blue it will sort bluePlease see this but when I mouse over on the bar chart I need to display Total mail successful : 700 (70 %) and Total mail fail 300(30%) but in this chart it not the same what I need it displays Total mail successful : 70(70%) and Total mail fail : 30(30%).

Note:

All data I read from the file as you see in my code.This is example text in file:

2012-12-19-0230;affinitead.net;557469;141107;25.31;boulevard-des-ventes.com;370873;116793;31.49
2012-12-19-0230;affinitead.net;557469;141107;25.31;tendancity.com;53296;13121;24.61
2012-12-19-0230;affinitead.net;557469;141107;25.31;friendcorp.fr;34365;4086;11.89
2012-12-19-0230;affinitead.net;557469;141107;25.31;messengear.fr;32068;1227;3.82
2012-12-19-0230;affinitead.net;557469;141107;25.31;affinimail.com;27415;2231;8.13
2012-12-19-0230;affinitead.net;557469;141107;25.31;diffitalia.com;2;0;0
.................................................................................
.................................................................................
.................................................................................

I can not find the solution, anyone know pleas help me, Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:29:15+00:00Added an answer on June 16, 2026 at 1:29 am

    Change the tooltip formatter to:

    this.series.name +': '+ this.y +' ('+ Math.round(this.percentage * 10) +'%)';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that I have below code: <?php $html = ' <form id=formA> <!-- Form
Suppose that I have the PHP function as below: function.php <?php function getDataInFile($PMTA_FILE){ $PMTA_DATE
Suppose that I have the PHP code as below: class modual { public $glo;
Suppose I have a example.php file like that: <p> <?php echo _('Hello world') ?>
I have the php webservice code below, what I am suppose to do, so
Suppose that you have a function f: List a -> a such that f
Suppose that we have file like this: sometext11 sometext12 sometext13 sometext21 sometext22 sometext23 Texts
I have a jquery code below which is displayed in the editsessionadmin.php page. Now
Suppose I have a PHP script that returns a json response. It looks something
Suppose we have following function in PHP: public function testSomething() { $name = perform_sql_query("SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.