当我悬停时,如何在莫里斯栏上添加另一个标签?

时间:2019-04-07 12:35:41

标签: javascript php xampp

我想在悬停月份的下方显示数据库中的另一列数据。当我尝试修复它时,整个图形似乎消失了。无法将其显示在悬停状态

我尝试添加到脚本中,但我无法弄清

<center>
<!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=iso-8859- 
[enter image description here][1]1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Graph</title>
<link rel="stylesheet" type="text/css" 
href="../stylesheet/style33.css"/>
<link rel="shortcut icon" href="../image/logo3.png" type="image/x- 
icon"/>
<link rel="stylesheet" href="../stylesheet/morris.css">
<script src="../js/jquery.min.js"></script>
<script src="../js/raphael-min.js"></script>
<script src="../js/morris.min.js"></script>
<script>
    function back()
    {
        document.forms['mainform_1'].action= 'admin_main.php';
        document.forms['mainform_1'].submit();
    }
</script>
</head>
<?php
    $connect = mysqli_connect("localhost", "root", "", "vegetable");
    $query = "SELECT SUM(pieces), SUM(weight), SUM(value), month   FROM 
vegetable_table GROUP BY month";
    $result = mysqli_query($connect, $query);
    $chart_data = '';
    while($row = mysqli_fetch_array($result))
    {
        $chart_data .= "{ month:'".$row["month"]."', 
        pieces:".$row["SUM(pieces)"].", weight:".$row["SUM(weight)"].", 
        value:".$row["SUM(value)"]."}, ";
    }
    $chart_data = substr($chart_data, 0, -2);
?>
<body>
<div id="wrapper_graph">
<form name="mainform_1" action="" method="post">
<div class="head">
<?php include("header.php") ?>
<div class="cover">
<div align="left"><input name="submit2" type="submit"  value="Back" 
onclick="back();" /></div>
</div>
</form>
</div>
<br/><br/><br/>
<div class="pro_container">
  <div class="container">
<br><br>
<div id="chart"></div>
</div>
</div>
</body>
</html>
<script>
    Morris.Bar({
        element : 'chart',
        data:[<?php echo $chart_data; ?>],
        xkey: 'month',
        ykeys: ['pieces', 'weight', 'value'],
        labels: ['Pieces', 'Weight', 'Value'],
        hideHover: 'auto'
    });
</script>
</center>

我希望数据库中的place列位于我徘徊的月份的正下方

enter image description here

0 个答案:

没有答案