1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | |
---|
3 | <xsl:stylesheet version="3.0" |
---|
4 | xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" |
---|
5 | xmlns:xs ="http://www.w3.org/2001/XMLSchema" |
---|
6 | xmlns:ibis="http://www.ibisph.org" |
---|
7 | |
---|
8 | exclude-result-prefixes="ibis xs xsl" |
---|
9 | > |
---|
10 | <xsl:import href="../../../../xml/Interactive.xslt"/> |
---|
11 | <xsl:import href="../../../../json/Dataset.xslt"/> |
---|
12 | <xsl:import href="../../../../json/Kendo.xslt"/> |
---|
13 | <xsl:import href="../../../../json/LeafletMap.xslt"/> |
---|
14 | <xsl:import href="../../../Graphic.xslt"/> |
---|
15 | <xsl:import href="../Indicator.xslt"/> |
---|
16 | <xsl:import href="../Page.xslt"/> |
---|
17 | |
---|
18 | |
---|
19 | <ibis:doc> |
---|
20 | <name>html/indicator/profile/view/Page</name> |
---|
21 | <summary>Interactive indicator profile view page</summary> |
---|
22 | <description> |
---|
23 | Specific XSLT used to create the indicator profile view page. |
---|
24 | </description> |
---|
25 | </ibis:doc> |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | <xsl:param name="Page.pageTitle" ibis:doc="Page's title text based on the 'INDICATOR/TITLE' element."> |
---|
30 | Health Indicator Report - <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> |
---|
31 | </xsl:param> |
---|
32 | <xsl:param name="Page.sectionsTitle" ibis:doc="Page's content block title text based on the 'INDICATOR/TITLE' element."> |
---|
33 | Health Indicator Report of <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> |
---|
34 | </xsl:param> |
---|
35 | |
---|
36 | <xsl:param name="Page.comparisonDimensionName" select="'GeoState'"/> |
---|
37 | <xsl:param name="Page.comparisonDimensionValue" select="'35'"/> |
---|
38 | |
---|
39 | <xsl:param name="Page.showMap" select="ibis:Graphic.showMap( |
---|
40 | /INDICATOR_VIEW/MAP_NAME, |
---|
41 | /INDICATOR_VIEW/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='category']/NAME, |
---|
42 | /INDICATOR_VIEW/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='series']/NAME, |
---|
43 | '', |
---|
44 | $Indicator.dimensions |
---|
45 | )" |
---|
46 | /> |
---|
47 | <xsl:param name="Page.showChart" select="ibis:Graphic.showChart(/INDICATOR_VIEW/CHART_NAME)"/> |
---|
48 | |
---|
49 | <xsl:param name="Indicator.contentBlockType" select="'fixed'"/> |
---|
50 | <xsl:param name="Indicator.contentBlockTitleLevel" select="3"/> |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | <xsl:template name="Page.sectionsContent" ibis:doc="Main page content template that determines if IP or Surrogate."> |
---|
55 | <xsl:choose> |
---|
56 | <xsl:when test="0 = string-length($indicatorView/SURROGATE_VIEW_URL)"> |
---|
57 | <xsl:call-template name="Page.interativeContent"> |
---|
58 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
59 | <xsl:with-param name="indicatorView" select="$indicatorView"/> |
---|
60 | </xsl:call-template> |
---|
61 | </xsl:when> |
---|
62 | <xsl:otherwise> |
---|
63 | <xsl:call-template name="Page.insertAJAXContent"> |
---|
64 | <xsl:with-param name="sourceContentURL" select="$indicatorView/SURROGATE_VIEW_URL"/> |
---|
65 | </xsl:call-template> |
---|
66 | </xsl:otherwise> |
---|
67 | </xsl:choose> |
---|
68 | </xsl:template> |
---|
69 | |
---|
70 | |
---|
71 | <xsl:template name="Page.interativeContent" |
---|
72 | ibis:doc="Main interactive sections content template." |
---|
73 | > |
---|
74 | <xsl:param name="indicator"/> |
---|
75 | <xsl:param name="indicatorView"/> |
---|
76 | |
---|
77 | <xsl:variable name="measureName" select="$indicatorView/MEASURE_NAME"/> |
---|
78 | <xsl:variable name="measure" select="($indicator//MEASURE[NAME = $measureName])[1]"/> |
---|
79 | |
---|
80 | <xsl:call-template name="ContentContainer.expandable"> |
---|
81 | <xsl:with-param name="title" select="'Why Is This Important?'"/> |
---|
82 | <xsl:with-param name="content" select="$indicator/WHY_IMPORTANT"/> |
---|
83 | <xsl:with-param name="description" select="'Text that describes why this indicator is important to the populations overall health'"/> |
---|
84 | <xsl:with-param name="show" select="true()"/> |
---|
85 | <xsl:with-param name="additionalClasses" select="'Text'"/> |
---|
86 | <xsl:with-param name="addWikiAttribute" select="true()"/> |
---|
87 | </xsl:call-template> |
---|
88 | <!-- GARTH TODO: remove |
---|
89 | <xsl:message select="$indicatorView/MAP_NAME"/> |
---|
90 | <xsl:message select="$indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='category']/NAME"/> |
---|
91 | <xsl:message select="$indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='series']/NAME"/> |
---|
92 | <xsl:message select="$indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='constant']/NAME"/> |
---|
93 | <xsl:message select="$Page.showMap"/> |
---|
94 | --> |
---|
95 | |
---|
96 | <xsl:if test="$Page.showMap"> |
---|
97 | <xsl:call-template name="ContentContainer.expandable"> |
---|
98 | <xsl:with-param name="title" select="'Map'"/> |
---|
99 | <xsl:with-param name="content"> |
---|
100 | <xsl:call-template name="Graphic.mapContainer"> |
---|
101 | <xsl:with-param name="containerID" select="'map'"/> |
---|
102 | <xsl:with-param name="title" select="ibis:getIndicatorViewMapTitle($indicator, $indicatorView, $Indicator.dimensions)"/> |
---|
103 | </xsl:call-template> |
---|
104 | <xsl:call-template name="Indicator.contentBlock"> |
---|
105 | <xsl:with-param name="content" select="$indicatorView/MAP_NARRATIVE"/> |
---|
106 | <xsl:with-param name="contentBlockType" select="'fixed'" tunnel="yes"/> |
---|
107 | </xsl:call-template> |
---|
108 | </xsl:with-param> |
---|
109 | <xsl:with-param name="show" select="true()"/> |
---|
110 | <xsl:with-param name="addWikiAttribute" select="false()"/> |
---|
111 | <xsl:with-param name="description" select="'Choropleth/thematic map.'"/> |
---|
112 | </xsl:call-template> |
---|
113 | </xsl:if> |
---|
114 | |
---|
115 | <xsl:if test="$Page.showChart"> |
---|
116 | <xsl:call-template name="ContentContainer.expandable"> |
---|
117 | <xsl:with-param name="title" select="if('Line'=$indicatorView/CHART_NAME) then 'Trend' else 'Chart'"/> |
---|
118 | <xsl:with-param name="content"> |
---|
119 | <xsl:call-template name="Graphic.chartContainer"> |
---|
120 | <xsl:with-param name="containerID" select="'chart'"/> |
---|
121 | </xsl:call-template> |
---|
122 | <xsl:call-template name="Indicator.contentBlock"> |
---|
123 | <xsl:with-param name="content" select="$indicatorView/CHART_NARRATIVE"/> |
---|
124 | <xsl:with-param name="contentBlockType" select="'fixed'" tunnel="yes"/> |
---|
125 | </xsl:call-template> |
---|
126 | </xsl:with-param> |
---|
127 | <xsl:with-param name="inputOnChangeAttribute" select="'resizeKendoChart()'"/> |
---|
128 | <xsl:with-param name="show" select="not($Page.showMap)"/> |
---|
129 | <xsl:with-param name="addWikiAttribute" select="false()"/> |
---|
130 | </xsl:call-template> |
---|
131 | </xsl:if> |
---|
132 | |
---|
133 | <xsl:call-template name="ContentContainer.expandable"> |
---|
134 | <xsl:with-param name="title" select="'Supplemental Graphic'"/> |
---|
135 | <xsl:with-param name="content"> |
---|
136 | <xsl:call-template name="Indicator.supplementalImage"> |
---|
137 | <xsl:with-param name="indicatorView" select="$indicatorView"/> |
---|
138 | </xsl:call-template> |
---|
139 | </xsl:with-param> |
---|
140 | <xsl:with-param name="show" select="true()"/> |
---|
141 | <xsl:with-param name="addWikiAttribute" select="false()"/> |
---|
142 | </xsl:call-template> |
---|
143 | |
---|
144 | <xsl:call-template name="ContentContainer.expandable"> |
---|
145 | <xsl:with-param name="title" select="'Data Notes'"/> |
---|
146 | <xsl:with-param name="content"> |
---|
147 | <xsl:call-template name="Indicator.dataNotes"> |
---|
148 | <xsl:with-param name="title" select="''"/> |
---|
149 | <xsl:with-param name="measure" select="$Indicator.measure"/> |
---|
150 | <xsl:with-param name="indicatorView" select="$indicatorView"/> |
---|
151 | </xsl:call-template> |
---|
152 | </xsl:with-param> |
---|
153 | <xsl:with-param name="show" select="true()"/> |
---|
154 | </xsl:call-template> |
---|
155 | |
---|
156 | <xsl:call-template name="ContentContainer.expandable"> |
---|
157 | <xsl:with-param name="title" select="'Data Table'"/> |
---|
158 | <xsl:with-param name="content"> |
---|
159 | <div class="Graphic Grid ScrollableContainer"> |
---|
160 | <div id="grid"></div> |
---|
161 | <br/><br/> |
---|
162 | GARTH TODO: Data table footnote needs to include the VALUE ATTRIBUTE codes and titles. |
---|
163 | <br/><br/> |
---|
164 | </div> |
---|
165 | </xsl:with-param> |
---|
166 | <xsl:with-param name="show" select="false()"/> |
---|
167 | <xsl:with-param name="addWikiAttribute" select="false()"/> |
---|
168 | </xsl:call-template> |
---|
169 | |
---|
170 | |
---|
171 | <xsl:call-template name="ContentContainer.expandable"> |
---|
172 | <xsl:with-param name="title" select="'Data Definitions & Sources'"/> |
---|
173 | <xsl:with-param name="content"> |
---|
174 | <xsl:call-template name="Indicator.definition"/> |
---|
175 | <xsl:call-template name="Indicator.howCalculated"/> |
---|
176 | <xsl:call-template name="Indicator.dataSources"/> |
---|
177 | </xsl:with-param> |
---|
178 | <xsl:with-param name="show" select="false()"/> |
---|
179 | <xsl:with-param name="description" select="'Metadata for this health indicator.'"/> |
---|
180 | </xsl:call-template> |
---|
181 | |
---|
182 | |
---|
183 | <xsl:call-template name="ContentContainer.expandable"> |
---|
184 | <xsl:with-param name="title" select="'Health Objectives and Targets'"/> |
---|
185 | <xsl:with-param name="content"> |
---|
186 | <xsl:call-template name="Indicator.initiatives"/> |
---|
187 | <xsl:call-template name="Indicator.otherObjectives"/> |
---|
188 | </xsl:with-param> |
---|
189 | <xsl:with-param name="description" select="'Goals and objectives for this health indicator.'"/> |
---|
190 | </xsl:call-template> |
---|
191 | |
---|
192 | <xsl:call-template name="ContentContainer.expandable"> |
---|
193 | <xsl:with-param name="title" select="'Current Outlook'"/> |
---|
194 | <xsl:with-param name="content"> |
---|
195 | <xsl:call-template name="Indicator.howDoing"/> |
---|
196 | <xsl:call-template name="Indicator.howCompare"/> |
---|
197 | </xsl:with-param> |
---|
198 | <xsl:with-param name="description" select="'How are we doing, how do we compare.'"/> |
---|
199 | </xsl:call-template> |
---|
200 | |
---|
201 | <xsl:call-template name="ContentContainer.expandable"> |
---|
202 | <xsl:with-param name="title" select="'Health Improvement Resources'"/> |
---|
203 | <xsl:with-param name="content"> |
---|
204 | <xsl:call-template name="Indicator.whatDoing"/> |
---|
205 | <xsl:call-template name="Indicator.evidenceBasedPractices"/> |
---|
206 | <xsl:call-template name="Indicator.availableServices"/> |
---|
207 | <xsl:call-template name="Indicator.moreResources"/> |
---|
208 | <xsl:call-template name="Indicator.otherInformation"/> |
---|
209 | </xsl:with-param> |
---|
210 | <xsl:with-param name="description" select="'Other related information and resources.'"/> |
---|
211 | </xsl:call-template> |
---|
212 | |
---|
213 | <xsl:call-template name="ContentContainer.expandable"> |
---|
214 | <xsl:with-param name="title" select="'References'"/> |
---|
215 | <xsl:with-param name="content"> |
---|
216 | <xsl:call-template name="Indicator.footnoteReferences"/> |
---|
217 | </xsl:with-param> |
---|
218 | <xsl:with-param name="description" select="'References that may / might not be cited on this page.'"/> |
---|
219 | </xsl:call-template> |
---|
220 | |
---|
221 | <xsl:call-template name="Indicator.allDates"/> |
---|
222 | |
---|
223 | <xsl:call-template name="Page.leafletKendoScript"> |
---|
224 | <xsl:with-param name="indicatorView" select="$indicatorView"/> |
---|
225 | <xsl:with-param name="measure" select="$Indicator.measure"/> |
---|
226 | <xsl:with-param name="showMap" select="$Page.showMap"/> |
---|
227 | <xsl:with-param name="showChart" select="$Page.showChart"/> |
---|
228 | <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> |
---|
229 | </xsl:call-template> |
---|
230 | </xsl:template> |
---|
231 | |
---|
232 | |
---|
233 | |
---|
234 | <xsl:template name="Page.leafletKendoScript" ibis:doc="Provides the kendo and leaflet javascript."> |
---|
235 | <xsl:param name="indicatorView"/> |
---|
236 | <xsl:param name="measure"/> |
---|
237 | <xsl:param name="showMap" select="$Page.showMap"/> |
---|
238 | <xsl:param name="showChart" select="$Page.showChart"/> |
---|
239 | <xsl:param name="baseExportFilename" select="$indicatorView/TITLE"/> |
---|
240 | |
---|
241 | <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/> |
---|
242 | <xsl:variable name="ancillaryValueNames" select="distinct-values($indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/ANCILLARY_VALUE_USAGES/ANCILLARY_VALUE_USAGE/NAME)"/> |
---|
243 | <xsl:variable name="recordAncillaryValueFields"> |
---|
244 | <xsl:call-template name="Interactive.getIndicatorRecordAncillaryValueFields"> |
---|
245 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
246 | <xsl:with-param name="indicatorView" select="$indicatorView"/> |
---|
247 | <xsl:with-param name="ancillaryValueNames" select="$ancillaryValueNames"/> |
---|
248 | <xsl:with-param name="ancillaryValues" select="$Indicator.ancillaryValues"/> |
---|
249 | <xsl:with-param name="valueTypes" select="$Indicator.valueTypes"/> |
---|
250 | <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/> |
---|
251 | </xsl:call-template> |
---|
252 | </xsl:variable> |
---|
253 | |
---|
254 | <xsl:variable name="recordDimensionFields"> |
---|
255 | <xsl:call-template name="Interactive.getRecordDimensionFields"> |
---|
256 | <xsl:with-param name="dimensions" select="$Indicator.dimensions"/> |
---|
257 | <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/> |
---|
258 | </xsl:call-template> |
---|
259 | </xsl:variable> |
---|
260 | <xsl:variable name="datasetRecords" select="$indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/RECORDS"/> |
---|
261 | <xsl:variable name="indicatorViewDatasetRecords"> |
---|
262 | <xsl:call-template name="Interactive.getIndicatorViewDatasetRecords"> |
---|
263 | <xsl:with-param name="datasetRecords" select="$datasetRecords"/> |
---|
264 | <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/> |
---|
265 | <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/> |
---|
266 | </xsl:call-template> |
---|
267 | </xsl:variable> |
---|
268 | |
---|
269 | <!-- tried doing jsonp tech but callback func must be defined before doing the script jsonp |
---|
270 | so you'd have the variable = null, call back, end of script, include jsonp, then contructor |
---|
271 | script. Very messy - decided just to do simple var and include it. |
---|
272 | --> |
---|
273 | |
---|
274 | <xsl:if test="$showMap"> |
---|
275 | <xsl:call-template name="Graphic.choroplethMapJavaScript"/> |
---|
276 | </xsl:if> |
---|
277 | <script type="text/javascript" src="{$ibis.urlPrefix}js/jszip.js"/> |
---|
278 | <script type="text/javascript"> |
---|
279 | var records = |
---|
280 | [<xsl:text> </xsl:text> |
---|
281 | <xsl:call-template name="Dataset.getDatasetRecordsJSON"> |
---|
282 | <xsl:with-param name="dimensions" select="$Indicator.dimensions"/> |
---|
283 | <xsl:with-param name="datasetRecords" select="$indicatorViewDatasetRecords"/> |
---|
284 | <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/> |
---|
285 | <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/> |
---|
286 | <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/> |
---|
287 | </xsl:call-template> |
---|
288 | ]; |
---|
289 | |
---|
290 | var kendoDataSource = new kendo.data.DataSource( |
---|
291 | <xsl:call-template name="Kendo.dataSourceConstructorJSON"> |
---|
292 | <xsl:with-param name="javascriptRecordArrayVariableName" select="'records'"/> |
---|
293 | <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/> |
---|
294 | <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/> |
---|
295 | </xsl:call-template> |
---|
296 | ); |
---|
297 | |
---|
298 | var kendoGridConstructorJSON = $.extend |
---|
299 | (true, {} |
---|
300 | ,<xsl:call-template name="Kendo.baseGridJSON"/> |
---|
301 | ,<xsl:call-template name="Kendo.namedConfigurationJSON"> |
---|
302 | <xsl:with-param name="configurationName" select="'IndicatorProfileGrid'"/> |
---|
303 | </xsl:call-template> |
---|
304 | ,<xsl:call-template name="Kendo.requestGridJSON"> |
---|
305 | <xsl:with-param name="kendoDataSourceJavascriptVariableName" select="'kendoDataSource'"/> |
---|
306 | <xsl:with-param name="measure" select="$measure"/> |
---|
307 | <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/> |
---|
308 | <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/> |
---|
309 | <!-- GARTH TODO: note, label and VALUE ATTRIBUTE columns |
---|
310 | --> |
---|
311 | <xsl:with-param name="showValueAttributeColumn" select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(VALUE_ATTRIBUTE_NAME)])"/> |
---|
312 | <xsl:with-param name="showLabelColumn" select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/> |
---|
313 | <xsl:with-param name="showNoteColumn" select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/> |
---|
314 | </xsl:call-template> |
---|
315 | ); |
---|
316 | |
---|
317 | <xsl:if test="$showMap"> |
---|
318 | var leafletMapConstructorJSON = $.extend |
---|
319 | (true, {} |
---|
320 | ,<xsl:call-template name="LeafletMap.baseJSON"/> |
---|
321 | ,<xsl:call-template name="LeafletMap.namedConfigurationJSON"> |
---|
322 | <xsl:with-param name="configurationName" select="$indicatorView/MAP_NAME"/> |
---|
323 | </xsl:call-template> |
---|
324 | ,<xsl:call-template name="LeafletMap.requestJSON"> |
---|
325 | <!-- <xsl:with-param name="mapTitle" select="'Choropleth'"/> --> |
---|
326 | <xsl:with-param name="mapType" select="'choropleth'"/> |
---|
327 | </xsl:call-template> |
---|
328 | ,<xsl:call-template name="LeafletMap.choroplethJSON"> |
---|
329 | <xsl:with-param name="javascriptRecordArrayVariableName" select="'records'"/> |
---|
330 | <xsl:with-param name="geoJSONName" select="$indicatorView/MAP_DIMENSION_NAME"/> |
---|
331 | <xsl:with-param name="geoIDFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> |
---|
332 | <xsl:with-param name="geoIDFieldValuePrefixToRemove" select="concat($indicatorView/MAP_DIMENSION_NAME, '.')"/> |
---|
333 | <xsl:with-param name="measureValueFieldName" select="'MeasureValue'"/> |
---|
334 | <xsl:with-param name="legendTitle" select="$measure/TITLE"/> |
---|
335 | <xsl:with-param name="geoTypeTitle" select="ibis:getDimensionTitle($indicator//DIMENSIONS/DIMENSION[NAME = $indicatorView/MAP_DIMENSION_NAME])"/> |
---|
336 | <xsl:with-param name="reverseColors" select="$measure/DESIRABLE_VALUE = 1"/> |
---|
337 | <xsl:with-param name="desirableIndexValue" select="$measure/DESIRABLE_VALUE"/> |
---|
338 | |
---|
339 | <xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName) and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/> |
---|
340 | |
---|
341 | </xsl:call-template> |
---|
342 | ); |
---|
343 | </xsl:if> |
---|
344 | |
---|
345 | // GARTH TODO: remove |
---|
346 | <xsl:message select="'gggggggggggggg'"/> |
---|
347 | <xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/> |
---|
348 | <xsl:message select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/> |
---|
349 | <xsl:message select="$indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)]"/> |
---|
350 | <xsl:message select="'xxxxxxxxxxxx'"/> |
---|
351 | <xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/> |
---|
352 | <xsl:message select="'zzzzzzzzzz'"/> |
---|
353 | <xsl:message select="string-length($indicatorViewDatasetRecords/RECORD/NOTE)"/> |
---|
354 | |
---|
355 | |
---|
356 | <xsl:if test="$showChart"> |
---|
357 | var chartWidthVariable = $(".ExpandableContent").innerWidth(); |
---|
358 | var kendoChartConstructorJSON = $.extend |
---|
359 | (true, {} |
---|
360 | ,<xsl:call-template name="Kendo.baseChartJSON"/> |
---|
361 | ,<xsl:call-template name="Kendo.namedConfigurationJSON"> |
---|
362 | <xsl:with-param name="configurationName" select="$indicatorView/CHART_NAME"/> |
---|
363 | </xsl:call-template> |
---|
364 | ,<xsl:call-template name="Kendo.requestChartJSON"> |
---|
365 | <xsl:with-param name="kendoDataSourceJavascriptVariableName" select="'kendoDataSource'"/> |
---|
366 | <xsl:with-param name="title" select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/> |
---|
367 | <xsl:with-param name="seriesTitle" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/TITLE"/> |
---|
368 | <xsl:with-param name="categoryTitle" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/TITLE"/> |
---|
369 | <xsl:with-param name="valueTitle" select="$measure/TITLE"/> |
---|
370 | |
---|
371 | <xsl:with-param name="seriesFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/NAME"/> |
---|
372 | <xsl:with-param name="categoryFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/NAME"/> |
---|
373 | |
---|
374 | <xsl:with-param name="includeDatasetSeries" select="1 < $recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/VALUE_COUNT"/> |
---|
375 | <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/> |
---|
376 | </xsl:call-template> |
---|
377 | ); |
---|
378 | |
---|
379 | // have to manually add this because Kendo can't. See: |
---|
380 | // https://docs.telerik.com/kendo-ui/styles-and-layout/using-kendo-in-responsive-web-pages |
---|
381 | // another option: $(window).on("resize", function() { kendo.resize($(".chart-wrapper")); }); |
---|
382 | $(window).resize(resizeKendoChart); |
---|
383 | |
---|
384 | console.debug("IP.Page.xslt (%o, kendoChartConstructorJSON, (JSON.stringify(kendoChartConstructorJSON):"); |
---|
385 | console.debug("%o", kendoChartConstructorJSON); |
---|
386 | console.debug(JSON.stringify(kendoChartConstructorJSON,null,2)); |
---|
387 | </xsl:if> |
---|
388 | |
---|
389 | |
---|
390 | var $kendoGrid; |
---|
391 | var $kendoChart; |
---|
392 | var $leafletMap; |
---|
393 | $(document).ready(function() |
---|
394 | { |
---|
395 | <xsl:if test="$showMap"> |
---|
396 | $leafletMap = $("#map").leaflet(leafletMapConstructorJSON); |
---|
397 | </xsl:if> |
---|
398 | <xsl:if test="$showChart"> |
---|
399 | $kendoChart = $("#chart").kendoChart(kendoChartConstructorJSON); |
---|
400 | </xsl:if> |
---|
401 | $kendoGrid = $("#grid").kendoGrid(kendoGridConstructorJSON); |
---|
402 | |
---|
403 | // "read" fires the "change" event of the dataSource and any objects |
---|
404 | // that ref the data source will be bound. This needs to occur |
---|
405 | // after the grid and chart are created because .autoBind = false. |
---|
406 | // Can also fire load by issuing a sort: |
---|
407 | // $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"}); |
---|
408 | kendoDataSource.read(); |
---|
409 | |
---|
410 | // Kendo charts have an issue sizing the widget to the full width |
---|
411 | // when the chart's container starts out hidden. Tried numerous |
---|
412 | // things with timers and setting the width to the main content |
---|
413 | // control to firing resize when the control's input is changed. |
---|
414 | // If set the width then even as the window resizes the chart does |
---|
415 | // NOT change its size. So below code was commented out and the |
---|
416 | // input on change calls the resize func. |
---|
417 | // var chartContainerWidth = $(".ExpandableContent").innerWidth(); |
---|
418 | // $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth; |
---|
419 | }); //~~~~~~~~~~~~~~~~~~~~ End of Ready Function ~~~~~~~~~~~~~~~~~~~ |
---|
420 | |
---|
421 | |
---|
422 | // Called via the chart's expandable content input element's onchange |
---|
423 | // firing this code. Also bound to the windonws resize event to |
---|
424 | // properly resize the chart to fit the container. |
---|
425 | function resizeKendoChart() |
---|
426 | { |
---|
427 | kendo.resize( $(".k-chart") ); |
---|
428 | // another option: $kendoChart.getKendoChart().resize(); |
---|
429 | } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
430 | |
---|
431 | |
---|
432 | var baseExportFilename = "<xsl:value-of select="$baseExportFilename"/>"; |
---|
433 | |
---|
434 | function exportGrid() |
---|
435 | { |
---|
436 | var grid = $kendoGrid.getKendoGrid(); |
---|
437 | grid.options.excel.fileName = baseExportFilename + " - data.xlsx"; |
---|
438 | grid.saveAsExcel(); |
---|
439 | } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
440 | |
---|
441 | function exportChart() |
---|
442 | { |
---|
443 | var chart = $kendoChart.getKendoChart(); |
---|
444 | |
---|
445 | chart.exportImage().done |
---|
446 | ( |
---|
447 | function(data) |
---|
448 | { |
---|
449 | kendo.saveAs |
---|
450 | ({ |
---|
451 | dataURI: data |
---|
452 | ,fileName: baseExportFilename + ".png" |
---|
453 | }); |
---|
454 | } |
---|
455 | ); |
---|
456 | |
---|
457 | /* doesn't work |
---|
458 | chart.saveAsPDF(); |
---|
459 | chart.exportPDF().done( function(data) { kendo.saveAs(); } ); |
---|
460 | dataURI: "data:text/plain,Report title and text", |
---|
461 | */ |
---|
462 | chart.exportPDF().done |
---|
463 | ( |
---|
464 | function(data) |
---|
465 | { |
---|
466 | kendo.saveAs |
---|
467 | ({ |
---|
468 | dataURI: data |
---|
469 | ,fileName: baseExportFilename + " - chart.pdf" |
---|
470 | }); |
---|
471 | } |
---|
472 | ); |
---|
473 | } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
474 | |
---|
475 | function exportMap() |
---|
476 | { |
---|
477 | alert("Map export is not current supported."); |
---|
478 | } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
479 | |
---|
480 | <!-- |
---|
481 | ========================================================================== |
---|
482 | ========================================================================== |
---|
483 | ========================================================================== |
---|
484 | |
---|
485 | |
---|
486 | // Hack for vert bar charts to fill the width of the container. |
---|
487 | // Kendo charts have an issue filling when the container is hidden. |
---|
488 | // For some reason on my system need to wait 2 seconds for it |
---|
489 | // to work. |
---|
490 | // If set width then it's that size no matter what the window is |
---|
491 | // resized to. Only 100% sure fire way is to have open or fire |
---|
492 | // some script when opened. |
---|
493 | // setTimeout(resizeKendoChart, 1000); |
---|
494 | var chartContainerWidth = $(".ExpandableContent").innerWidth(); |
---|
495 | // $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth; |
---|
496 | // $("#chart").width = $(".ExpandableContent").innerWidth(); |
---|
497 | $kendoChart.getKendoChart().resize(); |
---|
498 | }); |
---|
499 | |
---|
500 | function resizeKendoChart() |
---|
501 | { |
---|
502 | // var chartContainerWidth = $(".ExpandableContent").innerWidth(); |
---|
503 | // $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth; |
---|
504 | $kendoChart.getKendoChart().resize(); |
---|
505 | // $kendoChart.resize($("#chart")); |
---|
506 | }; |
---|
507 | |
---|
508 | function myFunction() { |
---|
509 | kendoDataSource.read(); |
---|
510 | $kendoChart.getKendoChart().resize(); |
---|
511 | $kendoChart.getKendoChart().refresh(); |
---|
512 | $kendoChart.getKendoChart().redraw(); |
---|
513 | $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"}); |
---|
514 | } |
---|
515 | |
---|
516 | /* |
---|
517 | // none of these have any effect on the chart!!! |
---|
518 | // $kendoGrid.getKendoGrid().refresh(); |
---|
519 | // $kendoChart.width(1000); |
---|
520 | // $kendoChart.chartArea.width(1000); |
---|
521 | // $kendoChart.getKendoChart().resize(); |
---|
522 | // $kendoChart.getKendoChart().refresh(); |
---|
523 | // $kendoChart.getKendoChart().redraw(); |
---|
524 | |
---|
525 | $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"}); |
---|
526 | $kendoGrid.getKendoGrid().refresh(); |
---|
527 | $kendoChart.getKendoChart().redraw(); |
---|
528 | */ |
---|
529 | |
---|
530 | /* GARTH TODO: |
---|
531 | $("#grid tr[role='row']").on("mouseenter mouseover", function () { |
---|
532 | var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered |
---|
533 | chart.toggleHighlight(true, |
---|
534 | function(point) |
---|
535 | { |
---|
536 | return point.dataItem.Id === row.rowID; |
---|
537 | } |
---|
538 | ); //show the tooltip for the point where the Ids match |
---|
539 | |
---|
540 | |
---|
541 | |
---|
542 | |
---|
543 | GARTH TODO: |
---|
544 | |
---|
545 | // var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0); |
---|
546 | // alert("first slot width" + firstSlot.width()); |
---|
547 | |
---|
548 | <xsl:variable name="geoDimensionName" select=" |
---|
549 | if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME)) |
---|
550 | then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME |
---|
551 | else ($Indicator.dimensions/DIMENSION[ |
---|
552 | exists(GEOGRAPHY_FLAG) |
---|
553 | and |
---|
554 | NAME = $indicatorView//DIMENSION_USAGE/NAME |
---|
555 | ])[1]/NAME" |
---|
556 | /> |
---|
557 | |
---|
558 | <xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/> |
---|
559 | <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/> |
---|
560 | <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/> |
---|
561 | <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/> |
---|
562 | <xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/> |
---|
563 | <xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/> |
---|
564 | |
---|
565 | <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/> |
---|
566 | <xsl:message select="$Page.comparisonDimensionName"/> |
---|
567 | <xsl:message select="$Page.comparisonDimensionValue"/> |
---|
568 | <xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName) and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/> |
---|
569 | |
---|
570 | Stuff to try when doing dashboard |
---|
571 | function dataSource_change(e) { |
---|
572 | console.log(e); |
---|
573 | } |
---|
574 | kendoDataSource.bind("change", dataSource_change); |
---|
575 | select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName) and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/> |
---|
576 | |
---|
577 | ********************************************** |
---|
578 | |
---|
579 | PROBLEM: "CATEGORY":"GeoCnty.4" |
---|
580 | <xsl:with-param name="geoJSONName" select="$indicatorView/MAP_DIMENSION_NAME"/> |
---|
581 | |
---|
582 | ****************** |
---|
583 | probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area. |
---|
584 | |
---|
585 | ************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1 |
---|
586 | |
---|
587 | The IP and QM dimension files are all 1..31 |
---|
588 | |
---|
589 | So, need the field name then use the geotype and parse the .XXX from the end. |
---|
590 | Then in the QM will need to build the JSON fields the same way as we do with |
---|
591 | the IP - which is the right way to do it anyway so fields can be combined??? |
---|
592 | |
---|
593 | *** also have issues with if 2d and 3d... |
---|
594 | if mult series then drop down for that. |
---|
595 | if mult constants then drop down for that as well. |
---|
596 | when changed regen map. |
---|
597 | Need to specify the category field name and value |
---|
598 | Need to specify the series field name and value |
---|
599 | Need to specify the constant field name and value |
---|
600 | |
---|
601 | GeoJSON GeoID Prefix to add when doing comparison??? |
---|
602 | |
---|
603 | <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/> |
---|
604 | <xsl:variable name="communityDataset" select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/> |
---|
605 | <xsl:variable name="stateRecord" select="$communityDataset/RECORDS/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $stateDimensionName) and (VALUE = $stateDimensionValue)] and DIMENSION[(NAME = $periodName) and (VALUE = $periodValue)]]]"/> |
---|
606 | |
---|
607 | |
---|
608 | GARTH TODO: |
---|
609 | <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/> |
---|
610 | <xsl:message select="$indicatorViewDatasetRecords[1]"/> |
---|
611 | |
---|
612 | |
---|
613 | |
---|
614 | <xsl:with-param name="dimensionFieldInclusionCriteria"> |
---|
615 | records have the field names to filter. |
---|
616 | to include need field name and value. |
---|
617 | |
---|
618 | specifies the records held constant - This is to filter out not matching constant records |
---|
619 | |
---|
620 | for mouse overs, the title needs specifics - dimension title and dimension value title. |
---|
621 | <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION> |
---|
622 | <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION> |
---|
623 | </xsl:with-param> |
---|
624 | |
---|
625 | ========================================================================== |
---|
626 | <xsl:message select="$indicatorViewDatasetRecords/RECORD"/> |
---|
627 | |
---|
628 | <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/> |
---|
629 | <xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/> |
---|
630 | <xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> |
---|
631 | |
---|
632 | ========================================================================== |
---|
633 | ========================================================================== |
---|
634 | ========================================================================== |
---|
635 | --> |
---|
636 | |
---|
637 | </script> |
---|
638 | |
---|
639 | </xsl:template> |
---|
640 | |
---|
641 | </xsl:stylesheet> |
---|
642 | <!-- ============================= End of File ============================= --> |
---|