demos\medical\labs.sdf
  1 Form {
  2   name: "labsForm"
  3   /**
  4    * Define an inline script that takes the data in the currently selected row
  5    * in the table and creates a line chart series that is feed to 
  6    * the chart viewer. The onChange event for the table invokes this code.
  7    */
  8   scriptURL:<< 
  9     var selectedRow
 10     function showGraph(table) {
 11       var row=table.getSelectedItem()
 12       if(row==null || row==selectedRow) return
 13       var chart=labChart
 14       chart.clearChartData()
 15       var series=chart.createSeries(row.get(0))
 16       var len=row.getItemCount()-2
 17       var i
 18       var s
 19       for(i=1;i<len;i++) {
 20         s=row.get(i).value
 21         if(s!="" && s!=null) {
 22           series.add(chart.createSeriesValue(chart.getDomainValue(i-1),s))
 23         }
 24       }
 25       chart.addSeries(series)
 26       series.setForeground(window.getColor("blue"))
 27       chart.setRangeLabel(row.getItem(len+1).toString())
 28       row=chart.addRangeMarker(row.getItem(len).toString()+"-Reference Range",'-')
 29       row.setForeground(window.getColor("#00ff0040"))
 30       chart.refreshItems()
 31       selectedRow=row
 32     }
 33   >> [ inline="true" ]
 34   rows: "2"
 35   widgets {
 36     {
 37       GroupBox {
 38         borders {
 39           none
 40         }
 41         bounds {
 42           x: "0"
 43           y: "0"
 44         }
 45         columns: "7"
 46         widgets {
 47           {
 48             PushButton {
 49               bounds {
 50                 x: "0"
 51                 y: "0"
 52               }
 53               popupMenu {
 54                 {
 55                   value: "Most Recent Lab Results"
 56                 }
 57                 {
 58                   value: "Chemistry"
 59                 }
 60                 {
 61                   value: "Microbiology"
 62                 }
 63                 {
 64                   value: "Pathology"
 65                 }
 66               }
 67               templateName: "viewsList"
 68             }
 69           }
 70           {
 71             Label {
 72               bounds {
 73                 x: "1"
 74                 y: "0"
 75                 width: "5ch"
 76               }
 77             }
 78           }
 79           {
 80             Label {
 81               bounds {
 82                 x: "2"
 83                 y: "0"
 84               }
 85               templateName: "viewLabel"
 86               value: "Most Recent Lab Results"
 87             }
 88           }
 89           {
 90             Label {
 91               bounds {
 92                 x: "3"
 93                 y: "0"
 94                 width: "5ch"
 95               }
 96             }
 97           }
 98         }
 99       }
100     }
101     {
102       SplitPane {
103         name: "labsSplitPane"
104         verticalAlign: full
105         horizontalAlign: full
106         bgColor: "defaultBackground+5"
107         bounds {
108           x: "0"
109           y: "1"
110         }
111         splitProportions {
112           .5
113         }
114         regions {
115           {
116             viewer {
117               /**
118                * This table definition leverages the embeddable dataTime function
119                * and the automatic data/time converter to specify relative date values
120                * that change based on the current data (T=today)
121                */
122               Table {
123                 name: "labsTable"
124                 focusPainted: false
125                 dataURL: "data/labs.txt" 
126                 templateName: "prototypeTable" 
127                 autoResizeMode: none
128                 quickFindSupport: search_bar
129                 rowHeaderFooterSelectionPainted: false
130                 autoSizeColumnsToFit: true
131                 columns {
132                   {
133                     title: "Lab Test"
134                     renderType: header_normal
135                     gridCell {
136                       bgColor: ",TableHeader.background" [ direction="horizontal_left" ]
137                       borders {
138                         empty [insets="0,5,0,0"]
139                       }
140                     }
141                     headerHorizontalAlign: center
142                     headerVerticalAlign: center
143                   }
144                   {
145                     title: "<html><center>{$dateTime('T-9@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
146                     horizontalAlign: center
147                   }
148                   {
149                     title: "<html><center>{$dateTime('T-8@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
150                     horizontalAlign: center
151                   }
152                   {
153                     title: "<html><center>{$dateTime('T-7@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
154                     horizontalAlign: center
155                   }
156                   {
157                     title: "<html><center>{$dateTime('T-6@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
158                     horizontalAlign: center
159                   }
160                   {
161                     title: "<html><center>{$dateTime('T-5@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
162                     horizontalAlign: center
163                   }
164                   {
165                     title: "<html><center>{$dateTime('T-4@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
166                     horizontalAlign: center
167                   }
168                   {
169                     title: "<html><center>{$dateTime('T-3@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
170                     horizontalAlign: center
171                   }
172                   {
173                     title: "<html><center>{$dateTime('T-2@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
174                     horizontalAlign: center
175                   }
176                   {
177                     title: "<html><center>{$dateTime('T-1@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
178                     horizontalAlign: center
179                   }
180                   {
181                     title: "<html><center>{$dateTime('T@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
182                     horizontalAlign: center
183                   }
184                   {
185                     title: "<html><center>Reference<br/> Range"
186                     horizontalAlign: center
187                     renderType: footer_normal
188                     gridCell {
189                       bgColor: ",TableHeader.background" [ direction="horizontal_left" ]
190                       }
191                   }
192                   {
193                     title: "Units"
194                     horizontalAlign: center
195                     renderType: footer_normal
196                     gridCell {
197                       bgColor: ",TableHeader.background" [ direction="horizontal_left" ]
198                     }
199                     headerVerticalAlign: center
200                   }
201                 }
202               } [ onChange="showGraph(widget)" ]
203             }
204           }
205           {
206             viewer {
207               Chart {
208                 name: "labChart"
209                 borders {
210                   shadow [ thickness="7" ]
211                 } [ thickness="7" ]
212                 bgColor: "defaultBackground+5"
213                 domainAxis {
214                   valueType: date_time_type
215                   value: "Date/Time"
216                   subItems {
217                     {
218                       value: "T-9@0600"
219                     }
220                     {
221                       value: "T-8@0600"
222                     }
223                     {
224                       value: "T-7@0600"
225                     }
226                     {
227                       value: "T-6@0600"
228                     }
229                     {
230                       value: "T-5@0600"
231                     }
232                     {
233                       value: "T-4@0600"
234                     }
235                     {
236                       value: "T-3@0600"
237                     }
238                     {
239                       value: "T-2@0600"
240                     }
241                     {
242                       value: "T-1@0600"
243                     }
244                     {
245                       value: "T@0600"
246                     }
247                   }
248                 } [ timeUnit="hour" ]
249                 rangeAxis {
250                   valueType: integer_type
251                   value: "Result"
252                 }
253                 plot {
254                   bgColor: "white"
255                   gridLine: auto [ color="gray" ]
256                   labels: tooltips
257                   noDataMessage {
258                     value: "Please select a lab test to graph the result values"
259                     font {
260                       size: "*2"
261                     }
262                     fgColor: "blue"
263                   }
264                 }
265                 scrollPane {
266                   verticalScrollbar: hidden
267                 }
268               }
269             }
270           }
271         }
272       }
273     }
274   }
275 }
276 
277