简体   繁体   English

趋势线未显示在我的图表中

[英]Trendline is not displaying in my chart

I am using trendlines for my line chart. 我在线图中使用趋势线。 But it is not visible in my browser.Can anyone tell me the reason for this. 但它在我的浏览器中不可见。任何人都可以告诉我这个的原因。 Below i am giving code: 下面我给出代码:

<?php
include("Includes/FusionCharts.php");
include("Includes/DBconn.php");
include("Includes/FC_Colors.php");
?>
<html>
    <title> Blood Pressure</title>
    <head>
        <script language="javascript" src="FusionCharts/FusionChart.js"></script>

    </head>
    <body>
    <center>
        <?php

        //connect to the DB
        $link= connectToDB();

        $query =  "select * from patient_health order by ondate";

        $result=mysql_query($query)or die(mysql_error());
        //echo $result;
        $strXML = "<graph caption='Blood Pressure Reading' subCaption='Month wise' xaxisname='Current Month' yaxisname='Blood Pressure(Systolic/diastole)'  yAxisMaxValue='400'
    animation='1' rotatenames='1'>";
$categories = "<categories>";
$systolic = "<dataset seriesName='systole'>";
$diaolic = "<dataset seriesName='diastole'>";
while ($row = mysql_fetch_array($result)) {
    $categories .= "<category name='" . $row["ondate"] . "' />";
    $systolic .= "<set color='AFD8F8' value='" . $row["systole_reading"] . "'  hoverText='systolic' />";
    $diaolic .= "<set value='" . $row["diastole_reading"] . "' color='FEDCBC' hoverText='diastolic'/>";
}
$strXML .= $categories . "</categories>" . $systolic . "</dataset>" . $diaolic . "</dataset>" . "</graph>";
**$strXML .=" <trendlines>
    <line startValue='140' color='91C728' displayValue='Target' showOnTop='1'/>
  </trendlines>";**
//$strXML now has the complete XML required to render the multi-series chart.

//Create the chart - Pie 3D Chart with data from $strXML
   echo renderChartHTML("FusionCharts/FCF_MSLine.swf", "", $strXML, "BloodPressure", 850, 450,false);
   //echo renderChartHTML("FusionCharts/FCF_MSBar2D.swf", "", $strXML, "BloodPressure", 850, 450,false);

       ?>

    </center>

    </body>

</html>

Did i place the code correctly or i have to change it . 我是否正确放置了代码或者我必须更改它。 Can anyone please give me solution 任何人都可以给我解决方案

Thank you in advance Ramsai 提前谢谢Ramsai

The code for the trend lines should come before you close the graph element, ie, before </graph> . 趋势线的代码应该在关闭图元素之前,即在</graph>之前。

As I've illustrated below: 正如我在下面说明的那样:

}
**$strXML .=" <trendlines>
    <line startValue='140' color='91C728' displayValue='Target' showOnTop='1'/>
  </trendlines>";**
$strXML .= $categories . "</categories>" . $systolic . "</dataset>" . $diaolic . "</dataset>" . "</graph>";

This should show your trend lines. 这应该显示您的趋势线。

It seems that in your code, you are closing the <graph> tag before adding <trendlines> ! 似乎在您的代码中,您在添加<trendlines>之前关闭了<graph>标记!

Correct code would be: 正确的代码是:

$strXML .= $categories . "</categories>" . $systolic . "</dataset>" . $diaolic . "</dataset>";

$strXML .=" <trendlines>
    <line startValue='140' color='91C728' displayValue='Target' showOnTop='1'/>
  </trendlines>" . "</graph>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM