国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

php+echarts實現數據可視化實例3

這篇具有很好參考價值的文章主要介紹了php+echarts實現數據可視化實例3。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

?效果

php+echarts實現數據可視化實例3,php,echarts,php

全部代碼

<?php
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/e-kanban/index.css">
    <script src="./js/jquery-2.1.0.js" type="text/javascript"></script>
    <script src="./js/echarts.js" type="text/javascript"></script>
    <title>電子看板</title>
</head>

<body>
    <div class="head">
        <h1 class="all_title">采購看板</h1>
    </div>
    <div class="kanban_all">
        <div class="kanban_all_position">
            <div class="kanban_item">
                <div class="kanban_line">
                    <div class="kanban_title">
                        近一月供應商新增采購單含稅金額前五榜單
                    </div>
                    <div class="kanban_content">
                        <table>
                            <tr>
                                <td>
                                    <div id="poruku" style="width:100%;height:220px;"></div>
                                </td>
                                <td>
                                    <div style="width: 30px; height:220px;"></div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            <div class="kanban_item">
                <div class="kanban_line">
                    <div class="kanban_title">
                        近一月不同采購類型的含稅總金額
                    </div>
                    <div class="kanban_content">
                        <div class="kanban_content_left">
                            <table>
                                <tr>
                                    <td>
                                        <div id="poruku1" style="width:100%;height:220px;"></div>
                                    </td>
                                    <td>
                                        <div style="width: 30px; height:220px;"></div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="kanban_content_right">
                            <div>
                                <ul>
                                    <li style="color:#73c0de"><span id="yewu_top1"></span></li>
                                    <li style="color:#fd6f6f"><span id="yewu_top2"></span></li>
                                    <li style="color:#fac858"><span id="yewu_top3"></span></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="kanban_item">
                <div class="kanban_line">
                    <div class="kanban_title">
                        近一周新增采購單含稅金額分析
                    </div>
                    <div class="kanban_content">
                        <table>
                            <tr>
                                <td>
                                    <div id="poruku2" style="width:100%;height:220px;"></div>
                                </td>
                                <td>
                                    <div style="width: 30px; height:220px;"></div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            <div class="kanban_item">
                <div class="kanban_line_double">
                    <div class="right">
                        <div class="kanban_line">
                            <div class="kanban_title">
                                近一月產品新增采購單含稅金額前五榜單
                            </div>
                            <div class="kanban_content">
                                <div class="kanban_content_left1">
                                    <table>
                                        <tr>
                                            <td>
                                                <div id="poruku4" style="width:100%;height:220px;"></div>
                                            </td>
                                            <td>
                                                <div style="width: 30px; height:220px;"></div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="kanban_content_right1">
                                    <div>
                                        <ul>
                                            <li style="color:#73c0de">Top1:<span id="cus_delivery_top1"></span></li>
                                            <li style="color:#fd6f6f">Top2:<span id="cus_delivery_top2"></span></li>
                                            <li style="color:#fac858">Top3:<span id="cus_delivery_top3"></span></li>
                                            <li style="color:#91cc75">Top4:<span id="cus_delivery_top4"></span></li>
                                            <li style="color:#5470c6">Top5:<span id="cus_delivery_top5"></span></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="middle"></div>
                    <div class="left">
                        <div class="kanban_line">
                            <div class="kanban_title">
                                近一月供應商入庫數量前五榜單
                            </div>
                            <div class="kanban_content">
                                <div class="kanban_content_left1">
                                    <table>
                                        <tr>
                                            <td>
                                                <div id="poruku3" style="width:100%;height:220px;"></div>
                                            </td>
                                            <td>
                                                <div style="width: 30px; height:220px;"></div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="kanban_content_right1">
                                    <div>
                                        <ul>
                                            <li style="color:#73c0de">Top1:<span id="vendor_top1"></span></li>
                                            <li style="color:#fd6f6f">Top2:<span id="vendor_top2"></span></li>
                                            <li style="color:#fac858">Top3:<span id="vendor_top3"></span></li>
                                            <li style="color:#91cc75">Top4:<span id="vendor_top4"></span></li>
                                            <li style="color:#5470c6">Top5:<span id="vendor_top5"></span></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="kanban_item">
                <div class="kanban_line">
                    <div class="kanban_title">
                        近一月未入庫采購單
                    </div>
                    <div class="kanban_content scroll" style="overflow-y: auto; max-height: 200px;">
                        <?php
                        $time = time();
                        $sql5 = 'SELECT pha.po_num, pha.status, pha.note,  pla.chang,pla.kuan,pla.gao,pla.depart_name,pla.line_amount,pla.quantity,pla.line,pla.price,v.vendor_code, v.vendor_name, pla.need_date, pha.created_by,pha.creation_date,b.item_no,b.item_desc,b.item_name,b.units,
                                ifnull(pla.quantity_received,0) this_received
                                FROM po_headers_all pha, po_lines_all pla, vendors v,sf_item_no b
                                WHERE pla.po_num = pha.po_num
                                AND  b.item_no=pla.stockid
                                and pla.quantity-pla.quantity_received>0
                                AND v.vendor_code = pha.vendor_code ';
                        $sql5 .= " and pha.status = '已簽核'";
                        $sql5 .= " order by pha.creation_date  DESC";
                        $result5 = DB_query($sql5, $db);
                        // 檢查查詢是否成功
                        if ($result5) {
                            // 檢查查詢結果是否為空
                            if (mysqli_num_rows($result5) > 0) {
                        ?>
                                <table class="table1">
                                    <tr>
                                        <th class="th1">供應商代碼</th>
                                        <th class="th2">采購單號</th>
                                        <th class="th1">料號</th>
                                        <th class="th3">采購數量</th>
                                        <th class="th3">收貨量</th>
                                        <th class="th3">待收量</th>
                                        <th class="th2">建立日期</th>
                                    </tr>
                                    <?php
                                    while ($row = mysqli_fetch_assoc($result5)) {
                                    ?>
                                        <tr>
                                            <td class="td1"><?php echo $row['vendor_code']; ?></td>
                                            <td class="td2"><?php echo $row['po_num']; ?></td>
                                            <td class="td3"><?php echo $row['item_no']; ?></td>
                                            <td class="td3"><?php echo $row['quantity']; ?></td>
                                            <td class="td3"><?php echo $row['this_received']; ?></td>
                                            <td class="td3"><?php echo ($row['quantity'] - $row['this_received']); ?></td>
                                            <td class="td2"><?php echo date('Y-m-d', $row['creation_date']); ?></td>
                                        </tr>
                                    <?php
                                    }
                                    ?>
                                </table>
                                <script>
                                    //懸停
                                    // // JavaScript函數:停止?jié)L動
                                    // function stopScroll() {
                                    //     var table = document.querySelector('.scroll table');
                                    //     table.style.animationPlayState = 'paused';
                                    // }
                                    // // JavaScript函數:開始滾動
                                    // function startScroll() {
                                    //     var table = document.querySelector('.scroll table');
                                    //     table.style.animationPlayState = 'running';
                                    // }
                                </script>
                        <?php
                            } else {
                                echo "No results found.";
                            }
                        } else {
                            echo "Query failed.";
                        }
                        ?>
                    </div>
                </div>
            </div>
            <div class="kanban_item">
                <div class="kanban_line_double">
                    <div class="left">
                        <div class="kanban_line">
                            <div class="kanban_title">
                                近一月不同倉庫入庫數量前五榜單
                            </div>
                            <div class="kanban_content">
                                <table>
                                    <tr>
                                        <td>
                                            <div id="poruku6" style="width:100%;height:220px;"></div>
                                        </td>
                                        <td>
                                            <div style="width: 30px; height:220px;"></div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="middle"></div>
                    <div class="right">
                        <div class="kanban_line">
                            <div class="kanban_title">
                                近一月產品入庫數量前五榜單
                            </div>
                            <div class="kanban_content">
                                <div class="kanban_content_left1">
                                    <table>
                                        <tr>
                                            <td>
                                                <div id="poruku7" style="width:100%;height:220px;"></div>
                                            </td>
                                            <td>
                                                <div style="width: 30px; height:220px;"></div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="kanban_content_right1">
                                    <div>
                                        <ul>
                                            <li style="color:#73c0de">Top1:<span id="product_delivery_top1"></span></li>
                                            <li style="color:#fd6f6f">Top2:<span id="product_delivery_top2"></span></li>
                                            <li style="color:#fac858">Top3:<span id="product_delivery_top3"></span></li>
                                            <li style="color:#91cc75">Top4:<span id="product_delivery_top4"></span></li>
                                            <li style="color:#5470c6">Top5:<span id="product_delivery_top5"></span></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
</body>

</html>




<?php
// 近一月供應商新增采購單含稅金額
$sql = "SELECT po.vendor_code,ve.vendor_name, 
            SUM(po_all_amount) AS total_amount
        FROM po_headers_all po,vendors ve
        WHERE po.creation_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
        AND po.vendor_code = ve.vendor_code
        GROUP BY vendor_code
        ORDER BY total_amount desc
        LIMIT 5
";
$result = DB_query($sql, $db);

while ($array = mysqli_fetch_assoc($result)) {
    $arrays[] = $array;
}

if (is_array($arrays)) {
    foreach ($arrays as $key => $value) {
        $vendor[]  = $value['vendor_code'];
        $amount[]  = $value['total_amount'];
    }
} else {
    $vendor[]  = 0;
    $amount[]  = 0;
}
sort($amount);
echo "<script>";
echo ";   var vendor = ";
echo json_encode($vendor);
echo "; var amount = ";
echo json_encode($amount);
echo ";  
    var myChart = echarts.init(document.getElementById('poruku')); 
    option = {         
        //圖形顏色
        color: [
            '#05c798'
        ],
        //提示框,鼠標懸停在圖形上的注解
        tooltip: {
            trigger: 'axis',
            axisPointer: {            
                type: 'line'       
            },
            backgroundColor: 'rgba(255, 255, 255, 0.7)', // 設置提示條的背景顏色
            textStyle: {
                color: 'rgba(0, 0, 0)', // 設置提示條文本的顏色為白色
                fontSize: 14 // 設置提示條文本的字體大小為12px
            }
        },
        //配置網格組件,用于定義圖表的位置和大小
        grid: {
            top: '15%',  // 增加top的值來創(chuàng)建間距
            left: '1%',
            right: '10%',
            bottom: '2%',  // 增加bottom的值來創(chuàng)建間距
            containLabel: true, //自動計算并包含坐標軸標簽、刻度和標題等內容在內。
        },
        //橫坐標
         xAxis: {
            name: '含稅金額',
            type: 'value', //數據類型為數值型。
            axisLine: {
                lineStyle: {
                    color: '#6691b5'  // 設置 x 坐標軸線的顏色
                }
            },
            axisLabel: {
                fontSize: 14  // 設置橫軸標簽字體大小為14
            },
            nameTextStyle: {
                fontSize: 14  // 設置橫軸名稱字體大小為14
            },
            splitLine: {
                show: false  // 隱藏縱坐標軸的背景橫線
            },   
        },
        //縱坐標
        yAxis: [
            {
                name: '供應商',
                type: 'category', //橫坐標數據類型為類別型,適用于離散的數據
                data: vendor,
                axisLine: {
                    lineStyle: {
                        color: '#6691b5'  // 設置 x 坐標軸線的顏色
                    }
                },
                axisLabel: {
                    fontSize: 14  // 設置橫軸標簽字體大小為14
                },
                nameTextStyle: {
                    fontSize: 14  // 設置橫軸名稱字體大小為14
                }
            },
            
        ],
        series: [
            {
                type: 'bar',
                barWidth: '15',
                data: amount, //設置橫坐標的數據,使用變量中的數據。   
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'right',
                            textStyle: {
                                color: '#6691b5',
                                fontSize: 14
                            }
                        }
                    }
                }
            },
        ],
    };
    let currentIndex = -1;
    setInterval(function() {
        var dataLen = option.series[0].data.length;
        // 取消之前高亮的圖形
        myChart.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex
        });
        currentIndex = (currentIndex + 1) % dataLen;
        // 高亮當前圖形
        myChart.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex
        });
        // 顯示 tooltip
        myChart.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex
        });
    }, 1000);
    myChart.setOption(option);    
    </script>";

