<?php
require_once("45789417/ref4780.php");
require_once("jpgraph/jpgraph.php");
require_once("jpgraph/jpgraph_line.php");
require_once("jpgraph/jpgraph_error.php");

$id = $_GET['id'];

/* Valores Abdomen */
$sql3= mysqli_query($con,"SELECT abdomen_medio FROM hc_control0 WHERE id = '$id'");
$row3 = mysqli_fetch_assoc($sql3);
$abdomen_inicial = $row3['abdomen_medio'];
$ydata = array($abdomen_inicial,);
$sql= mysqli_query($con,"SELECT ct_abdomen_medio FROM hc_control1 WHERE id = '$id'");
while($row = mysqli_fetch_array($sql)) {
    $ydata[] = $row['ct_abdomen_medio'];
}

/* Valores peso */
$sql4 = mysqli_query($con,"SELECT peso FROM hc_control0 WHERE id = '$id'");
$row4 = mysqli_fetch_assoc($sql4);
$peso_inicial = $row4['peso'];
$y2data = array($peso_inicial,);
$sql5 = mysqli_query($con,"SELECT peso_actual FROM hc_control1 WHERE id = '$id'");
while($row5 = mysqli_fetch_array($sql5)) {
    $y2data[] = $row5['peso_actual'];
}

/* $y2data = array(110,108,104,104,110,100,105,80,90,100,110,120,130,140,110);  steelblue peso  */
/* $ydata = array(110,105,106,110,90,100,95); brown abdomen */ 
$graph = new Graph(620,200,'auto');  

$graph->title->Set("Clinica Los Robles");
$graph->img->SetMargin(35,145,30,40);
$graph->SetScale('intlin');
$graph->SetY2Scale("lin");
$graph->SetShadow(0);

// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot2=new LinePlot($y2data);

// Add the plot to the graph
$graph->Add($lineplot);
$graph->AddY2($lineplot2);

 // Specify X-labels
$graph->xaxis->title->Set("Semanas"); 
$graph->xgrid->Show();

/*
$graph->y2axis->title->Set("zzzzzz");
$graph->yaxis->title->Set("Abdomen"); 
*/
/* $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); */

$lineplot->SetColor("brown");
$lineplot->SetWeight(2);
$graph->yaxis->SetColor("brown");

$lineplot2->SetColor("steelblue");
$lineplot2->SetWeight(2);
$graph->y2axis->SetColor("steelblue");

// Set the legends for the plots
$lineplot->SetLegend("Abdomen");
$lineplot2->SetLegend("Peso");

// Adjust the legend position
$graph->legend->Pos(0.03,0.5,"right","center");

// Display the graph
$graph->Stroke();
?>








$lineplot->mark->SetType(MARK_FILLEDCIRCLE); 
$lineplot->value->Show(); 


