3 * Trending script for graphing objects.
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
10 * @copyright Copyright (c) 2010-2017 Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2011 Rod Roark <rod@sunsetsystems.com>
14 $special_timeout = 3600;
15 include_once("../../globals.php");
17 $formname = $_GET["formname"];
18 $is_lbf = substr($formname, 0, 3) === 'LBF';
21 // Determine the default field ID and its title for graphing.
22 // This is from the last graphable field in the form.
24 "SELECT field_id, title FROM layout_options WHERE " .
25 "form_id = ? AND uor > 0 AND edit_options LIKE '%G%' " .
26 "ORDER BY group_name DESC, seq DESC, title DESC LIMIT 1",
31 //Bring in the style sheet
34 <?php
require $GLOBALS['srcdir'] . '/js/xl/dygraphs.js.php'; ?
>
36 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
37 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/modified/dygraphs-2-0-0/dygraph.css" type
="text/css"></script
>
39 // Hide the current value css entries. This is currently specific
40 // for the vitals form but could use this mechanism for other
43 // currentvalues - input boxes
44 // valuesunfocus - input boxes that are auto-calculated
45 // editonly - the edit and cancel buttons
47 // readonly - the link back to summary screen
48 // Also customize the 'graph' class to look like links.
51 .currentvalues
{ display
: none
;}
52 .valuesunfocus
{ display
: none
;}
53 .editonly
{ display
: none
;}
55 .graph
{color
:#0000cc;}
58 margin
:0em
1em
2em
2em
;
62 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script
>
63 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/modified/dygraphs-2-0-0/dygraph.js?v=<?php echo $v_js_includes; ?>"></script
>
65 <script type
="text/javascript">
68 // Show the selected chart in the 'chart' div element
69 function show_graph(table_graph
, name_graph
, title_graph
)
72 $
.ajax({ url
: '../../../library/ajax/graphs.php',
80 success
: function(returnData
){
83 document
.getElementById("chart"),
84 returnData
.data_final
,
86 title
: returnData
.title
,
90 xlabel
: xlabel_translate
94 // ensure show the chart div
104 $
(document
).ready(function(){
106 // Use jquery to show the 'readonly' class entries
107 $
('.readonly').show();
109 // Place click callback for graphing
110 <?php
if ($is_lbf) { ?
>
111 // For LBF the <td> has an id of label_id_$fieldid
112 $
(".graph").click(function(e
){ show_graph('<?php echo $formname; ?>', this
.id
.substring(9), $
(this
).text()) });
114 $
(".graph").click(function(e
){ show_graph('form_vitals', this
.id
, $
(this
).text()) });
117 // Show hovering effects for the .graph links
120 $
(this
).css({color
:'#ff5555'}); //mouseover
123 $
(this
).css({color
:'#0000cc'}); // mouseout
127 // show blood pressure graph by default
128 <?php
if ($is_lbf) { ?
>
129 show_graph('<?php echo $formname; ?>','<?php echo $default['field_id
']; ?>','<?php echo $default['title
']; ?>');
131 show_graph('form_vitals','bps','');
138 // Use the List Based Forms engine for all LBFxxxxx forms.
139 include_once("$incdir/forms/LBF/new.php");
141 // ensure the path variable has no illegal characters
142 check_file_dir_name($formname);
144 include_once("$incdir/forms/$formname/new.php");