//近一月不同采購類型的含稅總金額
$sql1 = "SELECT po.order_type,po.po_all_amount,
        SUM(po.po_all_amount) AS total_amount
        FROM po_headers_all po
        WHERE po.creation_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
        GROUP BY po.order_type
        ORDER BY total_amount desc
        LIMIT 5
";
$result1 = DB_query($sql1, $db);
$index = 1;
while ($array1 = mysqli_fetch_assoc($result1)) {
    $name = $array1['order_type'];
    $value = $array1['total_amount'];
    $title = 'TOP' . $index;
    if (!$value) {
        $value = 0;
    }
    $array_data1[] = array(
        'name' => $name,
        'value' => $value,
        'title' => $title
    );
    $index++;
}
echo "<script>";
// echo "console.log(" . json_encode($array_data1) . ");";
echo ";   var array1 = ";
echo json_encode($array_data1);
// 對數據項數量進行判斷
$arrayLength = count($array_data1);
for ($i = 1; $i <= 3; $i++) {
    //輸出數據到前端顯示
    echo "
    if (array1[" . ($i - 1) . "]) {
        document.getElementById('yewu_top" . $i . "').innerText = array1[" . ($i - 1) . "].name + ':' + array1[" . ($i - 1) . "].value;
    } else {
        document.getElementById('yewu_top" . $i . "').innerText = '--';
    }
    ";
}
echo "; 
    var ydata = []
    var myChart1 = echarts.init(document.getElementById('poruku1')); 
    option1 = {
        color:['#73c0de','#fd6f6f','#fac858','#91cc75','#5470c6'],
        tooltip: {
            trigger: 'item',
            formatter: function(params) {
                var name = params.data.name;
                var title = params.data.title;
                var value = params.value;
                var marker = params.marker; // 添加marker(小圓點)
                return marker + ' ' + title + '<br/>' + name + ' : ' + value;
            }
        },
        series: [
            {
                type: 'pie',
                data:array1,
                roseType: 'area',
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            textStyle: {
                                fontSize: 16
                            }
                        }
                    }
                }
            }
        ]
    };  
    myChart1.setOption(option1);    
    </script>";

//近一周新增采購單含稅金額分析
$sql2 = "   SELECT DATE_FORMAT(date_table.date, '%Y-%m-%d') AS date, COALESCE(SUM(po_headers_all.po_all_amount), 0) AS total_amount
            FROM (
                SELECT DATE_SUB(CURDATE(), INTERVAL n DAY) AS date
                FROM (
                    SELECT a.N + b.N * 10 AS n
                    FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS a
                    CROSS JOIN (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS b
                    ORDER BY n DESC
                ) AS numbers
                WHERE n <= 6 -- 指定查詢的天數
            ) AS date_table
            LEFT JOIN po_headers_all ON DATE(FROM_UNIXTIME(po_headers_all.creation_date)) = date_table.date
            GROUP BY date_table.date
            ORDER BY date_table.date
        ";
$result2 = DB_query($sql2, $db);
while ($array2 = mysqli_fetch_assoc($result2)) {
    $arrays2[] = $array2;
}
if (is_array($arrays2)) {
    foreach ($arrays2 as $key => $value) {
        $date2[]  = $value['date'];
        $total_amount2[]  = $value['total_amount'];
    }
} else {
    $date2[] = 0;
    $total_amount2[] = 0;
}

echo "<script>";
// echo "console.log(" . json_encode($date2) . ");";
// echo "console.log(" . json_encode($total_amount2) . ");";
echo ";   var date2 = ";
echo json_encode($date2);
echo ";   var total_amount2 = ";
echo json_encode($total_amount2);
echo "; 
    var ydata = []
    var myChart2 = echarts.init(document.getElementById('poruku2')); 
    option2 = {
        //配置網格組件,用于定義圖表的位置和大小
        grid: {
            top: '15%',  // 增加top的值來創(chuàng)建間距
            left: '4%',
            right: '6%',
            bottom: '2%',  // 增加bottom的值來創(chuàng)建間距
            containLabel: true, //自動計算并包含坐標軸標簽、刻度和標題等內容在內。
        },
        color:['#fd6f6f'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {            
                type: 'line'       
            },
            backgroundColor: 'rgba(255, 255, 255, 0.7)', // 設置提示條的背景顏色
            textStyle: {
                color: 'rgba(0, 0, 0)', // 設置提示條文本的顏色為白色
                fontSize: 14 // 設置提示條文本的字體大小為12px
            }
        },
        xAxis: {
            name:'日期',
            data: date2,
            axisLine: {
                lineStyle: {
                    color: '#6691b5'  // 設置 x 坐標軸線的顏色
                }
            },
            // axisLabel: {
            //     fontSize: 14  // 設置橫軸標簽字體大小為14
            // },
            nameTextStyle: {
                fontSize: 14  // 設置橫軸名稱字體大小為14
            }
        },
        yAxis: {
            name:'含稅金額',
            splitLine: {
                show: false  // 隱藏縱坐標軸的背景橫線
            },
            axisLine: {
                lineStyle: {
                    color: '#6691b5'  // 設置 x 坐標軸線的顏色
                }
            },
            axisLabel: {
                fontSize: 14  // 設置橫軸標簽字體大小為14
            },
            nameTextStyle: {
                fontSize: 14  // 設置橫軸名稱字體大小為14
            }
        },
        series: [
            {              
                type: 'scatter',
                symbolSize: 22,   // 固定的散點大小,可以根據需要調整
                data: total_amount2,               
            },          
        ]
    };
    let currentIndex2 = -1;
    setInterval(function() {
        var dataLen2 = option2.series[0].data.length;
        // 取消之前高亮的圖形
        myChart2.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex2
        });
        currentIndex2 = (currentIndex2 + 1) % dataLen2;
        // 高亮當前圖形
        myChart2.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex2
        });
        // 顯示 tooltip
        myChart2.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex2
        });
    }, 1000);
    myChart2.setOption(option2);    
    </script>";

