Can you explain the functions below:
viz = new tableau.Viz(containerDiv, url, options);
function listenToMarksSelection() { viz.addEventListener(tableau.TableauEventName.MARKS_SELECTION, onMarksSelection); }
function onMarksSelection(marksEvent) { return marksEvent.getMarksAsync().then(reportSelectedMarks); }
function reportSelectedMarks(marks) {
var html = "";
for (var markIndex = 0; markIndex < marks.length; markIndex++) { var pairs = marks[markIndex].getPairs(); html += "<b>Mark " + markIndex + ":</b><ul>"; for (var pairIndex = 0; pairIndex < pairs.length; pairIndex++) { var pair = pairs[pairIndex]; html += "<li><b>Field Name:</b> " + pair.fieldName; html += "<br/><b>Value:</b> " + pair.formattedValue + "</li>"; } } }
This function just listen the selected mark
This one throw the selection in reportSelectedMarks
It take the marks and write it in an HTML file in a '<'li'>'. The fieldname would probably be a String and in the value it depend what you are workin with.
So basically these functions would be useful to dynamically print a selected mark on a graph or something like that and print a fielname and a value for that one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.