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

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

view, java - topics updated and css tweaks. L.Layersets logging and url prefix improved. Updated preview controller to save ALL IPV and IP xml files.

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