//計算近一月供應商入庫數量榜單
$sql3 = "   SELECT a.vendor_code,d.vendor_name,SUM(prt.transaction_quantity) as quantity
            FROM po_headers_all a, po_lines_all b, sf_item_no c, vendors d, po_rcv_transactions prt,po_rcv_receipt_line prr
            WHERE  a.po_num = b.po_num
            AND a.vendor_code = d.vendor_code
            AND b.po_num = prt.po_num
            AND prr.receipt_num=prt.receipt_num
            AND prt.po_num=prr.po_num
            AND prt.po_line=prr.po_line 
            AND b.stockid=prr.stockid
            AND prt.transaction_type in ('RECEIVE')
            AND b.line = prt.po_line
            AND b.stockid = c.item_no  
            AND prt.transaction_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
            GROUP BY vendor_code
            ORDER BY prt.transaction_quantity desc
            LIMIT 5
";


$result3 = DB_query($sql3, $db);
$index = 1;
while ($array3 = mysqli_fetch_assoc($result3)) {
    $name = $array3['vendor_name'];
    $value = $array3['quantity'];
    $title = 'TOP' . $index;
    if (!$value) {
        $value = 0;
    }
    $array_data3[] = array(
        'name' => $name,
        'value' => $value,
        'title' => $title
    );
    $index++;
}
echo "<script>";
// echo "console.log(" . json_encode($array_data3) . ");";
echo ";   var array3 = ";
echo json_encode($array_data3);
// 對數據項數量進行判斷
$arrayLength = count($array_data3);
for ($i = 1; $i <= 5; $i++) {
    //輸出數據到前端顯示
    echo "
    if (array3[" . ($i - 1) . "]) {
        document.getElementById('vendor_top" . $i . "').innerText = array3[" . ($i - 1) . "].name ;
    } else {
        document.getElementById('vendor_top" . $i . "').innerText = '--';
    }
    ";
}
echo "; 
    var ydata = []
    var myChart3 = echarts.init(document.getElementById('poruku3')); 
    option3 = {
        color:['#73c0de','#fd6f6f','#fac858','#91cc75','#5470c6'],
        tooltip: {
            trigger: 'item',
            formatter: function(params) {
                var name = params.data.name;
                var title = params.data.title;
                var value = params.value;
                var marker = params.marker; // 添加marker(小圓點)
                return marker + ' ' + title + '<br/>' + name + ' : ' + value;
            }
        },
        series: [
            {
                type: 'pie',
                radius: '60%',
                // center: ['50%', '60%'],
                data: array3,
                emphasis: {
                    itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)',
                    label: {
                            show: true
                        },
                        labelLine: {
                            show: false
                        }
                    }
                },  
                itemStyle: {
                    normal: {
                        label: {
                            show: false
                        },
                        labelLine: {
                            show: false
                        }
                    },
                }             
            }
        ]
    };
    let currentIndex3 = -1;
    setInterval(function() {
        var dataLen3 = option3.series[0].data.length;
        // 取消之前高亮的圖形
        myChart3.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex3
        });
        currentIndex3 = (currentIndex3 + 1) % dataLen3;
        // 高亮當前圖形
        myChart3.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex3
        });
        // 顯示 tooltip
        myChart3.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex3
        });
    }, 1000);
    myChart3.setOption(option3);    
    </script>";


// 近一月產品新增采購單含稅金額
$sql4 = "   SELECT po.stockid,sf.item_name,SUM(line_amount) AS total_amount
            FROM po_lines_all po,sf_item_no sf
            WHERE po.stockid = sf.item_no
            AND po.creation_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
            GROUP BY stockid
            ORDER BY total_amount desc
            LIMIT 5
        ";
