UNPKG

ni-webcharts-legends

Version:
3 lines 57.8 kB
!function(){"use strict";NationalInstruments.HtmlVI.Elements.GraphLegend=class extends window.JQX.BaseElement{static get properties(){return Object.assign({},super.properties,{graphRef:{value:"",type:"string"},isInEditMode:{value:!1,type:"boolean"}})}findGraph(){return document.querySelector("ni-cartesian-graph[graph-ref='"+this.graphRef+"']")||document.querySelector("ni-chart[graph-ref='"+this.graphRef+"']")||document.querySelector("ni-intensity-graph[graph-ref='"+this.graphRef+"']")||document.querySelector("ni-cartesian-graph[ni-control-id='"+this.graphRef+"']")||document.querySelector("ni-chart[ni-control-id='"+this.graphRef+"']")||document.querySelector("ni-intensity-graph[ni-control-id='"+this.graphRef+"']")}isDisabledOrInEditMode(){return this.disabled||this.isInEditMode}template(){return""}addDefaultClass(){}}}(),function(){"use strict";var e=NationalInstruments.HtmlVI.NISupport;NationalInstruments.HtmlVI.Elements.LegendHelpers=function(e,t){this.helpers=e,this.legendItemDisplay=t};var t=NationalInstruments.HtmlVI.Elements.LegendHelpers.prototype;t.createJQXButton=function(e,t=!1){var i=document.createElement(t?"jqx-toggle-button":"jqx-button");return i.className=e,i.animation="none",i.unfocusable=!0,i},t.addButtons=function(e,t,i){var s,n,a=this;e.children.forEach(function(e){(s=a.createJQXButton("ni-button",!0)).checked=!1,""!==e.cssClass&&s.classList.add(e.cssClass),s.addEventListener("change",function(){if(n!==this){if(this.checked){var t=n;n=this,t.checked=!1,a.helpers.handleClick(e.name,null,i),a.legendItemDisplay.updateShape(i)}}else this.checked=!0});var l=a.helpers.getState(e.name,i);void 0!==l&&(s.checked=l,!0===l&&(n=s)),t.appendChild(s)})},t.addComboBox=function(t,i,s,n,a){var l,r=this,o=0,d=!0,h=document.createElement("jqx-drop-down-list");for(i.appendChild(h),i.appendChild(h),h.itemHeight=32,h.dropDownHeight="auto",h.classList.add(...a.split(" ")),l=0;l<t.children.length;l++){var c=e.i18n(t.children[l].tag);"[msg_"===c.substring(0,5)&&(c=t.name);var p=`<label class="ni-selector-title">${c}</label><icon class="ni-selector-icon ${t.children[l].cssClass}" style="background-size: ${n}px 16px; width: ${n+4}px; "></icon>`;h.insert(l,p),!0===this.helpers.getState(t.children[l].name,s)&&(o=l)}h.addEventListener("change",function(e){!0!==d&&(r.helpers.handleClick(t.children[e.detail.index].name,null,s),r.legendItemDisplay.updateShape(s))}),h.selectedIndexes=[o],d=!1},t.addColorBox=function(e,t,i,s){var n=this,a=document.createElement("jqx-color-picker");a.style.width="inherit",a.animation="none",a.displayMode="palette",a.valueFormat="hex",a.hideContentToFit=[],a.classList.add("legend-colorbox-colorbox"),a.classList.add(...s.split(" ")),t.appendChild(a);var l=n.helpers.getState(e.name,i);a.value=l||"",a.addEventListener("change",function(){n.helpers.handleClick(e.name,a.value,i),n.legendItemDisplay.updateShape(i)})},t.addCheckBox=function(e,t,i,s){var n=this,a=document.createElement("jqx-check-box");a.animation="none",a.unfocusable=!0,a.className=s,a.classList.add("legend-checkbox"),a.addEventListener("change",function(t){n.helpers.handleClick(e.name,t.detail.value,i)}),t.appendChild(a);var l=n.helpers.getState(e.name,i);void 0!==l&&(a.checked=l)}}(),function(){"use strict";JQX("ni-light-plot-legend",class extends window.JQX.BaseElement{static get properties(){return Object.assign({},super.properties,{show:{value:!1,type:"boolean"},graphRef:{value:"",type:"string"},position:{value:"container",type:"string"}})}findGraph(){return document.querySelector("ni-cartesian-graph[graph-ref='"+this.graphRef+"']")||document.querySelector("ni-chart[graph-ref='"+this.graphRef+"']")}propertyChangedHandler(e,t,i){super.propertyChangedHandler(e,t,i);var s=this.findGraph();switch(e){case"position":case"show":for(;this.hasChildNodes();)this.removeChild(this.firstChild)}s&&s.updateGraphConfig()}addDefaultClass(){}})}();class NILightLegendModule{static get moduleName(){return"NILightLegendModule"}getSettings(){var e=this.ownerElement.getSettingsWorkaround(),t=this.findLegend(this.ownerElement.graphRef);if(!t)return e;var i={show:t.show,container:function(e){var t=null;return"nw"!==e.position&&"ne"!==e.position&&"sw"!==e.position&&"se"!==e.position&&(e.hasChildNodes()?t=e.lastChild:(t=document.createElement("div"),e.appendChild(t))),t}(t),position:t.position,margin:5};return e.legend=i,e}findLegend(e){return document.querySelector("ni-light-plot-legend[graph-ref='"+e+"']")}}JQX.Elements.whenRegistered("ni-cartesian-graph",function(e){e.addModule(NILightLegendModule)}),JQX.Elements.whenRegistered("ni-chart",function(e){e.addModule(NILightLegendModule)}),function(){"use strict";var e=NationalInstruments.HtmlVI.NISupport,t=NationalInstruments.Globals.jQuery,i=function(e){e.createRow(e.expanderWrapper,e.nPlots),e.helpers.addRenderer(e.nPlots),e.nPlots++},s=function(e,t){e.nPlots>0&&(e.removeRow(e.expanderWrapper,t),e.helpers.clearRenderer(t),e.nPlots--)};JQX("ni-plot-legend",class extends NationalInstruments.HtmlVI.Elements.GraphLegend{static get properties(){return Object.assign({},super.properties,{mode:{value:"full",type:"string"},tooltips:{value:!1,type:"boolean"}})}created(){super.created(),this.expanderWrapper=void 0,this.nPlots=0,this.helpers=new NationalInstruments.HtmlVI.Elements.PlotLegendHelpers,this.plotLegendItemDisplay=new NationalInstruments.HtmlVI.Elements.PlotLegendItemDisplay(this.helpers),this.uihelpers=new NationalInstruments.HtmlVI.Elements.LegendHelpers(this.helpers,this.plotLegendItemDisplay),this.deferLegendUpdates=!1}plotAdded(){this.deferLegendUpdates||i(this)}plotRemoved(e){this.deferLegendUpdates||s(this,e)}syncPlotLegendWithGraph(){if(this.deferLegendUpdates){var e=this.findGraph();if(!e)return;for(var t=e.plots.length;t<this.nPlots;){var n=this.nPlots-1;s(this,n)}for(;t>this.nPlots;)i(this)}}createRows(){var e;for(e=0;e<this.nPlots;e++)this.createRow(this.expanderWrapper,e)}removeRows(){var e;for(e=this.nPlots-1;e>=0;e--)this.removeRow(this.expanderWrapper,e)}throttlePlotUpdates(e){var t=this.findGraph();null!==t&&(t.throttlePlotUpdates(e),this.deferLegendUpdates=e)}attachToGraph(e){this.helpers.graph!==e?this.detachFromGraph():e&&e.plots.length<this.nPlots&&this.removeRows(),e&&e.isReady&&this.helpers.graph!==e&&(this.helpers.graph=e,this.nPlots=e.plots.length,this.createRows(),e.registerPlotLegend(this))}detachFromGraph(){this.helpers.clearCache(),this.helpers.graph=null,this.removeRows(),this.nPlots=0}attached(){var e,t,n=this;super.attached(),this.helpers.isInEditMode=this.isInEditMode,(e=document.createElement("div")).style.width="100%",e.style.height="100%",this.appendChild(e),(t=document.createElement("jqx-accordion")).style.width="100%",t.style.height="100%",t.animation="none","full"===this.mode?t.expandMode="toggle":t.expandMode="none",t.disabled=this.isDisabledOrInEditMode(),e.appendChild(t),this.expanderWrapper=t,"full"===this.mode&&t.addEventListener("expanding",function(e){var t=n.expanderWrapper.querySelectorAll("jqx-accordion-item")[e.detail.index].querySelector(".ni-details-box");n.loadContentIfNeeded(t,e.detail.index)}),this.addEventListener("ni-cartesian-plot-attached",function(){n.plotAdded(),n.helpers.clearCache()}),this.addEventListener("ni-cartesian-plot-detached",function(e){var t,i=e.detail.originalSource;t=n.helpers.getIndex(i),n.plotRemoved(t),n.helpers.clearCache()}),this.addEventListener("ni-cartesian-plot-changed",function(e){var t,i=e.detail.originalSource;t=n.helpers.getIndex(i),n.updatePlotName(t,n.helpers.getPlotName(t))}),this.addEventListener("ni-cartesian-plot-renderer-changed",function(e){var t,i=e.detail.originalSource;t=n.helpers.rendererToIndex(i),n.plotLegendItemDisplay.updateShape(t)}),this.addEventListener("ni-cartesian-plot-renderer-attached",function(e){var t,i=e.detail.originalSource;n.helpers.clearCache(),t=n.helpers.rendererToIndex(i),n.plotLegendItemDisplay.updateShape(t)}),this.addEventListener("ni-cartesian-plot-renderer-detached",function(e){var t,i=e.detail.originalSource;n.helpers.clearCache(),t=n.helpers.rendererToIndex(i),n.plotLegendItemDisplay.updateShape(t)}),this.addEventListener("ni-plot-count-changed",function(e){var t=e.detail.originalSource;if("compact"===n.mode){for(;t.plotCount<n.nPlots;){var a=n.nPlots-1;s(n,a)}for(;t.plotCount>n.nPlots;)i(n)}});var a=this.findGraph();null!==a&&this.attachToGraph(a)}createRow(e,t){var i,s,n,a,l,r,o;(i=document.createElement("jqx-accordion-item")).animation="none",i.id="expander"+t,i.className="ni-plot-legend-box",e.appendChild(i),(s=document.createElement("div")).id="header"+t,s.className="ni-master-row",i.querySelector(".jqx-label").appendChild(s),(a=document.createElement("div")).className="ni-plot-display",s.appendChild(a),this.plotLegendItemDisplay.createHeaderDisplay(a,t),this.plotLegendItemDisplay.updateShape(t),(o=document.createElement("span")).className="ni-plot-title",l=this.helpers.getPlotName(t),"compact"===this.mode&&(this.helpers.getPlot(t)||(l="Plot "+(t+1))),this.tooltips&&(o.title=l),r=document.createTextNode(l),o.appendChild(r),s.appendChild(o),(n=document.createElement("div")).id="content"+t,n.className="ni-details-box",i.querySelector(".jqx-content-container").appendChild(n),"full"===this.mode&&(i.expanded=!1),this.applyFont()}updatePlotName(e,i){var s=t(this.expanderWrapper).find(".ni-plot-title");t(s[e]).text(i)}loadContentIfNeeded(t,i){var s,n,a,l,r,o,d;if(null===t.querySelector(".ni-details"))for((s=document.createElement("table")).className="ni-details",t.appendChild(s),a=0;a<this.helpers.menu.length;a++){var h=this.helpers.menu[a];(n=document.createElement("tr")).className="ni-details-row "+(h.cssClass||""),s.appendChild(n),(o=document.createElement("td")).className="ni-detail-row-title-box",n.appendChild(o),(l=document.createElement("span")).className="ni-detail-row-title",o.appendChild(l);var c=e.i18n(h.tag);switch("[msg_"===c.substring(0,5)&&(c=h.name+"!"),r=document.createTextNode(c),l.appendChild(r),(d=document.createElement("td")).className="ni-details-row-operations-box",n.appendChild(d),h.type){case"buttons":this.uihelpers.addButtons(h,d,i);break;case"combobox":this.uihelpers.addComboBox(h,d,i,24,"ni-selector");break;case"colorbox":this.uihelpers.addColorBox(h,d,i,"ni-colorbox-selector ni-selector");break;case"checkbox":this.uihelpers.addCheckBox(h,d,i,"ni-hover-box")}}}removeRow(e,t){this.plotLegendItemDisplay.removeHeaderDisplay(null,t),e.removeAt(t)}setFont(e,i,s,n,a){var l=this.firstElementChild,r=t(this),o=t(l).find(" .jqx-widget-content"),d=t(l).find(" .ni-plot-title"),h=t(l).find(" .ni-detail-row-title");r.css({"font-size":e,"font-family":i,"font-weight":s,"font-style":n}),o.css({"font-size":e,"font-family":i,"font-weight":s,"font-style":n}),d.css({"font-size":e,"font-family":i,"font-weight":s,"font-style":n}),h.css({"font-size":e,"font-family":i,"font-weight":s,"font-style":n})}applyFont(){var e=this.firstElementChild,i=t(e).find(" .jqx-widget-content"),s=t(e).find(" .ni-plot-title"),n=t(e).find(" .ni-detail-row-title"),a=t(this).css("font-size"),l=t(this).css("font-family"),r=t(this).css("font-weight"),o=t(this).css("font-style");i.css({"font-size":a,"font-family":l,"font-weight":r,"font-style":o}),s.css({"font-size":a,"font-family":l,"font-weight":r,"font-style":o}),n.css({"font-size":a,"font-family":l,"font-weight":r,"font-style":o})}propertyChangedHandler(e,i,s){super.propertyChangedHandler(e,i,s);let n=this;switch(e){case"graphRef":this.helpers.graph.plotLegend=null;var a=this.findGraph();this.attachToGraph(a);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,t(this.expanderWrapper)[0].disabled=this.isDisabledOrInEditMode(),t(this.expanderWrapper).find(".ni-details-box").each(function(){t(this).find(".ni-button").each(function(){this.disabled=n.isDisabledOrInEditMode()}),t(this).find(".ni-selector").each(function(){this.disabled=n.isDisabledOrInEditMode()}),t(this).find(".ni-colorbox-selector").each(function(){this.disabled=n.isDisabledOrInEditMode()}),t(this).find(".ni-hover-box").each(function(){this.disabled=n.isDisabledOrInEditMode()})});break;case"tooltips":t(this).find(".ni-plot-title").each(function(e,t){t.title=this.tooltips?this.helpers.getPlotName(e):""}.bind(this))}}})}(),function(){"use strict";var e=NationalInstruments.HtmlVI.NISupport;NationalInstruments.HtmlVI.Elements.PlotLegendHelpers=function(){this.graph=null,this.isInEditMode=!1,this.defaultPlotColors=window.JQX.CartesianGraph.defaultPlotColors,this.lineStyleValues={dot:"1, 2",dashdot:"3, 3, 1, 3",mediumdash:"3, 3",largedash:"5, 4",solid:"0"},this.renderers=[]};var t=NationalInstruments.HtmlVI.Elements.PlotLegendHelpers,i=t.prototype;i.menu=[{name:"Plot Style",tag:"msg_plotstyle",type:"buttons",children:[{name:"Line",tag:"msg_line",cssClass:"ni-line-style-icon"},{name:"Point",tag:"msg_point",cssClass:"ni-point-style-icon"},{name:"Line & Point",tag:"msg_lineandpoint",cssClass:"ni-line-and-point-style-icon"},{name:"Bar",tag:"msg_bar",cssClass:"ni-bar-style-icon"},{name:"Fill",tag:"msg_fill",cssClass:"ni-fill-style-icon"}]},{name:"Point Style",tag:"msg_pointstyle",type:"buttons",children:[{name:"Ellipse",tag:"msg_ellipse",cssClass:"ni-ellipse-point-style-icon"},{name:"Rectangle",tag:"msg_rectangle",cssClass:"ni-rect-point-style-icon"},{name:"Diamond",tag:"msg_diamond",cssClass:"ni-diamond-point-style-icon"},{name:"Cross",tag:"msg_cross",cssClass:"ni-cross-point-style-icon"},{name:"Plus",tag:"msg_plus",cssClass:"ni-plus-point-style-icon"}]},{name:"Line Width",tag:"msg_linewidth",cssClass:"line_width",type:"combobox",children:[{name:"No line",tag:"msg_noline",cssClass:""},{name:"1-pixel",tag:"msg_1pixel",cssClass:"ni-1-pixel-line-width-icon"},{name:"2-pixels",tag:"msg_2pixels",cssClass:"ni-2-pixels-line-width-icon"},{name:"3-pixels",tag:"msg_3pixels",cssClass:"ni-3-pixels-line-width-icon"},{name:"4-pixels",tag:"msg_4pixels",cssClass:"ni-4-pixels-line-width-icon"},{name:"5-pixels",tag:"msg_5pixels",cssClass:"ni-5-pixels-line-width-icon"}]},{name:"Line Style",tag:"msg_linestyle",cssClass:"line_style",type:"combobox",children:[{name:"No style",tag:"msg_nostyle",cssClass:""},{name:"Solid",tag:"msg_solid",cssClass:"ni-solid-line-style-icon"},{name:"Dot",tag:"msg_dot",cssClass:"ni-dot-line-style-icon"},{name:"Dot-dash",tag:"msg_dashdot",cssClass:"ni-dot-dash-line-style-icon"},{name:"Medium dash",tag:"msg_mediumdash",cssClass:"ni-medium-dash-line-style-icon"},{name:"Large dash",tag:"msg_largedash",cssClass:"ni-large-dash-line-style-icon"}]},{name:"Fill Baseline",tag:"msg_fillbaseline",type:"buttons",children:[{name:"Zero",tag:"msg_zero",cssClass:"ni-fill-to-zero-style-icon"},{name:"-Inf",tag:"msg_neginf",cssClass:"ni-fill-base-line-negative-infinity-icon"},{name:"Inf",tag:"msg_inf",cssClass:"ni-fill-base-line-positive-infinity-icon"}]},{name:"Color",tag:"msg_color",type:"colorbox",children:[]},{name:"Hover",tag:"msg_hover",cssClass:"hover",type:"checkbox",children:[]}],i.addRenderer=function(){},i.clearRenderer=function(e){this.renderers[e]=null},i.clearCache=function(){for(var e=0;e<this.renderers.length;e++)this.renderers[e]=null},i.getPlot=function(e){var i=0,s=null,n=this.graph;if(null!==n)for(t in n.childNodes)if("ni-cartesian-plot"===n.childNodes[t].localName){if(i===e){s=n.childNodes[t];break}i++}return s},i.getIndex=function(e){var t,i;return null!==(i=e._parentGraph)&&(t=i.plots.indexOf(e)),t},i.getPlotName=function(t){var i=this.getPlot(t);return i&&"string"==typeof i.label?i.label:e.i18n("msg_defaultplotname")},i.getRenderer=function(e){var t=null,i=null;if(null===this.renderers[e]||void 0===this.renderers[e]){if(null!==(t=this.getPlot(e))&&(i=t.lastElementChild),null===i)return null;this.renderers[e]=i}return this.renderers[e]},i.rendererToIndex=function(e){var t,i,s,n=0;if(null!==(i=this.graph))for(s in i.childNodes)if("ni-cartesian-plot"===i.childNodes[s].localName){if(i.childNodes[s].lastElementChild===e){t=n;break}n++}return t},i.handleClick=function(e,t,i){if(!0!==this.isInEditMode){var s="",n=this.getRenderer(i);if(null===n)return;switch(""!==n.lineStroke&&(s=n.lineStroke),""!==n.pointColor&&(s=n.pointColor),""!==n.barFill&&(s=n.barFill),""!==n.areaFill&&(s=n.areaFill),e){case"No line":n.lineWidth=0;break;case"1-pixel":n.lineWidth=1;break;case"2-pixels":n.lineWidth=2;break;case"3-pixels":n.lineWidth=3;break;case"4-pixels":n.lineWidth=4;break;case"5-pixels":n.lineWidth=5;break;case"Line":n.lineStroke=s,n.pointColor="",n.barFill="",n.areaFill="";break;case"Point":n.lineStroke="",n.pointColor=s,n.barFill="",n.areaFill="";break;case"Line & Point":n.lineStroke=s,n.pointColor=s,n.barFill="",n.areaFill="";break;case"Bar":n.lineStroke="",n.pointColor="",n.barFill=s,n.areaFill="";break;case"Fill":n.lineStroke="",n.pointColor="",n.barFill="",n.areaFill=s;break;case"Ellipse":n.pointShape="ellipse";break;case"Rectangle":n.pointShape="rectangle";break;case"Diamond":n.pointShape="diamond";break;case"Cross":n.pointShape="cross";break;case"Plus":n.pointShape="plus";break;case"No style":n.lineStyle="";break;case"Solid":n.lineStyle="solid";break;case"Dot":n.lineStyle="dot";break;case"Dot-dash":n.lineStyle="dashdot";break;case"Medium dash":n.lineStyle="mediumdash";break;case"Large dash":n.lineStyle="largedash";break;case"Zero":n.areaBaseLine="zero",n.barBaseLine="zero";break;case"-Inf":n.areaBaseLine="negativeinfinity",n.barBaseLine="negativeinfinity";break;case"Inf":n.areaBaseLine="positiveinfinity",n.barBaseLine="positiveinfinity";break;case"Color":""!==n.lineStroke&&(n.lineStroke=t),""!==n.pointColor?n.pointColor=t:""!==n.barFill?n.barFill=t:""!==n.areaFill&&(n.areaFill=t);break;case"Hover":this.getPlot(i).enableHover=t}}},i.getState=function(e,t){var i=this.getRenderer(t);if(null!==i){var s;switch(e){case"No line":s=0===i.lineWidth;break;case"1-pixel":s=1===i.lineWidth;break;case"2-pixels":s=2===i.lineWidth;break;case"3-pixels":s=3===i.lineWidth;break;case"4-pixels":s=4===i.lineWidth;break;case"5-pixels":s=5===i.lineWidth;break;case"Line":s=""!==i.lineStroke&&""===i.pointColor;break;case"Point":s=""===i.lineStroke&&""!==i.pointColor;break;case"Line & Point":s=""!==i.lineStroke&&""!==i.pointColor;break;case"Bar":s=""!==i.barFill;break;case"Fill":s=""!==i.areaFill;break;case"Ellipse":s="ellipse"===i.pointShape;break;case"Rectangle":s="rectangle"===i.pointShape;break;case"Diamond":s="diamond"===i.pointShape;break;case"Cross":s="cross"===i.pointShape;break;case"Plus":s="plus"===i.pointShape;break;case"No style":s=""===i.lineStyle;break;case"Solid":s="solid"===i.lineStyle;break;case"Dot":s="dot"===i.lineStyle;break;case"Dot-dash":s="dashdot"===i.lineStyle;break;case"Medium dash":s="mediumdash"===i.lineStyle;break;case"Large dash":s="largedash"===i.lineStyle;break;case"Zero":s=""!==i.barFill?"zero"===i.barBaseLine||""===i.barBaseLine:"zero"===i.areaBaseLine||""===i.areaBaseLine;break;case"-Inf":s=""!==i.barFill?"negativeinfinity"===i.barBaseLine:"negativeinfinity"===i.areaBaseLine;break;case"Inf":s=""!==i.barFill?"positiveinfinity"===i.barBaseLine:"positiveinfinity"===i.areaBaseLine;break;case"Color":s=this.getPlotColorFromRenderer(i);break;case"Hover":s=this.getPlot(t).enableHover}return s}},i.getPlotColor=function(e){var t=this.getRenderer(e);return null!==t?this.getPlotColorFromRenderer(t):this.defaultPlotColors[e%this.defaultPlotColors.length]},i.getPlotColorFromRenderer=function(e){var t="rgba(0, 0, 0, 1)";return""!==e.lineStroke?t=e.lineStroke:""!==e.pointColor?t=e.pointColor:""!==e.barFill?t=e.barFill:""!==e.areaFill&&(t=e.areaFill),t},i.getLineWidth=function(e){var t=this.getRenderer(e);return null!==t?t.lineWidth:1},i.getLineShape=function(e){var t="line",i=this.getRenderer(e);return null!==i&&(""!==i.lineStroke&&""===i.pointColor?t="line":""===i.lineStroke&&""!==i.pointColor?t="points":""!==i.lineStroke&&""!==i.pointColor?t="line & point":""!==i.barFill?t="bar":""!==i.areaFill&&(t="fill")),t},i.getLineStyle=function(e){var t=this.getRenderer(e);if(null!==t)switch(t.lineStyle){case"dot":return this.lineStyleValues.dot;case"dashdot":return this.lineStyleValues.dashdot;case"mediumdash":return this.lineStyleValues.mediumdash;case"largedash":return this.lineStyleValues.largedash;default:return this.lineStyleValues.solid}return"0"},i.getPointShape=function(e){var t=this.getRenderer(e);return null!==t?t.pointShape:"ellipse"}}(),function(){"use strict";NationalInstruments.HtmlVI.Elements.PlotLegendItemDisplay=function(e){this.pointTypes=[{name:"ellipse",creator:l},{name:"rectangle",creator:r},{name:"diamond",creator:o},{name:"cross",creator:d},{name:"plus",creator:h}],this.lineTypes=[{name:"line",creator:i},{name:"fill",creator:s},{name:"bar",creator:n},{name:"points",creator:a}],this.shapes=[],this.helpers=e};var e=NationalInstruments.HtmlVI.Elements.PlotLegendItemDisplay.prototype;e.createHeaderDisplay=function(e,i){var s,n;s="http://www.w3.org/2000/svg",(n=document.createElementNS(s,"svg")).setAttribute("width","16"),n.setAttribute("height","16"),n.setAttribute("viewBox","0,0,16,16"),n.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),e.appendChild(n);var a=document.createElementNS(s,"g");n.appendChild(a),this.shapes[i]={},this.shapes[i].shapesGroup=a,t(i,a,s,this),a.setAttribute("stroke","rgba(255, 0, 0, 1)")},e.removeHeaderDisplay=function(e,t){this.shapes.splice(t,1)};var t=function(e,t,i,s){var n;for(n=0;n<s.lineTypes.length;n++)s.lineTypes[n].creator(e,t,i,s)},i=function(e,t,i,s){var n=document.createElementNS(i,"polyline");n.setAttribute("points","0,15 5,5 10,10 15,0"),n.setAttribute("fill","none"),n.setAttribute("stroke-width",s.helpers.getLineWidth(e)),n.setAttribute("stroke-dasharray",s.helpers.getLineStyle(e)),t.appendChild(n),s.shapes[e].shapesGroup.line=n},s=function(e,t,i,s){var n=document.createElementNS(i,"polyline");n.setAttribute("points","0,15 5,5 10,10 15,0, 15,15, 0,15"),n.setAttribute("fill",s.helpers.getPlotColor(e)),n.setAttribute("stroke-width",s.helpers.getLineWidth(e)),n.setAttribute("visibility","hidden"),t.appendChild(n),s.shapes[e].shapesGroup.fill=n},n=function(e,t,i,s){var n=document.createElementNS(i,"polyline");n.setAttribute("points","1.5,15.5 1.5,12.5, 4.5,12.5 4.5,15.5 6.5,15.5 6.5,3.5, 9.5,3.5 9.5,15.5 11.5,15.5 11.5,7.5 14.5,7.5 14.5,15.5 1.5,15.5"),n.setAttribute("fill",s.helpers.getPlotColor(e)),n.setAttribute("stroke-width",1),n.setAttribute("visibility","hidden"),t.appendChild(n),s.shapes[e].shapesGroup.bar=n},a=function(e,t,i,s){var n,a,l,r,o=[{x:.5,y:15.5},{x:10.5,y:10.5},{x:5.5,y:5.5},{x:15.5,y:.5}],d=document.createElementNS(i,"g");for(s.shapes[e].shapesGroup.points=d,a=0;a<s.pointTypes.length;a++){for(l=document.createElementNS(i,"g"),n=0;n<4;n++)r=s.pointTypes[a].creator(i,o[n],4),l.appendChild(r);l.setAttribute("fill",s.helpers.getPlotColor(e)),l.setAttribute("stroke-width",1),l.setAttribute("visibility","hidden"),d.appendChild(l),s.shapes[e].shapesGroup.points[s.pointTypes[a].name]=l}t.appendChild(d)},l=function(e,t,i){var s=document.createElementNS(e,"circle");return s.setAttribute("cx",t.x),s.setAttribute("cy",t.y),s.setAttribute("r",i/2),s},r=function(e,t,i){var s=document.createElementNS(e,"rect");return s.setAttribute("x",t.x-i/2),s.setAttribute("y",t.y-i/2),s.setAttribute("width",i),s.setAttribute("height",i),s},o=function(e,t,i){var s=document.createElementNS(e,"path"),n="M"+(t.x-i/2)+","+t.y;return n+=" L"+t.x+","+(t.y-i/2),n+=" L"+(t.x+i/2)+","+t.y,n+=" L"+t.x+","+(t.y+i/2),n+=" Z",s.setAttribute("d",n),s},d=function(e,t,i){var s=document.createElementNS(e,"path"),n="M"+(t.x-i/2)+","+(t.y-i/2);return n+=" L"+(t.x+i/2)+","+(t.y+i/2),n+="M"+(t.x+i/2)+","+(t.y-i/2),n+=" L"+(t.x-i/2)+","+(t.y+i/2),s.setAttribute("d",n),s},h=function(e,t,i){var s=document.createElementNS(e,"path"),n="M"+t.x+","+(t.y-i/2);return n+=" L"+t.x+","+(t.y+i/2),n+="M"+(t.x-i/2)+","+t.y,n+=" L"+(t.x+i/2)+","+t.y,s.setAttribute("d",n),s};e.updateLinesAttributes=function(e,t,i){var s=this.helpers.getLineShape(e);"line"!==s&&"line & point"!==s||(t.line.setAttribute("stroke-width",this.helpers.getLineWidth(e)),t.line.setAttribute("stroke-dasharray",this.helpers.getLineStyle(e))),t.fill.setAttribute("fill",i),t.bar.setAttribute("fill",i);for(var n=0;n<this.pointTypes.length;n++)t.points[this.pointTypes[n].name].setAttribute("fill",i)},e.updatePointVisibility=function(e,t,i){for(var s=this.helpers.getPointShape(e),n=0;n<this.pointTypes.length;n++)s!==this.pointTypes[n].name||"line & point"!==i&&"points"!==i?t.points[this.pointTypes[n].name].setAttribute("visibility","hidden"):t.points[this.pointTypes[n].name].setAttribute("visibility","visible")},e.updateVisibility=function(e,t){for(var i=this.helpers.getLineShape(e),s=0;s<this.lineTypes.length;s++)i===this.lineTypes[s].name?t[this.lineTypes[s].name].setAttribute("visibility","visible"):t[this.lineTypes[s].name].setAttribute("visibility","hidden");"line & point"===i&&(t.line.setAttribute("visibility","visible"),t.points.setAttribute("visibility","visible")),this.updatePointVisibility(e,t,i)},e.updateShape=function(e){var t=this.shapes[e];if(null!=t){var i=this.helpers.getPlotColor(e);this.updateLinesAttributes(e,t.shapesGroup,i),this.updateVisibility(e,t.shapesGroup),t.shapesGroup.setAttribute("stroke",i)}}}(),function(){"use strict";var e=NationalInstruments.Globals.jQuery,t=NationalInstruments.HtmlVI.NISupport,i=window.NIColorValueConverters;JQX("ni-cursor-legend",class extends NationalInstruments.HtmlVI.Elements.GraphLegend{created(){super.created(),this.table=void 0,this.selectedRow=null,this.addButton=null,this.deleteButton=null,this.centerButton=null,this.currentRow=null,this.currentBtn=null,this.observer=null,this.helpers=new NationalInstruments.HtmlVI.Elements.CursorLegendHelpers,this.cursorLegendItemDisplay=new NationalInstruments.HtmlVI.Elements.CursorLegendItemDisplay(this.helpers),this.uihelpers=new NationalInstruments.HtmlVI.Elements.LegendHelpers(this.helpers,this.cursorLegendItemDisplay)}cursorAdded(e){var t=this;t.helpers.cursorAdded(e),t.createRow(t.table,e),t.helpers.cursorPositionChanged(e,function(i){t.updatePosition(e,i)})}updatePosition(t,i){if(t._parentGraph){var s=this.helpers.getIndex(t),n=e(this).find(".ni-x-title")[s],a=e(this).find(".ni-y-title")[s],l=t._parentGraph.graph,r=l.formatCursorPosition(l,t.cursor);void 0!==n&&(n.innerText=r.xTextValue),void 0!==a&&(a.innerText=r.yTextValue)}}cursorRemoved(t){var i=this.helpers.getIndex(t);i>=0&&(e(this).find(".ni-master-row").eq(i).remove(),e(this).find(".ni-details-box").eq(i).remove(),this.cursorLegendItemDisplay.clearShape(i),this.helpers.cursorRemoved(t))}cursorChanged(e){this.cursorLegendItemDisplay.updateShape(e),this.updateName(e),this.updateVisible(e),this.updateColor(e),this.updateTargetShape(e),this.updateCrosshairStyle(e)}updateName(t){var i=this.helpers.getIndex(t);e(this).find(".ni-cursor-title").eq(i).text(this.helpers.getState("name",t))}updateVisible(t){var i=this.helpers.getState("visible",t),s=this.helpers.getIndex(t),n=e(this).find(".ni-visibility-button").eq(s);i?n.removeClass("ni-visibility-off-icon").addClass("ni-visibility-on-icon"):n.removeClass("ni-visibility-on-icon").addClass("ni-visibility-off-icon")}updateColor(t){var s=this.helpers.getIndex(t),n=this.helpers.getState("Color",t),a=i.cssRGBAToCssHex(n);e(this).find(".ni-colorbox-selector").eq(s)[0].value=a}updateTargetShape(t){var i=this.helpers.getIndex(t),s=this.helpers.targetShapeOptions,n=0;for(let a in s){if(!0===this.helpers.getState(a,t)){e(this).find(".ni-shape-selector").eq(i)[0].selectedIndexes=[n];break}n++}}updateCrosshairStyle(t){var i=this.helpers.getIndex(t),s=this.helpers.crosshairStyleOptions,n=0;for(let a in s){if(!0===this.helpers.getState(a,t)){e(this).find(".ni-crosshair-selector").eq(i)[0].selectedIndexes=[n];break}n++}}attachToGraph(e){this.detachFromGraph(),e&&e.isReady&&(this.helpers.graph=e,e.registerCursorLegend(this))}detachFromGraph(){this.removeRows(),this.helpers.clearCache(),this.helpers.graph=null}attached(){super.attached();var i=this;i.helpers.graph=i.findGraph(),i.helpers.isInEditMode=i.isInEditMode;var s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.id="div"+t.uniqueId(),i.appendChild(s),i.table=document.createElement("table"),i.table.className="ni-cursors-box",s.appendChild(i.table);var n=document.createElement("div");s.appendChild(n);var a=this.uihelpers.createJQXButton("ni-add-icon ni-command-button",!1);a.disabled=i.isDisabledOrInEditMode(),n.appendChild(a),i.addButton=a,e(a).on("click",function(){i.helpers.addCursor()}),i.addEventListener("ni-cursor-attached",function(e){i.cursorAdded(e.detail.originalSource)}),i.addEventListener("ni-cursor-detached",function(e){i.cursorRemoved(e.detail.originalSource)}),i.addEventListener("ni-cursor-changed",function(e){i.cursorChanged(e.detail.originalSource)});var l=this.findGraph();null!==l&&this.attachToGraph(l)}removeRows(){var e;for(e=this.helpers.cursors.length-1;e>=0;e--){var t=this.helpers.getCursor(e);this.cursorRemoved(t)}}createRow(t,i){var s=this,n=s.createMainRow(t,i),a=s.createDetailsRow(t,i);e(n).on("click",function(){if(s.currentRow!==a){var e=s.currentRow,t=s.currentBtn;a.style.display="table-row",s.currentRow=a,n.classList.remove("ni-closed-icon"),n.classList.add("ni-open-icon"),s.currentBtn=n,null!==e&&(e.style.display="none"),null!==t&&(t.classList.remove("ni-open-icon"),t.classList.add("ni-closed-icon"))}else a.style.display="none",n.classList.remove("ni-open-icon"),n.classList.add("ni-closed-icon"),s.currentRow=null,s.currentBtn=null}),s.applyFont()}createMainRow(t,i){var s,n,a,l,r,o,d,h,c,p,u,m=this;return(s=document.createElement("tr")).className="ni-master-row",t.appendChild(s),(n=document.createElement("td")).className="ni-expand-box",s.appendChild(n),u=this.uihelpers.createJQXButton("ni-expand-button ni-closed-icon",!1),n.appendChild(u),u.width=20,u.height=20,u.disabled=m.isDisabledOrInEditMode(),(a=document.createElement("td")).className="ni-cursor-box",s.appendChild(a),null!==(c=m.cursorLegendItemDisplay.createHeaderDisplay(i))&&a.appendChild(c),(d=document.createElement("span")).className="ni-cursor-title",h=document.createTextNode(m.helpers.getState("name",i)),d.appendChild(h),a.appendChild(d),(l=document.createElement("td")).className="ni-x-box",s.appendChild(l),(d=document.createElement("span")).className="ni-x-title",h=document.createTextNode(parseFloat(m.helpers.getState("x",i))),d.appendChild(h),l.appendChild(d),(r=document.createElement("td")).className="ni-y-box",s.appendChild(r),(d=document.createElement("span")).className="ni-y-title",h=document.createTextNode(parseFloat(m.helpers.getState("y",i))),d.appendChild(h),r.appendChild(d),(o=document.createElement("td")).className="ni-actions-box",s.appendChild(o),p=this.uihelpers.createJQXButton("ni-delete-icon ni-action-button",!1),o.appendChild(p),e(p).on("click",function(){m.helpers.handleClick("delete","",i)}),p.disabled=m.isDisabledOrInEditMode(),p=this.uihelpers.createJQXButton("ni-center-icon ni-action-button",!1),o.appendChild(p),e(p).on("click",function(){m.helpers.handleClick("center","",i)}),p.disabled=m.isDisabledOrInEditMode(),p=this.uihelpers.createJQXButton("ni-snap-icon ni-action-button",!0),o.appendChild(p),e(p).on("click",function(){m.helpers.handleClick("snap","",i)}),p.disabled=m.isDisabledOrInEditMode(),p=this.uihelpers.createJQXButton("ni-visibility-button ni-action-button",!0),m.helpers.getState("visible",i)?p.classList.add("ni-visibility-on-icon"):p.classList.add("ni-visibility-off-icon"),e(p).on("click",function(){m.helpers.handleClick("visible","",i)}),o.appendChild(p),p.disabled=m.isDisabledOrInEditMode(),u}createDetailsItem(e,t){var i,s,n,a,l;return(i=document.createElement("tr")).className="ni-details-row",e.appendChild(i),(s=document.createElement("td")).className="ni-details-row-title-box",i.appendChild(s),(a=document.createElement("span")).class="ni-details-row-title",s.appendChild(a),l=document.createTextNode(t),a.appendChild(l),(n=document.createElement("td")).className="ni-details-row-control-box",i.appendChild(n),n}createDetailsRow(e,t){var i,s,n,a;return(s=document.createElement("tr")).className="ni-details-box",s.style.display="none",e.appendChild(s),(n=document.createElement("td")).colSpan=5,s.appendChild(n),(i=document.createElement("table")).className="ni-details",n.appendChild(i),a=this.createDetailsItem(i,"Color"),this.uihelpers.addColorBox({name:"Color"},a,t,"ni-colorbox-selector ni-selector"),a=this.createDetailsItem(i,"Shape"),this.uihelpers.addComboBox(this.helpers.getMenuItem("shape"),a,t,16,"ni-shape-selector ni-selector"),a=this.createDetailsItem(i,"Crosshair"),this.uihelpers.addComboBox(this.helpers.getMenuItem("crosshair"),a,t,16,"ni-crosshair-selector ni-selector"),s}setFont(t,i,s,n,a){var l=this.firstElementChild,r=e(this),o=e("#"+l.id+" .jqx-widget-content"),d=e("#"+l.id+" .ni-cursor-title"),h=e("#"+l.id+" .ni-x-title"),c=e("#"+l.id+" .ni-y-title"),p=e("#"+l.id+" .ni-details-title");r.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),o.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),d.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),h.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),c.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),p.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n})}applyFont(){var t=this.firstElementChild,i=e("#"+t.id+" .jqx-widget-content"),s=e("#"+t.id+" .ni-cursor-title"),n=e("#"+t.id+" .ni-x-title"),a=e("#"+t.id+" .ni-y-title"),l=e("#"+t.id+" .ni-details-title"),r=e(this).css("font-size"),o=e(this).css("font-family"),d=e(this).css("font-weight"),h=e(this).css("font-style");i.css({"font-size":r,"font-family":o,"font-weight":d,"font-style":h}),s.css({"font-size":r,"font-family":o,"font-weight":d,"font-style":h}),n.css({"font-size":r,"font-family":o,"font-weight":d,"font-style":h}),a.css({"font-size":r,"font-family":o,"font-weight":d,"font-style":h}),l.css({"font-size":r,"font-family":o,"font-weight":d,"font-style":h})}propertyChangedHandler(t,i,s){var n=this;switch(super.propertyChangedHandler(t,i,s),t){case"graphRef":this.helpers.graph.cursorLegend=null;var a=this.findGraph();this.attachToGraph(a);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,null!==this.addButton&&(this.addButton.disabled=this.isDisabledOrInEditMode()),e(this.table).find(".ni-center-icon").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-expand-button").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-snap-icon").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-delete-icon").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-visibility-button").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-colorbox-selector").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-shape-selector").each(function(){this.disabled=n.isDisabledOrInEditMode()}),e(this.table).find(".ni-crosshair-selector").each(function(){this.disabled=n.isDisabledOrInEditMode()})}}})}(),function(){"use strict";NationalInstruments.HtmlVI.Elements.CursorLegendItemDisplay=function(e){this.helpers=e,this.items=[]};var e=NationalInstruments.HtmlVI.Elements.CursorLegendItemDisplay.prototype,t="http://www.w3.org/2000/svg";e.clearShape=function(e){this.items.splice(e,1)},e.createHeaderDisplay=function(e){var i;return void 0===e?null:((i=document.createElementNS(t,"svg")).setAttribute("class","ni-cursor-display"),i.setAttribute("width","16"),i.setAttribute("height","16"),i.setAttribute("viewBox","0,0,16,16"),i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.addShapes(e,i,t),this.items.push(i),i)},e.addShapes=function(e,t,i){this.makeShape(e,t,i),this.makeCursorCross(e,t,i)},e.makeCursorCross=function(e,t,i){switch(e.crosshairStyle){case"none":break;case"vertical":this.makeLine(e,t,i,"8","1","8","4"),this.makeLine(e,t,i,"8","12","8","15");break;case"horizontal":this.makeLine(e,t,i,"12","8","15","8"),this.makeLine(e,t,i,"1","8","4","8");break;default:this.makeLine(e,t,i,"8","1","8","4"),this.makeLine(e,t,i,"12","8","15","8"),this.makeLine(e,t,i,"8","12","8","15"),this.makeLine(e,t,i,"1","8","4","8")}},e.makeShape=function(e,t,i){var s,n,a=e.targetShape,l=window.getComputedStyle(e).color;switch(a){case"ellipse":(n=document.createElementNS(i,"circle")).setAttribute("cx","8"),n.setAttribute("cy","8"),n.setAttribute("r","4"),n.setAttribute("stroke",l),n.setAttribute("stroke-width","1"),n.setAttribute("fill","rgba(0, 0, 0, 0)"),t.appendChild(n);break;case"rectangle":(s=document.createElementNS(i,"rect")).setAttribute("x","4"),s.setAttribute("y","4"),s.setAttribute("width","8"),s.setAttribute("height","8"),s.setAttribute("stroke",l),s.setAttribute("stroke-width","1"),s.setAttribute("fill","rgba(0, 0, 0, 0)"),t.appendChild(s);break;case"diamond":this.makeLine(e,t,i,"8","4","12","8"),this.makeLine(e,t,i,"12","8","8","12"),this.makeLine(e,t,i,"8","12","4","8"),this.makeLine(e,t,i,"4","8","8","4");break;case"cross":this.makeLine(e,t,i,"4","4","12","12"),this.makeLine(e,t,i,"4","12","12","4");break;case"plus":this.makeLine(e,t,i,"8","4","8","12"),this.makeLine(e,t,i,"4","8","12","8")}},e.makeLine=function(e,t,i,s,n,a,l){var r=document.createElementNS(i,"line"),o=window.getComputedStyle(e).color;r.setAttribute("x1",s),r.setAttribute("y1",n),r.setAttribute("x2",a),r.setAttribute("y2",l),r.setAttribute("stroke",o),r.setAttribute("stroke-width",1),t.appendChild(r)},e.updateShape=function(e){var i=this.helpers.getIndex(e),s=this.items[i];if(void 0===e)return null;if(void 0===s)return null;for(;s.firstChild;)s.removeChild(s.firstChild);this.addShapes(e,s,t)}}(),function(){"use strict";var e=NationalInstruments.HtmlVI.NISupport,t=NationalInstruments.Globals.jQuery,i=Object.freeze({Ellipse:"Ellipse",Rectangle:"Rectangle",Diamond:"Diamond",Cross:"Cross",Plus:"Plus"}),s=Object.freeze({None:"No style",Vertical:"Vertical",Horizontal:"Horizontal",Both:"Both"});NationalInstruments.HtmlVI.Elements.CursorLegendHelpers=function(){this.graph=null,this.isInEditMode=!1,this.cursors=[],this.defaultCursorName=e.i18n("msg_defaultcursorname"),this.targetShapeOptions=i,this.crosshairStyleOptions=s};var n=NationalInstruments.HtmlVI.Elements.CursorLegendHelpers,a=n.prototype;a.getMenuItem=function(e){return"shape"===e?{name:"Target Shape",tag:"msg_targetshape",children:[{name:i.Ellipse,tag:"msg_ellipse",cssClass:"ni-ellipse-point-style-icon"},{name:i.Rectangle,tag:"msg_rectangle",cssClass:"ni-rect-point-style-icon"},{name:i.Diamond,tag:"msg_diamond",cssClass:"ni-diamond-point-style-icon"},{name:i.Cross,tag:"msg_cross",cssClass:"ni-cross-point-style-icon"},{name:i.Plus,tag:"msg_plus",cssClass:"ni-plus-point-style-icon"}]}:"crosshair"===e?{name:"Crosshair Style",tag:"msg_crosshairstyle",children:[{name:s.None,tag:"msg_nostyle",cssClass:"ni-no-crosshair-icon"},{name:s.Vertical,tag:"msg_vertical",cssClass:"ni-vertical-crosshair-icon"},{name:s.Horizontal,tag:"msg_horizontal",cssClass:"ni-horizontal-crosshair-icon"},{name:s.Both,tag:"msg_both",cssClass:"ni-both-crosshair-icon"}]}:void 0},a.cursorAdded=function(e){-1===this.getIndex(e)&&this.cursors.push(e)},a.cursorRemoved=function(e){this.cursors.splice(this.getIndex(e),1)},a.addCursor=function(){var e=this.graph,t=document.createElement("ni-cursor");t.show=!0,t.showValue=!0,this.cursors.push(t),t.label=this.nextCursorName(),e.appendChild(t)},a.cursorPositionChanged=function(e,i){if(void 0===e)throw new Error("cursor is undefined");t(e).on("cursorUpdated",function(e,t){i(t)})},a.clearCache=function(){this.cursors.length=0},a.getCursor=function(e){var t,i,s=0,n=null;if(null===this.cursors[e]||void 0===this.cursors[e]){if(null!==(t=this.graph))for(i in t.childNodes)if("ni-cursor"===t.childNodes[i].localName){if(s===e){n=t.childNodes[i];break}s++}null!==n&&(this.cursors[e]=n)}return this.cursors[e]},a.nextCursorName=function(){var e,t,i=0,s=this.graph;if(null!==s)for(n in s.childNodes)"ni-cursor"===s.childNodes[n].localName&&(t=s.childNodes[n],(e=parseInt(t.label.substring(this.defaultCursorName.length)))>i&&(i=e));return this.defaultCursorName+" "+(i+1)},a.deleteCursor=function(e){var t=this.graph;null!=e&&t.removeChild(e)},a.getIndex=function(e){return this.cursors.indexOf(e)},a.handleClick=function(e,t,n){if(null!==n||void 0!==n)switch(e){case"name":case"x":case"y":break;case"visible":n.show=!n.show;break;case"snap":n.snapToPlot=-1!==n.snapToPlot?-1:void 0;break;case"center":n.snapToPlot=void 0,n.x=.5,n.y=.5;break;case"delete":this.deleteCursor(n);break;case i.Ellipse:n.targetShape="ellipse";break;case i.Rectangle:n.targetShape="rectangle";break;case i.Diamond:n.targetShape="diamond";break;case i.Cross:n.targetShape="cross";break;case i.Plus:n.targetShape="plus";break;case s.None:n.crosshairStyle="none";break;case s.Vertical:n.crosshairStyle="vertical";break;case s.Horizontal:n.crosshairStyle="horizontal";break;case s.Both:n.crosshairStyle="both";break;case"Color":n.setColor(t)}},a.getState=function(e,t){if(null!=t){var n;switch(e){case"name":n=t.label;break;case"x":n=t.x;break;case"y":n=t.y;break;case"visible":n=t.show;break;case"snap":n=-1===t.snapToPlot;break;case"center":case"delete":break;case i.Ellipse:n="ellipse"===t.targetShape;break;case i.Rectangle:n="rectangle"===t.targetShape;break;case i.Diamond:n="diamond"===t.targetShape;break;case i.Cross:n="cross"===t.targetShape;break;case i.Plus:n="plus"===t.targetShape;break;case s.None:n="none"===t.crosshairStyle;break;case s.Vertical:n="vertical"===t.crosshairStyle;break;case s.Horizontal:n="horizontal"===t.crosshairStyle;break;case s.Both:n="both"===t.crosshairStyle;break;case"Color":n=window.getComputedStyle(t).color}return n}},a.getTargetShape=function(e){var t=this.getCursor(e);return null!=t?t.targetShape:"ellipse"},a.getCrosshair=function(e){var t=this.getCursor(e);if(null!=t)return t.crosshairStyle}}(),function(){"use strict";var e=NationalInstruments.Globals.jQuery;JQX("ni-scale-legend",class extends NationalInstruments.HtmlVI.Elements.GraphLegend{created(){super.created(),this.tbl=void 0,this.nScales=0,this.currentExpander=null,this.helpers=new NationalInstruments.HtmlVI.Elements.ScaleLegendHelpers,this.uihelpers=new NationalInstruments.HtmlVI.Elements.LegendHelpers(this.helpers,null)}scaleAdded(e){this.helpers.scaleToIndex(e)<this.nScales||(this.createRow(this.tbl,this.nScales),this.helpers.addScale(this.nScales),this.nScales++)}scaleRemoved(e){var t,i,s,n,a=null;for(s=0,i=0;i<this.tbl.childNodes.length;i++){if("tr"===this.tbl.childNodes[i].localName&&(t=this.tbl.childNodes[i]).childNodes[0].innerText===e.label){a=t,n=s;break}s++}null!==a&&(this.tbl.removeChild(a),this.helpers.clearScale(n)),this.nScales--}createRows(){var e;for(e=0;e<this.nScales;e++)this.createRow(this.tbl,e)}removeRows(){var e;for(e=this.nScales-1;e>=0;e--){var t=this.helpers.getScale(e);null!==t&&this.scaleRemoved(t)}}attachToGraph(e){this.detachFromGraph(),e&&e.isReady&&(this.helpers.graph=e,e.registerScaleLegend(this))}detachFromGraph(){this.helpers.graph=null,this.helpers.clearScale(),this.removeRows()}attached(){super.attached();var t=document.createElement("div"),i=this;this.helpers.graph=this.findGraph(),this.helpers.isInEditMode=this.isInEditMode,t.style.width="100%",t.style.height="100%",this.appendChild(t),this.tbl=document.createElement("table"),this.tbl.className="ni-scale-legend-box",t.appendChild(this.tbl),this.addEventListener("ni-cartesian-axis-attached",function(e){var t=e.detail.originalSource;t.initialAutoscale=t.autoScale,i.scaleAdded(t)}),this.addEventListener("ni-cartesian-axis-detached",function(e){i.scaleRemoved(e.detail.originalSource)}),this.addEventListener("ni-axis-changed",function(t){var s=t.detail.originalSource,n=i.helpers.scaleToIndex(s),a=e(this.tbl).find(".ni-row-title"),l=e(this.tbl).find(".ni-lock-button");e(a[n]).first().text(s.label),this.setLockBackground(l[n],!1,n)});var s=this.findGraph();null!==s&&this.attachToGraph(s)}createRow(t,i){var s,n,a,l,r,o,d,h,c=this;s=document.createElement("tr"),t.appendChild(s),(n=document.createElement("td")).className="ni-row-title-box",s.appendChild(n),(r=document.createElement("span")).className="ni-row-title",n.appendChild(r);var p=c.helpers.getState("name",i);o=document.createTextNode(p),r.appendChild(o),(a=document.createElement("td")).className="ni-lock-box",s.appendChild(a),(d=this.uihelpers.createJQXButton("ni-lock-button ni-button",!0)).disabled=!this.helpers.getState("canLock",i)||c.isDisabledOrInEditMode(),e(d).on("click",function(){c.helpers.handleClick("lock",i),c.setLockBackground(d,!1,i)}),c.setLockBackground(d,!0,i),a.appendChild(d),(l=document.createElement("td")).className="ni-reset-offset-box",s.appendChild(l),(h=this.uihelpers.createJQXButton("ni-reset-offset-icon ni-button",!1)).disabled=c.isDisabledOrInEditMode(),e(h).on("click",function(){c.helpers.handleClick("resetOffset",i),c.setLockBackground(d,!1,i)}),l.appendChild(h),this.applyFont()}setLockBackground(e,t,i){var s=this.helpers.getState("lock",i);void 0!==s&&(!0===t&&(e.checked=s),!0===s?(e.classList.remove("ni-locked-icon"),e.classList.add("ni-unlocked-icon")):(e.classList.remove("ni-unlocked-icon"),e.classList.add("ni-locked-icon")))}setFont(t,i,s,n,a){var l=this.firstElementChild,r=e(this),o=e(l).find(" .ni-row-title");r.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n}),o.css({"font-size":t,"font-family":i,"font-weight":s,"font-style":n})}applyFont(){var t=this.firstElementChild,i=e(t).find(" .ni-row-title"),s=e(this).css("font-size"),n=e(this).css("font-family"),a=e(this).css("font-weight"),l=e(this).css("font-style");i.css({"font-size":s,"font-family":n,"font-weight":a,"font-style":l})}updateDisabledState(){let t=this;e(this.tbl).find(".ni-lock-button").each(function(){this.disabled=t.isDisabledOrInEditMode()}),e(this.tbl).find(".ni-reset-offset-icon").each(function(){this.disabled=t.isDisabledOrInEditMode()})}propertyChangedHandler(e,t,i){switch(super.propertyChangedHandler(e,t,i),e){case"graphRef":this.helpers.graph.scaleLegend=null;var s=this.findGraph();this.attachToGraph(s);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,this.updateDisabledState()}}})}(),function(){"use strict";NationalInstruments.HtmlVI.Elements.ScaleLegendHelpers=function(){this.graph=null,this.isInEditMode=!1,this.scales=[]};var e=NationalInstruments.HtmlVI.Elements.ScaleLegendHelpers.prototype;e.addScale=function(){},e.clearScale=function(e){this.scales[e]=null},e.getScale=function(e){var t,i,s=0,n=null;if(null===this.scales[e]||void 0===this.scales[e]){if(null!==(t=this.graph))for(i in t.childNodes)if("ni-cartesian-axis"===t.childNodes[i].localName||"ni-color-scale"===t.childNodes[i].localName){if(s===e){n=t.childNodes[i];break}s++}if(null===n)return null;this.scales[e]=n}return this.scales[e]},e.scaleToIndex=function(e){var t,i,s=0,n=-1;if(null!==(t=this.graph))for(i in t.childNodes)if("ni-cartesian-axis"===t.childNodes[i].localName||"ni-color-scale"===t.childNodes[i].localName){if(t.childNodes[i]===e){n=s;break}s++}return n},e.handleClick=function(e,t){if(!0!==this.isInEditMode){var i=this.getScale(t);if(null===i)return;switch(e){case"lock":"none"!==i.autoScale?(i.initialAutoscale=i.autoScale,i.autoScale="none"):i.autoScale=i.savedAutoScale&&"none"!==i.savedAutoScale?i.savedAutoScale:i.initialAutoscale&&"none"!==i.initialAutoscale?i.initialAutoscale:"loose",i.resetOffset&&i.resetOffset(!0,!0);break;case"resetOffset":i.resetOffset&&i.resetOffset(!1,!0)}}},e.getState=function(e,t){var i=this.getScale(t);if(null!==i){var s;switch(e){case"canLock":s="ni-color-scale"!==i.localName;break;case"lock":s="none"!==i.autoScale;break;case"resetOffset":break;case"name":s=i.label}return s}}}(),function(){"use strict";var e=Object.freeze({LOCKED:"locked",PAN:"pan",ZOOM:"zoom"}),t=NationalInstruments.Globals.jQuery,i=NationalInstruments.HtmlVI.NISupport,s={};s[e.LOCKED]=[!0,!1,!1],s[e.PAN]=[!1,!0,!1],s[e.ZOOM]=[!1,!1,!0];JQX("ni-graph-tools",class extends NationalInstruments.HtmlVI.Elements.GraphLegend{static get properties(){return Object.assign({},super.properties,{mode:{value:e.LOCKED,type:"string"}})}created(){super.created(),this._parentGraph=void 0,this.lockButton=null,this.panButton=null,this.zoomButton=null,this.zoomOutButton=null,this.toggleAutoScaleButton=null,this.snapshotButton=null,this.rangeMismatch=!0,this.uihelpers=new NationalInstruments.HtmlVI.Elements.LegendHelpers(this.helpers,null),this.autoScaleStates={},this._eventHandlers=[]}addTrackedEventHandler(e,t,i){e.addEventListener(t,i),this._eventHandlers.push({element:e,event:t,handler:i})}removeTrackedEventHandler(e,t,i){e.removeEventListener(t,i);var s=this._eventHandlers.findIndex(s=>e===s.element&&t===s.event&&i===s.handler);s>-1&&this._eventHandlers.splice(s,1)}removeTrackedEventHandlers(){this._eventHandlers.forEach(e=>{e.element.removeEventListener(e.event,e.handler)}),this._eventHandlers=[]}ready(){super.ready(),this.addListeners()}attachToGraph(e){e&&e.isReady&&(this._parentGraph=e,e.registerGraphTools(this))}updateCartesianAxesFromFlot(){this._parentGraph.axes.forEach(function(e){e instanceof JQX.CartesianAxis&&e.syncWithFlot()}),this.rangeMismatch=!1}addListeners(){var e=this;this.addTrackedEventHandler(this,"ni-cartesian-graph-box-selected",function(i){var s=i.detail.originalSource.ranges,n=e._parentGraph.graph;t.each(n.getAxes(),function(e,t){!0!==t.options.disableZoom&&s[e]&&function(e,t){var i=e.options,s=t.from-e.min,n=t.to-e.max;i.offset?(i.offset.below=(i.offset.below||0)+s,i.offset.above=(i.offset.above||0)+n):i.offset={above:n,below:s}}(t,s[e])}),n.setupGrid(),n.draw(),n.clearSelection(),this.updateCartesianAxesFromFlot()}),this.addTrackedEventHandler(this,"ni-cartesian-graph-interaction",function(){this.updateCartesianAxesFromFlot()}),this.addTrackedEventHandler(this,"ni-axis-reset",function(){this.rangeMismatch=!0})}allAutoScaleOn(){return this._parentGraph.axes.every(e=>"none"!==e.autoScale)}setAutoScaleButtonActiveState(){this.allAutoScaleOn()?this.toggleAutoScaleButton.classList.add("ni-active-button"):this.toggleAutoScaleButton.classList.remove("ni-active-button")}attached(){var e;super.attached(),(e=document.createElement("div")).id="div"+i.uniqueId(),e.style.width="100%",e.style.height="100%",this.appendChild(e),this.table=document.createElement("table"),this.table.className="ni-graph-tools-box",e.appendChild(this.table),this.createRow(this.table),this.updateDisabledState(),this.addTrackedEventHandler(this,"ni-cartesian-axis-attached",function(e){null!==this.toggleAutoScaleButton&&this.setAutoScaleButtonActiveState()});var t=this.findGraph();null!==t&&t instanceof NationalInstruments.HtmlVI.Elements.CartesianGraphBase&&this.attachToGraph(t)}detached(){super.detached(),this.removeTrackedEventHandlers(),void 0!==this._parentGraph&&(this._parentGraph.graphTools=void 0),this._parentGraph=void 0,this.table=void 0,t(this).empty()}asyncProcessAllImagesForComposition(e){function i(){}var s,n=this._parentGraph.graph.getCanvas(),a=document.createElementNS("http://www.w3.org/2000/svg","svg"),l=this._parentGraph.graph.getSurface().SVGContainer.childNodes[0],r=this._parentGraph.graph.getEventHolder(),o=function(e){const t=e.graph.getPlaceholder();return t&&t.find(".flot-thumbs")[0]?t.find(".flot-thumbs")[0].firstChild:null}(this._parentGraph),d=function(e){const t=["ni-light-plot-legend","ni-chart","ni-cartesian-graph","ni-intensity-graph"];for(var i=null,s="",n=0;n<t.length&&(s=t[n]+'[graph-ref="'+e+'"] svg.legendLayer',null==(i=document.querySelector(s)));n++);return i}(this._parentGraph.graphRef);!function(e,i){var s=t.plot.browser.getPixelRatio(i.getContext("2d")),n=20*s;document.body.insertBefore(e,document.body.childNodes[0]),s<1?(e.setAttributeNS(null,"width",i.width/s+n),e.setAttributeNS(null,"height",i.height/s+n)):(e.setAttributeNS(null,"width",i.width+n),e.setAttributeNS(null,"height",i.height+n)),e.style.width=i.style.width+n,e.style.height=i.style.height+n,e.style.position="absolute";var a=i.getBoundingClientRect().left+window.scrollX-10,l=i.getBoundingClientRect().top+window.scrollY-10;e.style.left=a+"px",e.style.top=l+"px"}(a,n),function(e,t){var i=document.createElementNS(e,"rect");i.setAttributeNS(null,"x",0),i.setAttributeNS(null,"y",0),i.setAttributeNS(null,"style","fill:"+t),i.setAttributeNS(null,"width",e.width.baseVal.value+"px"),i.setAttributeNS(null,"height",e.height.baseVal.value+"px"),e.appendChild(i)}(a,void 0!==e?e:window.getComputedStyle(this._parentGraph).backgroundColor),s=[a,n,l,r,o,d];var h=document.createElement("canvas");return this._parentGraph.takeGraphSnapshot(s,h).then(function(e){return function(t){e.parentNode.removeChild(e)}}(a),i).then(function(){return h},i)}downloadSnapshot(){var e=this;function i(){return function(e){var i=document.createElement("img");i.width=e.width,i.height=e.height,i.src=e.toDataURL("image/png");var s=function(e){var t=URL.createObjectURL(e);i.src=t;var s,n,a,l,r,o,d,h=document.createElement("A");h.download="Snapshot_"+(s=new Date,n=s.getFullYear(),a=s.getMonth()+1,l=s.getDate(),r=s.getHours(),o=s.getMinutes(),d=s.getSeconds(),a<10&&(a="0"+a),l<10&&(l="0"+l),r<10&&(r="0"+r),o<10&&(o="0"+o),d<10&&(d="0"+d),n+"."+a+"."+l+"_"+r+"."+o+"."+d)+".png",h.href=i.src;var c=new MouseEvent("click");h.dispatchEvent(c)};return t.plot.browser.isEdge()?s(e.msToBlob()):e.toBlob(s),e}}function s(){}var n=function(){e.asyncProcessAllImagesForComposition().then(i(),s),e._parentGraph.graph.getEventHolder().removeEventListener("onDrawingDone",n)};e._parentGraph.graph.getEventHolder().addEventListener("onDrawingDone",n),e._parentGraph.updateGraphConfig()}createRow(t){var i,n,a,l,r,o,d,h,c,p,u,m,g,f=this;function b(e,t,i){h.classList.remove("ni-active-button"),c.classList.remove("ni-active-button"),p.classList.remove("ni-active-button"),h.disabled=e,e&&h.classList.add("ni-active-button"),c.disabled=t,t&&c.classList.add("ni-active-button"),p.disabled=i,i&&p.classList.add("ni-active-button")}function v(e){var t=s[e];t&&(b.apply(null,t),f.mode=e)}function y(e){return void 0!==e.jqxId?e.jqxId:e.label}function C(){var e=f._parentGraph;for(var t in e.childNodes){var i=e.childNodes[t];if("ni-cartesian-axis"===i.localName||"ni-color-scale"===i.localName){var s=y(i);void 0!==s&&(f.autoScaleStates[s]=i.autoScale,i.savedAutoScale=i.autoScale,i.autoScale="none")}}}function S(e){var t=y(e);return f.autoScaleStates[t]}function k(){var e=f._parentGraph;for(var t in e.childNodes){var i=e.childNodes[t];if("ni-cartesian-axis"===i.localName||"ni-color-scale"===i.localName){var s=S(i);void 0!==s?i.autoScale="none"!==s?s:"loose":void 0!==i.initialAutoScale&&"none"!==i.initialAutoScale?i.autoScale=i.initialAutoScale:i.autoScale="loose"}}f.autoScaleStates={}}function x(e){f._parentGraph.axes.forEach(function(t){t.resetOffset&&t.resetOffset(e)})}f.addTrackedEventHandler(f,"ni-axis-changed",function(t){var i,s=t.detail.originalSource;"none"!==s.autoScale&&void 0!==S(s)&&(v(e.LOCKED),i=y(s),delete f.autoScaleStates[i]),f.setAutoScaleButtonActiveState()}),i=document.createElement("tr"),t.appendChild(i),(n=document.createElement("td")).className="ni-button-box",i.appendChild(n),h=this.uihelpers.createJQXButton("ni-locked-icon ni-button",!1),this.addTrackedEventHandler(h,"click",function(){v(e.LOCKED)}),n.appendChild(h),f.lockButton=h,(a=document.createElement("td")).className="ni-button-box",i.appendChild(a),c=this.uihelpers.createJQXButton("ni-pan-icon ni-button",!1),this.addTrackedEventHandler(c,"click",function(){k(),C(),x(!0),v(e.PAN)}),a.appendChild(c),f.panButton=c,(l=document.createElement("td")).className="ni-button-box",i.appendChild(l),p=this.uihelpers.createJQXButton("ni-zoom-region-icon ni-button",!1),this.addTrackedEventHandler(p,"click",function(){k(),C(),x(!0),v(e.ZOOM)}),l.appendChild(p),f.zoomButton=p,v(this.mode),(r=document.createElement("td")).className="ni-button-box",i.appendChild(r),(u=this.uihelpers.createJQXButton("ni-zoom-out-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(u,"click",function(){x(!1)}),r.appendChild(u),f.zoomOutButton=u,(o=document.createElement("td")).className="ni-button-box",i.appendChild(o),(m=this.uihelpers.createJQXButton("ni-toggle-autoscale-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(m,"click",function(){f.allAutoScaleOn()?C():(v(e.LOCKED),k()),f.setAutoScaleButtonActiveState(),x(!0)}),o.appendChild(m),f.toggleAutoScaleButton=m,(d=document.createElement("td")).className="ni-button-box",i.appendChild(d),(g=this.uihelpers.createJQXButton("ni-snapshot-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(g,"click",function(){f.downloadSnapshot()}),d.appendChild(g),f.snapshotButton=g}allowsScrollWheelZoom(){return this.mode===e.PAN||this.mode===e.ZOOM}allowsPan(){return this.mode===e.PAN}sendEventToParentGraph(e){var t;void 0!==this._parentGraph&&(t={bubbles:!0,cancelable:!0,detail:{element:this}},this._parentGraph.dispatchEvent(new CustomEvent(e,t)))}updateDisabledState(){null!==this.lockButton&&(this.lockButton.disabled=this.disabled),null!==this.panButton&&(this.panButton.disabled=this.disabled),null!==this.zoomButton&&(this.zoomButton.disabled=this.disabled),null!==this.zoomOutButton&&(this.zoomOutButton.disabled=this.disabled),null!==this.toggleAutoScaleButton&&(this.toggleAutoScaleButton.disabled=this.disabled),null!==this.snapshotButton&&(this.snapshotButton.disabled=this.disabled)}propertyChangedHandler(e,t,i){switch(super.propertyChangedHandler(e,t,i),e){case"graphRef":var s=this.findGraph();null!=s&&this.attachToGraph(s);break;case"mode":this.sendEventToParentGraph("ni-graph-tools-changed");break;case"disabled":this.updateDisabledState()}}})}();
//# sourceMappingURL=webcharts-legends.min.js.map