diff --git a/JL_Emergency_Room/JL_Emergency_Room.txt b/JL_Emergency_Room/JL_Emergency_Room.txt new file mode 100644 index 0000000..cdf9c27 --- /dev/null +++ b/JL_Emergency_Room/JL_Emergency_Room.txt @@ -0,0 +1 @@ +{"color---templates/gridV/index.html---Button-Text":"#ffffff","text---templates/gridV/index.html-User-text":"Dr.%20Mendez","action---templates/gridV/index.html-2":"false","color---templates/gridV/index.html---Header-Text":"#ffffff","askdata---templates/gridV/index.html-3":"","webedit---templates/gridV/index.html-1":"false","text---templates/gridV/index.html-Download-Data-text":"Download%20Data%20","warnings---templates/gridV/index.html-3":"false","text---templates/gridV/index.html-Action-text":"Explain%20Me","webedit---templates/gridV/index.html-2":"false","color---templates/gridV/index.html---Header-Background":"#000000","parameter---templates/gridV/index.html-parameter":"[['Choose Dept'],['Select Department'],['Select Department'],[]]","color---templates/gridV/index.html---Footer-Text":"#ffffff","WARN":"agree","img---templates/gridV/index.html-img-logo":"https://static.vecteezy.com/system/resources/thumbnails/017/177/954/small/round-medical-cross-symbol-on-transparent-background-free-png.png","text---templates/gridV/index.html-Viz-1-text":"Overview","warnings---templates/gridV/index.html-1":"false","warnings---templates/gridV/index.html-2":"false","TOKEN_NAME":"","text---templates/gridV/index.html-WebEdit-text":"Web%20Edit%20","SITE_NAME":"","filter---templates/gridV/index.html-filter":"[[],[],[],[]]","view---templates/gridV/index.html-view":"https://public.tableau.com/views/JL_Emergency_Room_1/JL_Emergency_Room_1?:showVizHome=no&:embed=true,https://public.tableau.com/views/JL_Emergency_Room_2/JL_Emergency_Room_2?:showVizHome=no&:embed=true,https://public.tableau.com/views/JL_Emergency_Room_3/JL_Emergency_Room_3?:showVizHome=no&:embed=true,","askdata---templates/gridV/index.html-0":"","text---templates/gridV/index.html-Filter-text-MonthChoser.Param":"MonthChoser.Param","text---templates/gridV/index.html-Terms-text":"Terms%20%26%20Conditions%20","text---templates/gridV/index.html-Filter-text-Choose Dept":"Choose%20Dept","action---templates/gridV/index.html-1":"true","lastpageloaded-grid":"1","text---templates/gridV/index.html-Viz-4-text":"Viz%204%20","askdata---templates/gridV/index.html-1":"","text---templates/gridV/index.html-Reset-Viz-text":"Reset%20Viz%20","color---templates/gridV/index.html---Button-Background":"#000000","webedit---templates/gridV/index.html-0":"false","text---templates/gridV/index.html-AskData-text":"Ask%20data%20","color---templates/gridV/index.html---Footer-Background":"#454545","color---templates/gridV/index.html---Content-Background":"#ffffff","color---templates/gridV/index.html---Content-Text":"#ffffff","TOKEN_VALUE":"","action---templates/gridV/index.html-0":"false","SERVER_URL":"","action---templates/gridV/index.html-3":"false","text---templates/gridV/index.html-PrivacyPolicy-text":"Privacy%20Policy%20","webedit---templates/gridV/index.html-3":"false","text---templates/gridV/index.html-Filter-text-Select Department":"Select%20Department","color---templates/gridV/index.html---Button-Hover-Background":"#454545","askdata---templates/gridV/index.html-2":"","warnings---templates/gridV/index.html-0":"false","color---templates/gridV/index.html---Button-Hover-Text":"#ffffff","VERSION":"1.02","img---templates/gridV/index.html-img-avatar":"https://cdn4.iconfinder.com/data/icons/professions-1-2/151/3-512.png","text---templates/gridV/index.html-Viz-3-text":"Patients","text---templates/gridV/index.html-Viz-2-text":"Diversity"} \ No newline at end of file diff --git a/JL_Emergency_Room/css/config.css b/JL_Emergency_Room/css/config.css new file mode 100644 index 0000000..e1c98e6 --- /dev/null +++ b/JL_Emergency_Room/css/config.css @@ -0,0 +1,12 @@ +:root { +--Button-Text:#ffffff; +--Header-Text:#ffffff; +--Header-Background:#000000; +--Footer-Text:#ffffff; +--Button-Background:#000000; +--Footer-Background:#454545; +--Content-Background:#ffffff; +--Content-Text:#ffffff; +--Button-Hover-Background:#454545; +--Button-Hover-Text:#ffffff; +} \ No newline at end of file diff --git a/JL_Emergency_Room/css/layout.css b/JL_Emergency_Room/css/layout.css new file mode 100644 index 0000000..1d6f69c --- /dev/null +++ b/JL_Emergency_Room/css/layout.css @@ -0,0 +1,75 @@ +body{ + margin: 0px; +} +.container { + display: grid; + font-family: Arial, Helvetica, sans-serif; + grid-template-areas: + "header header" + "nav content" + "footer footer"; + + grid-template-columns: 200px 1fr; + grid-template-rows: auto 1fr auto; + grid-gap: 0px; + + height: 100vh; +} + +header { + grid-area: header; + background-color: var(--Header-Background); + color: var(--Header-Text); +} + +nav { + color: var(--Header-Text); + background-color: var(--Button-Background); + grid-area: nav; +} + +main { + grid-area: content; + color: var(--Content-Text); + background-color: var(--Content-Background); +} + +footer { + grid-area: footer; +} +.log{ + max-height: 50px; + width: auto; + margin: 10px; +} +.logo { + width: 100%; + height: 100%; + color: var(--Header-Text); + display: flex; +} +.person { + margin: auto 20px auto auto; +} +@media (max-width: 768px) { + .container { + grid-template-areas: + "header" + "nav" + "content" + "side" + "footer"; + + grid-template-columns: 1fr; + grid-template-rows: + auto /* Header */ + minmax(75px, auto) /* Nav */ + 1fr /* Content */ + minmax(75px, auto) /* Sidebar */ + auto; /* Footer */ + } + + nav, aside { + margin: 0; + } +} \ No newline at end of file diff --git a/JL_Emergency_Room/css/page.css b/JL_Emergency_Room/css/page.css new file mode 100644 index 0000000..29629a5 --- /dev/null +++ b/JL_Emergency_Room/css/page.css @@ -0,0 +1,92 @@ + +.header_right { + display: flex; + line-height: 25px; +} +.ButtonBar { + overflow: hidden; + display: flex; + font-family: Arial, Helvetica, sans-serif; + min-height: 35px; + white-space: nowrap; + flex-direction: column; + margin-top: 30px; +} + +.ButtonBar a{ + display: flex; +} +.ButtonBar a i{ + margin-right: 5px; +} +.ButtonBar a:not(.filter-entry) { + + font-size: 16px; + color: var(--Button-Text); + text-align: center; + padding-right:20px; + padding-left:20px; + height: 25px; + text-decoration: none; + padding-top: 10px; +} + +.ButtonBar a{ + transition: all 0.5s; +} +.ButtonBar a:hover { + background-color: var(--Button-Hover-Background); + color: var(--Button-Hover-Text); +} + +.divider{ + margin-top: 8px; + color:var(--Button-Background); + text-align: center; + border-top: grey; + border-top-width: 1px; + border-top-style: solid; +} +.show { + display: block!important; +} + + +.dropdown { + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + background-color: var(--Button-Background); + z-index: 1; + max-height: 80%; + overflow: auto; +} + +/* Links inside the filter dropdown */ +.dropdown-content a { + color: var(--Button-Text); + padding: 12px 16px; + text-decoration: none; + display: block; +} + +.usrpic { + height: 30px; + margin-right: 10px; +} +.footer{ + background-color: var(--Footer-Background); + color: var(--Footer-Text); + display: flex; + line-height: 30px; + justify-content: space-between; + padding: 10px; +} +/* Change color of dropdown links on hover */ +.dropdown-content a:hover {background-color: var(--Button-Hover-Background)} + diff --git a/JL_Emergency_Room/img/tableau-white.png b/JL_Emergency_Room/img/tableau-white.png new file mode 100644 index 0000000..da55cf0 Binary files /dev/null and b/JL_Emergency_Room/img/tableau-white.png differ diff --git a/JL_Emergency_Room/img/user.png b/JL_Emergency_Room/img/user.png new file mode 100644 index 0000000..d7f82be Binary files /dev/null and b/JL_Emergency_Room/img/user.png differ diff --git a/JL_Emergency_Room/index.html b/JL_Emergency_Room/index.html new file mode 100644 index 0000000..3c770d7 --- /dev/null +++ b/JL_Emergency_Room/index.html @@ -0,0 +1,105 @@ + + + + + + + + + + + Tableau Example + + +
+
+ +
+ + + +
+
+
+
+
+ + +
+ + diff --git a/JL_Emergency_Room/lib/advanced.js b/JL_Emergency_Room/lib/advanced.js new file mode 100644 index 0000000..6abebd2 --- /dev/null +++ b/JL_Emergency_Room/lib/advanced.js @@ -0,0 +1,262 @@ +// YOU DON'T NEED TO WORRY ABOUT THIS +//Few explaination on each +var layout=""; +window.onresize = function(e){ + var wd=document.querySelector('body').clientWidth; + if(wd<800 && layout!="phone"){ + layout="phone"; + viz.getCurrentUrlAsync().then (function(current_url){ + var index=tab_server.indexOf(current_url.split("?")[0]); + loadVizByIndex(index,true,layout); + }) + } + if(wd>=800 && layout!=""){ + layout=""; + viz.getCurrentUrlAsync().then (function(current_url){ + var index=tab_server.indexOf(current_url.split("?")[0]); + loadVizByIndex(index,true,layout); + }) + } +}; +function showFilterBox(el){ + document.querySelector(`div[mid='${el}']`).classList.toggle("show"); + document.querySelectorAll(`.dropdown-content`).forEach((dd)=>{if(dd.getAttribute("mid")!=el)dd.classList.remove("show")}); +} +function populateFilterMenu(fil){ + var links=""; + if(fil.getAppliedValues()==null){ + console.log("this filter as no applied values :"+fil.getFieldName()); + return; + } + fil.getAppliedValues().map((val)=>{ + var found=false; + document.querySelectorAll(`[filName="${fil.getFieldName()}"]`).forEach((el)=>{ + console.log(); + if(el.text==val.value.toString()) + found=true; + }) + if(!found ){ + links+=`${val.value}`; + } + }) + var list=` + +
${fil.getFieldName()}
+ +
` + if(document.querySelector(`div[mid='${fil.getFieldName()}']`)==null){ + document.getElementsByClassName("filter-container")[0].innerHTML=list+document.getElementsByClassName("filter-container")[0].innerHTML; + } + else{ + document.querySelector(`div[mid='${fil.getFieldName()}']`).innerHTML+=links; + } +} +function populateParameterMenu(param){ + var links=""; + if(param.getAllowableValues()==null){ + console.log("this param as no allowable values :"+param.getName()); + return; + } + param.getAllowableValues().map((val)=>{ + var found=false; + document.querySelectorAll(`[paramName="${param.getName()}"]`).forEach((el)=>{ + if(el.text==val.value) + found=true; + }) + if(!found ){ + links+=`${val.formattedValue}`; + } + }) + var list=` + +
${param.getName()}
+ +
` + if(document.querySelector(`div[mid='${param.getName()}']`)==null){ + document.getElementsByClassName("filter-container")[0].innerHTML=list+document.getElementsByClassName("filter-container")[0].innerHTML; + } + else{ + document.querySelector(`div[mid='${param.getName()}']`).innerHTML+=links; + } +} +function getParametersForViz(index){ + workbook.getParametersAsync().then((current_param)=>{ + if(typeof(tab_all_params)!="undefined")tab_all_params[index]={parameters:current_param,viz:viz}; + current_param.map((f)=>{ + tab_param[index].map((cf)=>{ + if(cf==f.getName()){ + populateParameterMenu(f); + } + }) + }) + window.parent.restoreTexts(); + }) +} +function getFiltersForViz(index){ + activeSheet.getFiltersAsync().then((current_filter)=>{ + if(typeof(tab_all_filters)!="undefined") { + tab_all_filters[index].filters=[]; + current_filter.map((fl)=>{ + var found=false; + tab_all_filters[index].filters.map(tb=>{ + if(tb.getFieldName()==fl.getFieldName()) + found=true; + }) + if(found==false) + tab_all_filters[index].filters.push(fl) + + }) + tab_all_filters[index].viz=viz; + } + current_filter.map((f)=>{ + tab_filter[index].map((cf)=>{ + if(cf==f.getFieldName()){ + populateFilterMenu(f); + } + }) + }) + window.parent.restoreTexts(); + }) +} +function hideDropDownList(filterName){ + document.querySelector(`div[mid='${filterName}']`).classList.remove("show") +} +function hideEditAskButton(){ + document.getElementsByClassName("webedit")[0].style.display = "none"; + document.getElementsByClassName("askdata")[0].style.display = "none"; +} +function hideEditButton(){ + document.getElementsByClassName("webedit")[0].style.display = "none"; +} +function hideActionButton(){ + document.getElementsByClassName("action")[0].style.display = "none"; +} +function showActionIfExist(index){ + var ids; + tab_action.map((el,id)=>{ + if(el.key==String(index)) + ids=el; + }) + if(ids && ids.val && ids.val=="true") + document.getElementsByClassName("action")[0].style.display = "inline-flex"; +} +function showWebEditIfExist(index){ + var ids; + tab_web.map((el,id)=>{ + if(el.key==String(index)) + ids=el; + }) + if(ids && ids.val && ids.val=="true") + document.getElementsByClassName("webedit")[0].style.display = "inline-flex"; +} +function showAskButtonIfExist(index){ + var ids; + tab_ask.map((el,id)=>{ + if(el.key==String(index)) + ids=el; + }) + if(ids && ids.val && ids.val!=""){ + document.getElementsByClassName("askdata")[0].style.display = "inline-flex"; + } +} +function getElementIndexByIndex(arr,index){ + var ids=-1; + arr.map((el,id)=>{ + if(el.key==String(index)) + ids=id; + }) + return ids +} +function navigateToSheet(workbook,sheetName,index){ + workbook.activateSheetAsync(sheetName).then(()=>{ + activeSheet=workbook.getActiveSheet(); + const removeElements = (elms) => elms.forEach(el => el.remove()); + removeElements( document.querySelectorAll(".filter_dropdown") ); + getFiltersForViz(index); + getParametersForViz(index); + showWebEditIfExist(index); + showActionIfExist(index); + showAskButtonIfExist(index); + // viz.addEventListener(tableau.TableauEventName.MARKS_SELECTION, onMarksSelection); + }); +} +function getOnlyText(from, to){ + from.map((el)=>{ + if(isNaN(el) && !/^(\d+|(\.\d+))(\.\d+)?%$/.test(el)){ + if(!to.includes(el)) + to.push(el); + } + }) + return to; +} +function clearFiltersMenu(){ + const removeElements = (elms) => elms.forEach(el => el.remove()); + removeElements( document.querySelectorAll(".filter_dropdown") ); +} +function restoreImgs(){ + tab_img.map((el)=>{ + if(document.getElementById(el.key)) + document.getElementById(el.key).setAttribute('src',el.val); + }) +} +function restoreTexts(){ + tab_text.map((el)=>{ + if(document.getElementById(el.key)) + document.getElementById(el.key).innerHTML=decodeURIComponent(el.val); + }) +} +function lengthInUtf8Bytes(str) { + var m = encodeURIComponent(str).match(/%[89ABab]/g); + return str.length + (m ? m.length : 0); +} +function setViewMenuVisibility(){ + var firstIndex=[]; + tab_server.map((s,ind)=>{ + if(s==""){ + document.querySelector(`.viz[index='${ind+1}']`).style.display='none'; + } + else{ + document.querySelector(`.viz[index='${ind+1}']`).style.display='inline-flex'; + firstIndex.push(ind); + } + }) + var lower=1000; + firstIndex.map((el)=>{ + lower=Math.min(lower,el) + }) + return lower; +} +function storeLastPageload(index){ + localStorage.setItem("lastpageloaded-grid",index); +} +function getLastPageload(index){ + var id=localStorage.getItem("lastpageloaded-grid"); + if(id!=null) + return parseInt(id); + return null; + +} +function getIndexFromViz(viz){ + return new Promise((resolve,reject)=>{ + viz.getCurrentUrlAsync().then (function(current_url){ + var index=tab_server.findIndex(element => element.includes(current_url.split("?")[0])); + resolve(index); + }) + }) +} +function findElement(arr,keyVal){ + var found = arr.filter(function(item) { return item.key === keyVal.toString(); }); + return found[0] || null; +} +function initialize(){ + if(typeof(tab_img)!="undefined"){ + restoreImgs(); + restoreTexts(); + if(title_index) + document.querySelector("head title").text=title_index; + } +} \ No newline at end of file diff --git a/JL_Emergency_Room/lib/config.js b/JL_Emergency_Room/lib/config.js new file mode 100644 index 0000000..79bfe0e --- /dev/null +++ b/JL_Emergency_Room/lib/config.js @@ -0,0 +1,9 @@ +var tab_server = ["https://public.tableau.com/views/JL_Emergency_Room_1/JL_Emergency_Room_1?:showVizHome=no&:embed=true","https://public.tableau.com/views/JL_Emergency_Room_2/JL_Emergency_Room_2?:showVizHome=no&:embed=true","https://public.tableau.com/views/JL_Emergency_Room_3/JL_Emergency_Room_3?:showVizHome=no&:embed=true",""]; + var tab_filter=[[],[],[],[]]; + var tab_web=[{"key":"1","val":"false"},{"key":"2","val":"false"},{"key":"0","val":"false"},{"key":"3","val":"false"}]; + var tab_ask=[{"key":"3","val":""},{"key":"0","val":""},{"key":"1","val":""},{"key":"2","val":""}]; + var tab_param=[["Choose Dept"],["Select Department"],["Select Department"],[]]; + var tab_text=[{"key":"User-text","val":"Dr.%20Mendez"},{"key":"Download-Data-text","val":"Download%20Data%20"},{"key":"Action-text","val":"Explain%20Me"},{"key":"Viz-1-text","val":"Overview"},{"key":"WebEdit-text","val":"Web%20Edit%20"},{"key":"Filter-text-MonthChoser.Param","val":"MonthChoser.Param"},{"key":"Terms-text","val":"Terms%20%26%20Conditions%20"},{"key":"Filter-text-Choose Dept","val":"Choose%20Dept"},{"key":"Viz-4-text","val":"Viz%204%20"},{"key":"Reset-Viz-text","val":"Reset%20Viz%20"},{"key":"AskData-text","val":"Ask%20data%20"},{"key":"PrivacyPolicy-text","val":"Privacy%20Policy%20"},{"key":"Filter-text-Select Department","val":"Select%20Department"},{"key":"Viz-3-text","val":"Patients"},{"key":"Viz-2-text","val":"Diversity"}]; + var tab_img=[{"key":"img-logo","val":"https://static.vecteezy.com/system/resources/thumbnails/017/177/954/small/round-medical-cross-symbol-on-transparent-background-free-png.png"},{"key":"img-avatar","val":"https://cdn4.iconfinder.com/data/icons/professions-1-2/151/3-512.png"}]; + var tab_action=[{"key":"2","val":"false"},{"key":"1","val":"true"},{"key":"0","val":"false"},{"key":"3","val":"false"}]; + var title_index="JL_Emergency_Room"; \ No newline at end of file diff --git a/JL_Emergency_Room/tableau.js b/JL_Emergency_Room/tableau.js new file mode 100644 index 0000000..75da015 --- /dev/null +++ b/JL_Emergency_Room/tableau.js @@ -0,0 +1,163 @@ +// This script contains all the Tableau JavaScript API calls needed +// The reference manual can be found here - https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm +// The JS API Tutorial can be found here - https://help.tableau.com/samples/en-us/js_api/tutorial.htm +var viz,workbook, activeSheet, options, placeholderDiv,selectedMarks,askindex=-1; + +function loadVizInit () { + // This function kicks off the process + initialize(); + setViewMenuVisibility(); + if(getLastPageload()==null){ + loadVizByIndex(setViewMenuVisibility()); + } + else{ + loadVizByIndex(getLastPageload()); + } +} +function loadVizByIndex (index,force,device ="") { + // This function simply loads each dashboard + // If all from the same workbook we can use activateSheetAsync() and method of the workbook class + // https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm#workbook_class + // If from different workbooks we need to reload the new viz from scratch + var url = tab_server[index]; + if(url=="") + return; + hideEditAskButton(); + hideActionButton(); + var isSameWorkbook=false; + if(workbook && !force && askindex==-1){ + var sheets = workbook.getPublishedSheetsInfo(); + sheets.map((sh)=>{ + if(sh.getUrl()==url){ + navigateToSheet(workbook,sh.getName(),index); + isSameWorkbook=true; + } + }) + } + if(!isSameWorkbook){ + placeholderDiv = document.getElementById("tableauViz"); + options = {device:device,width: '100%',height: '100%',hideTabs: true,hideToolbar: true,showShareOptions: false, + onFirstInteractive: function () { + workbook = viz.getWorkbook(); + activeSheet = workbook.getActiveSheet(); + getFiltersForViz(index); + getParametersForViz(index); + showWebEditIfExist(index); + showActionIfExist(index); + showAskButtonIfExist(index); + viz.addEventListener(tableau.TableauEventName.MARKS_SELECTION, onMarksSelection); + } + } + if(url){ + loadViz(placeholderDiv, url, options); + storeLastPageload(index); + } + } + askindex=-1; +} +function loadViz (placeholderDiv, url, options) { + // https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_initializing.htm + if(viz) + viz.dispose(); + viz = new tableau.Viz(placeholderDiv, url, options); + clearFiltersMenu(); +} +function launchAsk(){ + // This switches between view mode and Ask Data mode + if(askindex!=-1){ + loadVizByIndex(askindex,true); + askindex=-1; + return; + } + var containerDiv = document.getElementById("tableauViz"); + hideEditButton() + var ask_options = {width: '100%',height: '100%', + }; + viz.getCurrentUrlAsync().then(function(current_url){ + var indexv=tab_server.indexOf(current_url.split("?")[0]); + askindex=indexv; + loadViz (containerDiv, tab_ask[getElementIndexByIndex(tab_ask,indexv)].val, ask_options); + }) + +} +function launchEdit() { + // When embedding Web Edit this is the technique used - https://medium.com/@kannanmadhav/embedding-tableau-web-edit-in-a-web-application-246ff53eee76 + var containerDiv = document.getElementById("tableauViz"); + viz.getCurrentUrlAsync().then(function(current_url){ + hideEditAskButton() + edit_url = current_url.split('?')[0].replace('/views', '/authoring'); + edit_options = {hideTabs: true,hideToolbar: true,width: '100%',height: '100%', + onFirstInteractive: function () { + var iframe = document.querySelectorAll('iframe')[0]; + iframe.onload = function(){ + getIndexFromViz(viz).then (function(index){ + loadVizByIndex(index,true) + }) + } + } + }; + loadViz (containerDiv, edit_url, edit_options); + }) +} +function launchAction(){ + // Obtaining data from a Tableau dashboard via event listers + // This is an example of getting data from selected marks + // https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_events.htm + if(!selectedMarks){ + window.open('http://google.com/search?q=There is no selection :-)'); + return; + } + var textOnly=getOnlyText(selectedMarks,[]); + if(textOnly.length==0) + window.open('http://google.com/search?q=There are no text values in your selection :-)'); + if(lengthInUtf8Bytes(textOnly.join(" "))<1024) + window.open('http://google.com/search?q='+encodeURIComponent(textOnly.join(" "))); + else + window.open('http://google.com/search?q='+"Too many elements in your selection :-) Please reduce !"); +} +function onMarksSelection(marksEvent) { + getIndexFromViz(viz).then (function(index){ + if(findElement(tab_action,index) && findElement(tab_action,index).val=="true") + return marksEvent.getMarksAsync().then(reportSelectedMarks,(err)=>{alert("You don't have right to download data thus not able to see marks. Uncheck 'Actions' in the view settings")}); + }) +} +function reportSelectedMarks(marks) { + var curmarks = marks; + selectedMarks=[]; + for (var markIndex = 0; markIndex < curmarks.length; markIndex++) { + var pairs = curmarks[markIndex].getPairs(); + for (var pairIndex = 0; pairIndex < pairs.length; pairIndex++) { + var pair = pairs[pairIndex]; + selectedMarks.push(pair.value) + } + } +} +function applyFilter(filterName,value) { + // Filtering from the web page, pushing values into Tableau + // https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_filtering.htm + if(activeSheet.getSheetType()==tableau.SheetType.DASHBOARD) + activeSheet.getWorksheets().map((ws)=>{ + ws.applyFilterAsync(filterName,value,tableau.FilterUpdateType.REPLACE); + }) + else{ + activeSheet.applyFilterAsync(filterName,value,tableau.FilterUpdateType.REPLACE); + } + hideDropDownList(filterName); +} +function resetViz() { + // Action to rever the viz back to initial state + // Method of the viz class https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm#viz_class + viz.revertAllAsync(); +} +function dataDownload() { + // Action to rever the viz back to initial state + // Method of the viz class https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm#viz_class + viz.showExportDataDialog(); +} +function applyParam(paramName,value) { + // Same concept as filtering + // https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm#changeParameterValueAsync + workbook.changeParameterValueAsync(paramName, value) + hideDropDownList(paramName); +} + diff --git a/JL_Emergency_Room/thumbnail.png b/JL_Emergency_Room/thumbnail.png new file mode 100644 index 0000000..e711707 Binary files /dev/null and b/JL_Emergency_Room/thumbnail.png differ