$result4 = DB_query($sql4, $db);
$index = 1;
while ($array4 = mysqli_fetch_assoc($result4)) {
    $name = $array4['stockid'];
    $value = $array4['total_amount'];
    $title = 'TOP' . $index;
    if (!$value) {
        $value = 0;
    }
    $array_data4[] = array(
        'name' => $name,
        'value' => $value,
        'title' => $title
    );
    $index++;
}
echo "<script>";
// echo "console.log(" . json_encode($array_data4) . ");";
echo ";   var array4 = ";
echo json_encode($array_data4);
// 對數據項數量進行判斷
$arrayLength = count($array_data4);
for ($i = 1; $i <= 5; $i++) {
    //輸出數據到前端顯示
    echo "
    if (array4[" . ($i - 1) . "]) {
        document.getElementById('cus_delivery_top" . $i . "').innerText = array4[" . ($i - 1) . "].name ;
    } else {
        document.getElementById('cus_delivery_top" . $i . "').innerText = '--';
    }
    ";
}
echo "; 
    var ydata = []
    var myChart4 = echarts.init(document.getElementById('poruku4')); 
    option4 = {
        color:['#73c0de','#fd6f6f','#fac858','#91cc75','#5470c6'],
        tooltip: {
            trigger: 'item',
            formatter: function(params) {
                var name = params.data.name;
                var title = params.data.title;
                var value = params.value;
                var marker = params.marker; // 添加marker(小圓點)
                return marker + ' ' + title + '<br/>' + name + ' : ' + value;
            }
        },
        series: [
            {
                type: 'pie',
                radius: '60%',
                // center: ['50%', '60%'],
                data: array4,
                emphasis: {
                    itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)',
                    label: {
                            show: true
                        },
                        labelLine: {
                            show: false
                        }
                    }
                },  
                itemStyle: {
                    normal: {
                        label: {
                            show: false
                        },
                        labelLine: {
                            show: false
                        }
                    },
                }             
            }
        ]
    };
    let currentIndex4 = -1;
    setInterval(function() {
        var dataLen4 = option4.series[0].data.length;
        // 取消之前高亮的圖形
        myChart4.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex4
        });
        currentIndex4 = (currentIndex4 + 1) % dataLen4;
        // 高亮當前圖形
        myChart4.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex4
        });
        // 顯示 tooltip
        myChart4.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex4
        });
    }, 1000);
    myChart4.setOption(option4);    
    </script>";

//近一月不同倉庫入庫數量
$sql6 = "   SELECT prr.subinventory_code,SUM(prt.transaction_quantity) as quantity
            FROM po_headers_all a, po_lines_all b, sf_item_no c, vendors d, po_rcv_transactions prt,po_rcv_receipt_line prr
            WHERE  a.po_num = b.po_num
            AND a.vendor_code = d.vendor_code
            AND b.po_num = prt.po_num
            AND prr.receipt_num=prt.receipt_num
            AND prt.po_num=prr.po_num
            AND prt.po_line=prr.po_line 
            AND b.stockid=prr.stockid
            AND prt.transaction_type in ('RECEIVE')
            AND b.line = prt.po_line
            AND b.stockid = c.item_no  
            AND prt.transaction_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
            GROUP BY subinventory_code
            ORDER BY prt.transaction_quantity desc
            LIMIT 5
";
$result6 = DB_query($sql6, $db);
while ($array6 = mysqli_fetch_assoc($result6)) {
    $arrays6[] = $array6;
}
if (is_array($arrays6)) {
    foreach ($arrays6 as $key => $value) {
        $subinventory_code6[]  = $value['subinventory_code'];
        $quantity6[]  = $value['quantity'];
    }
} else {
    $subinventory_code6[]  = 0;
    $quantity6[]  = 0;
}
echo "<script>";
echo ";   var subinventory_code6 = ";
echo json_encode($subinventory_code6);
echo ";   var quantity6 = ";
echo json_encode($quantity6);

echo "; 
    var data = []; 
    var myChart6 = echarts.init(document.getElementById('poruku6')); 
    option6 = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            
                type: 'line'       
            },
            backgroundColor: 'rgba(255, 255, 255, 0.7)', // 設置提示條的背景顏色
            textStyle: {
                color: 'rgba(0, 0, 0)', // 設置提示條文本的顏色為白色
                fontSize: 14 // 設置提示條文本的字體大小為12px
            }
        },
        color:['#3097b9'],
        //配置網格組件,用于定義圖表的位置和大小
        grid: {
            top: '15%',  // 增加top的值來創(chuàng)建間距
            left: '1%',
            right: '12%',
            bottom: '1%',  // 增加bottom的值來創(chuàng)建間距
            containLabel: true, //自動計算并包含坐標軸標簽、刻度和標題等內容在內。
        },
        xAxis: {
            name:'數量',
            data: subinventory_code6,
            axisLine: {
                lineStyle: {
                    color: '#6691b5'  // 設置 x 坐標軸線的顏色
                }
            },
            axisLabel: {
                fontSize: 14,  // 設置橫軸標簽字體大小為14
                // rotate: 45, // 將標簽文本旋轉45度
            },
            nameTextStyle: {
                fontSize: 14  // 設置橫軸名稱字體大小為14
            },
            
        },
        yAxis: {
            name:'倉庫',
            splitLine: {
                show: false  // 隱藏縱坐標軸的背景橫線
            }, 
            axisLine: {
                lineStyle: {
                    color: '#6691b5'  // 設置 x 坐標軸線的顏色
                }
            },
            axisLabel: {
                fontSize: 12  // 設置橫軸標簽字體大小為12
            },
            nameTextStyle: {
                fontSize: 12  // 設置橫軸名稱字體大小為12
            }
        },  
        series: [
            {
                type: 'bar',
                barWidth: '12',
                data: quantity6,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'top',
                            textStyle: {
                                color: '#6691b5',
                                fontSize: 12
                            }
                        }
                    }
                }
            }
        ]
    };
    let currentIndex6 = -1;
    setInterval(function() {
        var dataLen6 = option6.series[0].data.length;
        // 取消之前高亮的圖形
        myChart6.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex6
        });
        currentIndex6 = (currentIndex6 + 1) % dataLen6;
        // 高亮當前圖形
        myChart6.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex6
        });
        // 顯示 tooltip
        myChart6.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex6
        });
    }, 1000);
    myChart6.setOption(option6);    
    </script>";


