Php 忽略空值的曲线,然后使用Libchart继续绘制真实值的曲线

Php 忽略空值的曲线,然后使用Libchart继续绘制真实值的曲线,php,graph,plot,Php,Graph,Plot,我使用Libchart为数据库中的数据绘制曲线。 我的问题是:我的空数据(Y轴值)的Libchart图(零值)。 当Y为空时,我需要Libchart绘制(X轴值),但不需要为(Y轴值)绘制曲线。 换句话说,对于空值,我需要省略曲线,然后继续绘制真实值。 下面是我用来绘制曲线的代码: <?php $x1="Value 1"; $x2="Value 2"; $x3="Value 3"; $x4="Value 4"; $x5="Value 5"; $x6="Value 6"; $x7="Valu

我使用Libchart为数据库中的数据绘制曲线。 我的问题是:我的空数据(Y轴值)的Libchart图(零值)。 当Y为空时,我需要Libchart绘制(X轴值),但不需要为(Y轴值)绘制曲线。 换句话说,对于空值,我需要省略曲线,然后继续绘制真实值。 下面是我用来绘制曲线的代码:

<?php
$x1="Value 1";
$x2="Value 2";
$x3="Value 3";
$x4="Value 4";
$x5="Value 5";
$x6="Value 6";
$x7="Value 7";
$x8="Value 8";
$x9="Value 9";
$x10="Value 10";
$x11="Value 11";
$x12="Value 12";


$y1=45;
$y2=06;
$y3=82;
$y4=15;
$y5=45;
$y6=null;
$y7=null;
$y8=null;
$y9=null;
$y10=75;
$y11=16;
$y12=34;

    include "libchart/classes/libchart.php";
    $chart = new LineChart(1000, 400);

    $dataSet = new XYDataSet();
    $dataSet->addPoint(new Point($x1,$y1));
    $dataSet->addPoint(new Point($x2,$y2));
    $dataSet->addPoint(new Point($x3,$y3));
    $dataSet->addPoint(new Point($x4,$y4));
    $dataSet->addPoint(new Point($x5,$y5));
    $dataSet->addPoint(new Point($x6,$y6));
    $dataSet->addPoint(new Point($x7,$y7));
    $dataSet->addPoint(new Point($x8,$y8));
    $dataSet->addPoint(new Point($x9,$y9));
    $dataSet->addPoint(new Point($x10,$y10));
    $dataSet->addPoint(new Point($x11,$y11));
    $dataSet->addPoint(new Point($x12,$y12));
    $chart->setDataSet($dataSet);
    $chart->setTitle("Monthly usage for www.example.com");
    $chart->render("generated/demo1.png");


?>
<!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-15" />
</head>
<body>
<center><img alt="my_curve" src="generated/demo1.png" style="border: 1px solid gray;"/></center>
</body>
</html>