source: main/trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/view/Page.xslt @ 18588

Last change on this file since 18588 was 18588, checked in by GarthBraithwaite_STG, 3 years ago

view - fixed layersets init options extend from being complete deep additive, updated comments as went through code, cleaned up the layersets type handling. Updated kendo chart configs to match mouse scroll wheel and pan behavior. Fixed CP indicator/profile/view/Page.xslt dimensions list. Fixed IPV external content jquery selectors.

File size: 17.8 KB
Line 
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        <xsl:param name="Page.pageTitle" ibis:doc="Page's title text based on the 'INDICATOR/TITLE' element.">
29                Health Indicator Report - <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
30        </xsl:param>
31        <xsl:param name="Page.sectionsTitle" ibis:doc="Page's content block title text based on the 'INDICATOR/TITLE' element.">
32                Health Indicator Report of <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
33        </xsl:param>
34
35        <xsl:param name="Page.comparisonDimensionName"  select="'GeoState'"/>
36        <xsl:param name="Page.comparisonDimensionValue" select="'35'"/>
37
38        <xsl:param name="Page.showMap" ibis:doc="Exposed so that SS can access."
39                select="ibis:Graphic.showMap(
40                        $indicatorView/MAP_NAME,
41                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='category']/NAME,
42                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='series']/NAME,
43                        $Indicator.dimensions
44                )"
45        /> 
46        <xsl:param name="Page.showChart" select="ibis:Graphic.showChart($indicatorView/CHART_NAME)"/>
47
48        <xsl:param name="Indicator.contentBlockType" select="'fixed'"/>
49        <xsl:param name="Indicator.contentBlockTitleLevel" select="3"/>
50
51
52        <xsl:template name="Page.sectionsContent" ibis:doc="Main page content template that determines if IP or Surrogate.">
53
54                <!-- if no external content or external content AND a dest selector then call the default page. -->
55                <xsl:if test="(0 = string-length($indicatorView/EXTERNAL_CONTENT_URL)) or (0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))">
56                        <xsl:call-template name="Page.interativeContent">
57                                <xsl:with-param name="indicator"     select="$indicator"/>
58                                <xsl:with-param name="indicatorView" select="$indicatorView"/>
59                        </xsl:call-template>
60                </xsl:if>
61
62                <!-- if external content of any sort e.g. complete replacement or section. -->
63                <xsl:if test="(0 != string-length($indicatorView/EXTERNAL_CONTENT_URL))">
64                        <xsl:call-template name="Page.insertAJAXContent">
65                                <xsl:with-param name="sourceContentURL"            select="$indicatorView/EXTERNAL_CONTENT_URL"/>
66                                <xsl:with-param name="sourceContentJQuerySelector" select="$indicatorView/EXTERNAL_CONTENT_SELECTOR"/>
67                                <xsl:with-param name="destContentJQuerySelector" 
68                                        select="if(0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))
69                                                then $indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR
70                                                else 'sectionsContainer'"
71                                />
72                        </xsl:call-template>
73                </xsl:if>
74        </xsl:template>
75
76
77        <xsl:template name="Page.interativeContent"
78                ibis:doc="Main interactive sections content template."
79        >
80                <xsl:param name="indicator"/>
81                <xsl:param name="indicatorView"/>
82                <xsl:param name="measure" select="$Indicator.measure"/>
83
84                <xsl:variable name="recordDimensionFields">
85                        <xsl:call-template name="Interactive.getRecordDimensionFields">
86                                <xsl:with-param name="dimensions"      select="$Indicator.dimensions"/>
87                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
88                        </xsl:call-template>
89                </xsl:variable>
90                <xsl:variable name="datasetRecords" select="$indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/RECORDS"/>
91                <xsl:variable name="indicatorViewDatasetRecords">
92                        <xsl:call-template name="Interactive.getIndicatorViewDatasetRecords">
93                                <xsl:with-param name="datasetRecords"  select="$datasetRecords"/>
94                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
95                                <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
96                        </xsl:call-template>
97                </xsl:variable>
98                <xsl:variable name="valueAttributeNames" select="distinct-values($indicatorViewDatasetRecords//VALUE_ATTRIBUTE_NAME)"/>
99
100<style>
101        .Container.Text
102        {
103                background-color: #f8f8f8;
104                padding: 0.5em 1.5em 1em 1.5em;
105                border: 1px solid #999;
106                width: 100%;
107        }
108        .Graphic.Chart, .Graphic.Map, .Graphic.Grid
109        {
110                margin-top:     1.5em;
111        }
112</style>
113<!--
114                <xsl:call-template name="Indicator.whyImportant"/>
115-->
116                <xsl:call-template name="Indicator.contentBlock">
117                        <xsl:with-param name="additionalClasses">ColumnContainer Text</xsl:with-param>
118                        <xsl:with-param name="content">
119                                <div class="LeftColumn">
120                                <span class="Bold">Definition: </span>
121                                <xsl:value-of select="$indicator/DEFINITION"/>
122                                </div>
123                                <div class="RightColumn">
124                                <span class="Bold">Why is this Important: </span>
125                                <xsl:value-of select="$indicator/WHY_IMPORTANT"/>
126                                </div>
127                        </xsl:with-param>
128                        <xsl:with-param name="description" select="'Text that describes why this indicator is important to the populations overall health'"/>
129                </xsl:call-template>
130
131
132                <xsl:if test="$Page.showMap">
133                        <xsl:call-template name="Graphic.mapContainer">
134                                <xsl:with-param name="containerID" select="'map'"/>
135                                <xsl:with-param name="title" select="ibis:getIndicatorViewMapTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
136                                <xsl:with-param name="footerContent" select="$indicatorView/MAP_NARRATIVE"/>
137                        </xsl:call-template>
138                </xsl:if>
139
140                <xsl:if test="$Page.showChart">
141                        <xsl:call-template name="Graphic.chartContainer">
142                                <xsl:with-param name="containerID"   select="'chart'"/>
143                                <xsl:with-param name="footerContent" select="$indicatorView/CHART_NARRATIVE/text()"/>
144                        </xsl:call-template>
145                </xsl:if>
146
147                <xsl:call-template name="Indicator.externalDataViz">
148                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
149                </xsl:call-template>
150
151                <xsl:call-template name="Graphic.gridContainer">
152                        <xsl:with-param name="containerID"   select="'grid'"/>
153                        <xsl:with-param name="valueAttributeNames" select="$valueAttributeNames"/>
154                        <xsl:with-param name="valueAttributes"     select="$Indicator.valueAttributes"/>
155                </xsl:call-template>
156
157                <xsl:call-template name="Indicator.dataNotes">
158                        <xsl:with-param name="title"         select="''"/>
159                        <xsl:with-param name="measure"       select="$measure"/>
160                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
161                </xsl:call-template>
162                <xsl:call-template name="Indicator.dataSources"/>
163                <xsl:call-template name="Indicator.definition"/>
164                <xsl:call-template name="Indicator.howCalculated"/>
165
166                <xsl:call-template name="Indicator.allDates"/>
167
168                <xsl:variable name="ancillaryValueNames" select="distinct-values($indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/ANCILLARY_VALUE_USAGES/ANCILLARY_VALUE_USAGE/NAME)"/>
169                <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/>
170                <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
171                <xsl:call-template name="Graphic.leafletKendoScript">
172                        <xsl:with-param name="scriptContainerID"     select="concat($indicatorView/NAME, '_script')"/>
173                        <xsl:with-param name="dimensions"            select="$Indicator.dimensions"/>
174                        <xsl:with-param name="datasetRecords"        select="$indicatorViewDatasetRecords"/>
175                        <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
176                        <xsl:with-param name="recordAncillaryValueFields">
177                                <xsl:call-template name="Interactive.getIndicatorRecordAncillaryValueFields">
178                                        <xsl:with-param name="indicator"     select="$indicator"/>
179                                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
180                                        <xsl:with-param name="ancillaryValueNames" select="$ancillaryValueNames"/>
181                                        <xsl:with-param name="ancillaryValues" select="$Indicator.ancillaryValues"/>
182                                        <xsl:with-param name="valueTypes"      select="$Indicator.valueTypes"/>
183                                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
184                                </xsl:call-template>
185                        </xsl:with-param>
186
187                        <xsl:with-param name="measure" select="$measure"/>
188                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
189
190                        <xsl:with-param name="showMap"        select="$Page.showMap"/>
191                        <xsl:with-param name="mapName"        select="$indicatorView/MAP_NAME"/>
192                        <xsl:with-param name="geoJSONName"    select="$indicatorView/MAP_DIMENSION_NAME"/>
193                        <xsl:with-param name="geoIDFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
194                        <xsl:with-param name="geoIDFieldValuePrefixToRemove" select="concat($indicatorView/MAP_DIMENSION_NAME, '.')"/>
195                        <xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($indicator//DIMENSIONS/DIMENSION[NAME = $indicatorView/MAP_DIMENSION_NAME])"/>
196                        <xsl:with-param name="mapComparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
197
198                        <xsl:with-param name="showChart"     select="$Page.showChart"/>
199                        <xsl:with-param name="chartName"     select="$indicatorView/CHART_NAME"/>
200                        <xsl:with-param name="chartTitle"    select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
201
202                        <xsl:with-param name="showGrid"      select="true()"/>
203                        <xsl:with-param name="showValueAttributeColumn" select="0 != count($valueAttributeNames)"/>
204                        <xsl:with-param name="showLabelColumn"          select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
205<!-- never show this...
206                        <xsl:with-param name="showNoteColumn"           select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
207-->
208
209                        <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
210                </xsl:call-template>
211        </xsl:template>
212
213
214
215
216<!--
217==========================================================================
218==========================================================================
219==========================================================================
220
221
222                                // Hack for vert bar charts to fill the width of the container.
223                                // Kendo charts have an issue filling when the container is hidden.
224                                // For some reason on my system need to wait 2 seconds for it
225                                // to work.
226                                // If set width then it's that size no matter what the window is
227                                // resized to.  Only 100% sure fire way is to have open or fire
228                                // some script when opened.
229//                              setTimeout(resizeKendoChart, 1000);
230                                var chartContainerWidth = $(".ExpandableContent").innerWidth();
231//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
232//                              $("#chart").width = $(".ExpandableContent").innerWidth();
233                                $kendoChart.getKendoChart().resize();
234                        });
235
236                        function resizeKendoChart()
237                        {
238//                              var chartContainerWidth = $(".ExpandableContent").innerWidth();
239//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
240                                $kendoChart.getKendoChart().resize();
241//                              $kendoChart.resize($("#chart"));
242                        };
243
244function myFunction() {
245                                kendoDataSource.read();
246                                $kendoChart.getKendoChart().resize();
247                                $kendoChart.getKendoChart().refresh();
248                                $kendoChart.getKendoChart().redraw();
249                                $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
250}
251
252/*                     
253// none of these have any effect on the chart!!!
254//                              $kendoGrid.getKendoGrid().refresh();
255//                              $kendoChart.width(1000);
256//                              $kendoChart.chartArea.width(1000);
257//                              $kendoChart.getKendoChart().resize();
258//                              $kendoChart.getKendoChart().refresh();
259//                              $kendoChart.getKendoChart().redraw();
260
261$kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
262                                $kendoGrid.getKendoGrid().refresh();
263                                $kendoChart.getKendoChart().redraw();
264*/
265
266/* GARTH TODO:
267$("#grid tr[role='row']").on("mouseenter mouseover", function () {
268        var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
269        chart.toggleHighlight(true,
270                function(point)
271                {
272                        return point.dataItem.Id === row.rowID;
273                }
274        ); //show the tooltip for the point where the Ids match
275
276
277
278
279GARTH TODO:
280
281// var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
282// alert("first slot width" + firstSlot.width());
283
284<xsl:variable name="geoDimensionName" select="
285        if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
286        then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
287        else ($Indicator.dimensions/DIMENSION[
288                        exists(GEOGRAPHY_FLAG)
289                        and
290                        NAME = $indicatorView//DIMENSION_USAGE/NAME
291                ])[1]/NAME"
292/>
293
294<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
295<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
296<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
297<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
298<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
299<xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
300
301<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
302<xsl:message select="$Page.comparisonDimensionName"/>
303<xsl:message select="$Page.comparisonDimensionValue"/>
304<xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
305
306Stuff to try when doing dashboard
307function dataSource_change(e) {
308  console.log(e);
309}
310kendoDataSource.bind("change", dataSource_change);
311select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
312
313**********************************************
314
315PROBLEM: "CATEGORY":"GeoCnty.4"
316                                                <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
317                                               
318******************
319probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
320
321************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
322
323The IP and QM dimension files are all 1..31
324
325So, need the field name then use the geotype and parse the .XXX from the end.
326Then in the QM will need to build the JSON fields the same way as we do with
327the IP - which is the right way to do it anyway so fields can be combined???
328
329*** also have issues with if 2d and 3d...
330        if mult series then drop down for that.
331        if mult constants then drop down for that as well.
332        when changed regen map.
333        Need to specify the category field name and value
334        Need to specify the series field name and value
335        Need to specify the constant field name and value
336       
337        GeoJSON GeoID Prefix to add when doing comparison???
338
339        <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
340        <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
341        <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)]]]"/>
342
343
344GARTH TODO:
345        <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
346<xsl:message select="$indicatorViewDatasetRecords[1]"/>
347
348
349
350<xsl:with-param name="dimensionFieldInclusionCriteria">
351records have the field names to filter.
352to include need field name and value.
353
354specifies the records held constant - This is to filter out not matching constant records
355
356for mouse overs, the title needs specifics - dimension title and dimension value title.
357        <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
358        <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
359</xsl:with-param>
360
361==========================================================================
362<xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
363
364<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
365<xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
366<xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
367
368==========================================================================
369==========================================================================
370==========================================================================
371-->
372
373</xsl:stylesheet>
374<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.