//近一月產品入庫數量榜單
$sql7 = "   SELECT b.stockid,SUM(prt.transaction_quantity) as quantity
            FROM po_headers_all a, po_lines_all b, sf_item_no c, vendors d, po_rcv_transactions prt,po_rcv_receipt_line prr
            WHERE  a.po_num = b.po_num
            AND a.vendor_code = d.vendor_code
            AND b.po_num = prt.po_num
            AND prr.receipt_num=prt.receipt_num
            AND prt.po_num=prr.po_num
            AND prt.po_line=prr.po_line 
            AND b.stockid=prr.stockid
            AND prt.transaction_type in ('RECEIVE')
            AND b.line = prt.po_line
            AND b.stockid = c.item_no  
            AND prt.transaction_date >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))
            GROUP BY stockid
            ORDER BY prt.transaction_quantity desc
            LIMIT 5
";
$result7 = DB_query($sql7, $db);
$index = 1;
while ($array7 = mysqli_fetch_assoc($result7)) {
    $name = $array7['stockid'];
    $value = $array7['quantity'];
    $title = 'TOP' . $index;
    if (!$value) {
        $value = 0;
    }
    $array_data7[] = array(
        'name' => $name,
        'value' => $value,
        'title' => $title
    );
    $index++;
}
echo "<script>";
echo ";  var array7 = ";
echo json_encode($array_data7);
// echo "console.log(" . json_encode($array_data7) . ");";
// 對數據項數量進行判斷
$arrayLength = count($array_data7);
for ($i = 1; $i <= 5; $i++) {
    //輸出數據到前端顯示
    echo "
    if (array7[" . ($i - 1) . "]) {
        document.getElementById('product_delivery_top" . $i . "').innerText = array7[" . ($i - 1) . "].name ;
    } else {
        document.getElementById('product_delivery_top" . $i . "').innerText = '--';
    }
    ";
}
echo "; 
    var data = []; 
    var myChart7 = echarts.init(document.getElementById('poruku7')); 
    option7 = {
        color:['#73c0de','#fd6f6f','#fac858','#91cc75','#5470c6'],
        tooltip: {
            trigger: 'item',
            formatter: function(params) {
                var name = params.data.name;
                var title = params.data.title;
                var value = params.value;
                var marker = params.marker; // 添加marker(小圓點)
                return marker + ' ' + title + '<br/>' + name + ' : ' + value;
            }
        },
        series: [
            {
                type: 'pie',
                radius: ['50%', '70%'],
                data: array7,
                emphasis: {
                    itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)',
                    label: {
                            show: true
                        },
                        labelLine: {
                            show: false
                        }
                    }
                },  
                itemStyle: {
                    normal: {
                        label: {
                            show: false
                        },
                        labelLine: {
                            show: false
                        }
                    },
                }       
            }
        ]
    };
    let currentIndex7 = -1;
    setInterval(function() {
        var dataLen7 = option7.series[0].data.length;
        // 取消之前高亮的圖形
        myChart7.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex7
        });
        currentIndex7 = (currentIndex7 + 1) % dataLen7;
        // 高亮當前圖形
        myChart7.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex7
        });
        // 顯示 tooltip
        myChart7.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: currentIndex7
        });
    }, 1000);
    myChart7.setOption(option7);    
    </script>";

css文章來源地址http://www.zghlxwxcb.cn/news/detail-665263.html

