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

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

admin, view - added sep view and complete preview. Added dataset AV help. Changed topic nav from intro page to detail. Changed view to dark nav menu with transparent mega menu. Added processing gif to the chart and map divs. Changed ip complete profile to have content to right. Changed ipv to not be expandable content.

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