Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 与flot饼图重叠的图例_Php_Flot - Fatal编程技术网

Php 与flot饼图重叠的图例

Php 与flot饼图重叠的图例,php,flot,Php,Flot,在我的网站上,我在标签中使用Flot饼图。在每个选项卡中,图例都出现在饼图上。我不明白我错在哪里。谁能帮帮我吗。我附上了屏幕截图 我的代码: <script src="assets/plugins/jquery-1.10.1.min.js" type="text/javascript"></script> <script src="assets/plugins/flot/jquery.flot.js"></script&

在我的网站上,我在标签中使用Flot饼图。在每个选项卡中,图例都出现在饼图上。我不明白我错在哪里。谁能帮帮我吗。我附上了屏幕截图

我的代码:

    <script src="assets/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>
            <script src="assets/plugins/flot/jquery.flot.js"></script>
            <script src="assets/plugins/flot/jquery.flot.pie.js"></script>
        <script src="assets/plugins/flot/jquery.flot.resize.js"></script>
        <script src="assets/plugins/flot/jquery.flot.stack.js"></script>
        <script src="assets/plugins/flot/jquery.flot.crosshair.js"></script>
    <?php
    mysql_select_db($database_finalkms, $finalkms);
    $query_getdata2 = "SELECT ComplianceStatus,count FROM indexonboard WHERE zone='PZ' and country is NULL";
    $getdata2 = mysql_query($query_getdata2, $finalkms) or die(mysql_error());
    $row_getdata2 = mysql_fetch_assoc($getdata2);
    $totalRows_getdata2 = mysql_num_rows($getdata2);
    ?>  


    <script>

    jQuery(document).ready(function() {
            Charts1.initPieCharts();

                });
    </script>
    <?php $m=0;do {?>
    <input name="grptst5<?php echo $m; ?>" id="grptst5<?php echo $m; ?>" type="hidden" value="<?php echo $row_getdata2['ComplianceStatus']; ?>" />
    <input name="datatst5<?php echo $m; ?>" id="datatst5<?php echo $m; ?>" type="hidden" value="<?php echo $row_getdata2['count']; ?>" />
    <?php $m++;} while($row_getdata2 = mysql_fetch_assoc($getdata2));?>
    <input name="totali5" id="totali5" type="hidden" value="<?php echo $totalRows_getdata2; ?>" />
    <?php
    mysql_free_result($getdata2);
    ?>
    <div id="interactive5" class="chart" style="
    width:400px;height: 400px;;float:right;"></div>
    <script>
    var Charts1 = function () { //1st


        return { //2nd
            //main function to initiate the module

            init: function () {  //3rd

                App.addResponsiveHandler(function () {  //4th
                     Charts1.initPieCharts(); 

                });  //4th

            },  //3rd

            initPieCharts: function () {
                var totalid5=$("#totalid5").val();
    var data4 =[];
    for (var n = 0; n < totali5; n++) {
                    var one4=document.getElementById("grptst5" + n).value;


                    var two4 =document.getElementById("datatst5" + n).value;


                    data4[n] = {
                        label: one4,
                        data: two4
                    }
                }
    $.plot($("#interactive"), data, { 
        series: {
             pie: {
                 show: true,
                 label: {
                     show: true,
                     formatter: function(label,point){
                         return(point.percent.toFixed(2) + '%');

                     }
                 }
            }
        },      
        colors: ["#00FF00","#FF9933","#6495ED","#B0B0B0"],
        legend: {show: true,

                backgroundOpacity:0,
                sorted:"comparator"
                }
    });

                $("#interactive").bind("plothover", pieHover);
        function pieHover(event, pos, obj) {
                if (!obj)
                        return;
                   percent = parseFloat(obj.series.percent).toFixed(2);
                    $("#hover").html('<span style="font-weight: bold; color: ' + obj.series.color + '">' + obj.series.label + ' </span>');
                }
    }
 }; //2nd


}();  //1st


我认为问题在于标签太长和/或宽度太小。尝试扩展div宽度

<div id="placeholder" style="width:500px;height:300px;"></div>

拨弄-