body {
    background: linear-gradient(25deg, #0f2249, #182e5a 20%, #0f2249 40%, #182e5a 60%, #0f2249 80%, #182e5a 100%);
    padding: 0px;
    margin: 0px;
}

ul {
    padding: 0px;
    margin: 0px;
}

.head {
    /* height: 40px; */
    background: url(../../images/head_bg.png) no-repeat center center;
    background-size: 100% 100%;
    position: relative;
    margin-bottom: 20px;
    border: 1px solid rgb(255, 255, 255, 0);
}

.head h1 {
    color: #bde4ff;
    text-align: center;
    font-size: 25px;
    /* line-height: 40px; */
    letter-spacing: .06rem;
}

.head h1 img {
    width: 1.5rem;
    display: inline-block;
    vertical-align: middle;
    margin-right: .2rem
}

.all_title {
    background: linear-gradient(to top, #56c3ec, #b2f3f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    letter-spacing: 2px;
    font-family: '微軟雅黑';
    font-weight: bold;
    /* font-size: 32px; */
}


.kanban_all {
    /* border: 1px solid black; */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.kanban_all_position {
    /* border: 1px solid red; */
    width: 98%;
    display: flex;
    flex-wrap: wrap;
}

.kanban_item {
    /* border: 1px solid red; */
    width: calc(50% - 2%);
    margin: 0 1% 1% 1%;
}

.kanban_line {
    height: 280px;
    border: 1px solid #3486da;
    background: rgba(0, 70, 190, .1);
    padding: .15rem;
    position: relative;
    margin-bottom: .25rem;
    z-index: 10;
    /* width: calc(50% - 3%); */
    margin: 0 1% 1% 1%;
}


.kanban_line:before,
.kanban_line:after {
    position: absolute;
    /* width: .15rem;
    height: .15rem; */
    content: "";
    border-top: 3px solid #3486da;
    top: -2px;
}

.kanban_line:before,
.kanban_line:after,


.kanban_title {
    height: 20px;
    padding: 1%;
    font-family: '華文細黑';
    font-weight: bold;
    background: linear-gradient(to right, rgba(48, 82, 174, 1), rgba(48, 82, 174, 0));
    color: #fff;
    font-size: 14px;
}

.kanban_content {
    height: 220px;
    padding: 1%;
    display: flex;
    justify-content: center;
    /* border: 1px solid red; */
}

.kanban_content table {
    width: 100%;
    /* border: 1px solid green; */
}

.kanban_content_left {
    /* border: 1px solid red; */
    width: 65%;
}

.kanban_content_right {
    width: 35%;
    /* border: 1px solid green; */
}

.kanban_content_right li {
    margin-top: 5%;
    font-family: '微軟雅黑';
}

.kanban_content_left1 {
    /* border: 1px solid red; */
    width: 55%;
}

.kanban_content_right1 {
    width: 45%;
    font-size: 85%;
    /* border: 1px solid green; */
}

.kanban_content_right1 li {
    margin-top: 5%;
    font-family: '微軟雅黑';
}

.kanban_content table td {
    width: 100%;
    /* 或者您可以根據需求設置其他百分比值,例如33.33% */
}

.kanban_line_double {
    /* border: 1px solid blue; */
    display: flex;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.kanban_line_double .left {
    /* border: 1px solid red; */
    width: 48%;
    height: 100%;
}

.kanban_line_double .left .kanban_title {
    padding: 2%;
}

.kanban_line_double .middle {
    background: none;
    width: 3%;
}

.kanban_line_double .right {
    /* border: 1px solid black; */
    width: 48%;
    height: 100%;
}

.kanban_line_double .right .kanban_title {
    padding: 2%;
}

/* 表格_5 */
.table {
    text-align: center;
    /* border: 1px solid black; */
    border-collapse: collapse;
}

.table tr th {
    width: 20%;
    /* border: 1px solid black; */
    color: #c0dcf0;
    font-weight: bold;
}

.table tr td {
    width: 20%;
    text-align: center;
    padding-top: 1%;
    color: #8faade;
}

.quantity_show {
    width: 100%;
    font-size: 20px;
    letter-spacing: 2px;
    font-family: '微軟雅黑';
    text-align: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity_show_position {
    width: 100%;
}

.quantity_show div {
    padding: 1%;
    color: white;

}

.quantity_show .quantity_line2 {
    color: white;
    font-size: 30px;
}

.quantity_show .quantity_line3 ul {
    display: flex;
    /* border: 1px solid red; */
    justify-content: center;
    /* 水平居中 */
    align-items: center;
    /* 垂直居中 */
}

.quantity_show .quantity_line3 ul li {
    margin: 0 5%;
    /* border: 1px solid black; */
    list-style: none;
}

.quantity_show .quantity_line3 ul li:nth-child(1):before {
    content: "";
    display: inline-block;
    width: 12px;
    /* 設置圖標寬度 */
    height: 12px;
    /* 設置圖標高度 */
    background-color: red;
    border-radius: 50%;
    /* 設置圖標背景顏色 */
    margin-right: 5px;
    /* 調整圖標與文本之間的間距 */
}

.quantity_show .quantity_line3 ul li:nth-child(2):before {
    content: "";
    display: inline-block;
    width: 12px;
    /* 設置圖標寬度 */
    height: 12px;
    /* 設置圖標高度 */
    background-color: green;
    border-radius: 50%;
    /* 設置圖標背景顏色 */
    margin-right: 5px;
    /* 調整圖標與文本之間的間距 */
}

.quantity_show .quantity_line3 span {
    color: #fff;
}

/* 表格 */
/* 表格_5 */
.table1 {
    text-align: center;
    /* border: 1px solid #8faade; */
    border-collapse: collapse;
}

.table1 tr th {
    /* width: 20%; */
    /* border: 1px solid #8faade; */
    color: #c0dcf0;
    font-weight: bold;
}

.table1 tr .th1 {
    width: 10%;
}

.table1 tr .th2 {
    width: 8%;
}

.table1 tr .th3 {
    width: 5%;
}

.table1 tr td {
    /* width: 20%; */
    text-align: center;
    padding-top: 1%;
    color: #8faade;
    /* border: 1px solid #8faade; */
}

.table1 tr .td1 {
    width: 10%;
}

.table1 tr .td2 {
    width: 8%;
}

.table1 tr .td3 {
    width: 5%;
}

/* 定義滾動動畫 */
@keyframes scroll {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-100%);
    }
}

/* 應用動畫到表格 */
/* .scroll table {
    animation: scroll 50s linear infinite;
    width: 100%;
    max-height: 200px;
    position: relative;
}

.scroll {
    overflow: hidden;
} */

/* .scroll:hover {
    overflow-y: scroll;
} */

到了這里,關于php+echarts實現數據可視化實例3的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • Selenium + Django + Echarts 實現亞馬遜商品數據可視化爬蟲項目

    Selenium + Django + Echarts 實現亞馬遜商品數據可視化爬蟲項目

    最近完成了1個爬蟲項目,記錄一下自己的心得。 根據用戶輸入商品名稱、類別名稱,使用Selenium, BS4等技術每天定時抓取亞馬遜商品數據,使用Pandas進行數據清洗后保存在MySql數據庫中. 使用Django提供用戶端功能,顯示商品數據,以可視化的方式分析數據,以及數據抓取任務管

    2024年01月25日
    瀏覽(23)
  • 關于微信小程序中如何實現數據可視化-echarts動態(tài)渲染

    關于微信小程序中如何實現數據可視化-echarts動態(tài)渲染

    移動端設備中,難免會涉及到數據的可視化展示、數據統計等等,本篇主要講解原生微信小程序中嵌入 echarts 并進行動態(tài)渲染,實現數據可視化功能。 基礎使用 首先在 GitHub 上下載 echarts 包 地址:https://github.com/ecomfe/echarts-for-weixin/tree/master 下載項目 解壓壓縮包,將 ec-canva

    2024年01月25日
    瀏覽(220)
  • 記錄--手把手教你Vue+ECharts+高德地圖API實現天氣預報數據可視化

    記錄--手把手教你Vue+ECharts+高德地圖API實現天氣預報數據可視化

    所謂數據可視化,我們可以理解為從宏觀角度來看一眼就能看出來整個數據的占比,走向。對于數據可視化,很多互聯網公司是很看重這一塊的,包括大廠;就比如阿里的淘寶,雙十一的時候往往就需要將消費者的一些數據通過圖的形式展現出來。接下來我們就來實現一個天

    2024年02月07日
    瀏覽(23)
  • Echarts數據可視化 第4章 Echarts可視化圖 4.10 熱力圖

    Echarts數據可視化 第4章 Echarts可視化圖 4.10 熱力圖

    Echarts數據可視化 Echarts數據可視化:入門、實戰(zhàn)與進階 第4章 Echarts可視化圖 4.10 熱力圖 熱力圖是一種密度圖,使用不同顏色和不同顏色深淺程度來表示數據量的區(qū)別。 舉個栗子 渲染效果 解釋一下這個圖 其中橫軸代表小時,縱軸表示星期幾,圖中不同顏色的區(qū)塊代表了數據

    2024年02月14日
    瀏覽(26)
  • 基于Echarts的大數據可視化模板:大數據可視化展板
  • ECharts數據可視化

    ECharts數據可視化

    目錄 第一章 什么是ECharts 第二章 搭建環(huán)境? 2.1 Echarts的下載 2.2 Visual Studio Code下載 第三章 一個簡單的可視化展示 第四章 Echarts組件 4.1 標題 4.2 提示框 4.3 工具欄 4.4 圖例 4.5 時間軸 4.6 數據區(qū)域縮放 4.6.1?滑動條型數據區(qū)域縮放 4.6.2?內置型數據區(qū)域縮放? ??4.6.3?框選型數據

    2024年02月10日
    瀏覽(45)
  • Echarts實現可視化大屏

    Echarts實現可視化大屏

    手把手帶你做出一個可視化大屏,輕松完成期末大作業(yè)。 關注公眾號” Python爬蟲與數據分析 “回復“ 可視化大屏 ”獲取代碼及數據 涉及到的技術:Echarts、HTML、css、JavaScript Echarts官網: https://echarts.apache.org/handbook/zh/concepts/axis/ 目錄 1、echarts同時展示多幅圖 2、使用css優(yōu)化

    2024年02月09日
    瀏覽(31)
  • 數據可視化一、ECharts

    數據可視化一、ECharts

    1、數據可視化 (1)數據可視化 數據可視化主要目的:借助于圖形化手段,清晰有效地傳達與溝通信息。 數據可視化可以把數據從冰冷的數字轉換成圖形,揭示蘊含在數據中的規(guī)律和道理。 (2)數據可視化的場景 目前互聯網公司通常有這么幾大類的可視化需求: (3)常見

    2024年02月05日
    瀏覽(28)
  • ECharts數據可視化--常用圖表類型

    ECharts數據可視化--常用圖表類型

    目錄 一.柱狀圖 1.基本柱狀圖 ?1.1最簡單的柱狀圖 ?編輯 ??1.2多系列柱狀圖? ?1.3柱狀圖的樣式? ? ? ? ? (1)柱條樣式 ? ? ? ?? ????????(2)柱條的寬度和高度 ? ? ? ? (3)柱條間距 ? ? ? ? (4)為柱條添加背景顏色 ?編輯 2.堆疊柱狀圖 3.動態(tài)排序柱狀圖 4.階梯

    2024年02月05日
    瀏覽(30)
  • 構建數據可視化(基于Echarts,python)

    構建數據可視化(基于Echarts,python)

    本文目錄: 一、寫在前面的題外話 二、數據可視化概念 三、用Python matplotlib庫繪制數據可視化圖 四、基于Echarts構建大數據可視化 4.1、安裝echarts.js 4.2、數據可視化折線圖制作 4.2.1、基礎折線圖 4.2.2、改善折線圖 4.2.3、平滑折線圖 4.2.4、虛線折線圖 4.2.5、階梯折線圖 4.2.6、面

    2024年02月11日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包