UNPKG

ni-webcharts-legends

Version:
3 lines 76.1 kB
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(){var e=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"findGraph",value:function(){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+"']")}},{key:"isDisabledOrInEditMode",value:function(){return this.disabled||this.isInEditMode}},{key:"template",value:function(){return""}},{key:"addDefaultClass",value:function(){}}],[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(n),"properties",this),{graphRef:{value:"",type:"string"},isInEditMode:{value:!1,type:"boolean"}})}}]),n}(window.JQX.BaseElement);NationalInstruments.HtmlVI.Elements.GraphLegend=e}(),function(){var p=NationalInstruments.HtmlVI.NISupport;NationalInstruments.HtmlVI.Elements.LegendHelpers=function(e,t){this.helpers=e,this.legendItemDisplay=t};var e=NationalInstruments.HtmlVI.Elements.LegendHelpers.prototype;e.createJQXButton=function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=document.createElement(t?"jqx-toggle-button":"jqx-button");return n.className=e,n.animation="none",n.unfocusable=!0,n},e.addButtons=function(e,n,i){var r,s,a=this;e.children.forEach(function(t){(r=a.createJQXButton("ni-button",!0)).checked=!1,""!==t.cssClass&&r.classList.add(t.cssClass),r.addEventListener("change",function(){var e;s!==this?this.checked&&(e=s,s=this,e.checked=!1,a.helpers.handleClick(t.name,null,i),a.legendItemDisplay.updateShape(i)):this.checked=!0});var e=a.helpers.getState(t.name,i);void 0!==e&&!0===(r.checked=e)&&(s=r),n.appendChild(r)})},e.addComboBox=function(t,e,n,i,r){var s,a,o=this,l=0,c=!0,u=document.createElement("jqx-drop-down-list");for(e.appendChild(u),e.appendChild(u),u.itemHeight=32,u.dropDownHeight="auto",(s=u.classList).add.apply(s,_toConsumableArray(r.split(" "))),a=0;a<t.children.length;a++){var d=p.i18n(t.children[a].tag);"[msg_"===d.substring(0,5)&&(d=t.name);var h='<label class="ni-selector-title">'.concat(d,'</label><icon class="ni-selector-icon ').concat(t.children[a].cssClass,'" style="background-size: ').concat(i,"px 16px; width: ").concat(i+4,'px; "></icon>');u.insert(a,h),!0===this.helpers.getState(t.children[a].name,n)&&(l=a)}u.addEventListener("change",function(e){!0!==c&&(o.helpers.handleClick(t.children[e.detail.index].name,null,n),o.legendItemDisplay.updateShape(n))}),u.selectedIndexes=[l],c=!1},e.addColorBox=function(e,t,n,i){var r,s=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"),(r=a.classList).add.apply(r,_toConsumableArray(i.split(" "))),t.appendChild(a);var o=s.helpers.getState(e.name,n);a.value=o||"",a.addEventListener("change",function(){s.helpers.handleClick(e.name,a.value,n),s.legendItemDisplay.updateShape(n)})},e.addCheckBox=function(t,e,n,i){var r=this,s=document.createElement("jqx-check-box");s.animation="none",s.unfocusable=!0,s.className=i,s.classList.add("legend-checkbox"),s.addEventListener("change",function(e){r.helpers.handleClick(t.name,e.detail.value,n)}),e.appendChild(s);var a=r.helpers.getState(t.name,n);void 0!==a&&(s.checked=a)}}(),function(){var e=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"findGraph",value:function(){return document.querySelector("ni-cartesian-graph[graph-ref='"+this.graphRef+"']")||document.querySelector("ni-chart[graph-ref='"+this.graphRef+"']")}},{key:"propertyChangedHandler",value:function(e,t,n){_get(_getPrototypeOf(r.prototype),"propertyChangedHandler",this).call(this,e,t,n);var i=this.findGraph();switch(e){case"position":case"show":for(;this.hasChildNodes();)this.removeChild(this.firstChild)}i&&i.updateGraphConfig()}},{key:"addDefaultClass",value:function(){}}],[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(r),"properties",this),{show:{value:!1,type:"boolean"},graphRef:{value:"",type:"string"},position:{value:"container",type:"string"}})}}]),r}(window.JQX.BaseElement);JQX("ni-light-plot-legend",e)}();var NILightLegendModule=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"getSettings",value:function(){var e=this.ownerElement.getSettingsWorkaround(),t=this.findLegend(this.ownerElement.graphRef);if(!t)return e;var n,i,r={show:t.show,container:(i=null,"nw"!==(n=t).position&&"ne"!==n.position&&"sw"!==n.position&&"se"!==n.position&&(n.hasChildNodes()?i=n.lastChild:(i=document.createElement("div"),n.appendChild(i))),i),position:t.position,margin:5};return e.legend=r,e}},{key:"findLegend",value:function(e){return document.querySelector("ni-light-plot-legend[graph-ref='"+e+"']")}}],[{key:"moduleName",get:function(){return"NILightLegendModule"}}]),e}();function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=_superPropBase(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(i){var r=_isNativeReflectConstruct();return function(){var e,t,n=_getPrototypeOf(i);return t=r?(e=_getPrototypeOf(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),_possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}JQX.Elements.whenRegistered("ni-cartesian-graph",function(e){e.addModule(NILightLegendModule)}),JQX.Elements.whenRegistered("ni-chart",function(e){e.addModule(NILightLegendModule)}),function(){function r(e){e.createRow(e.expanderWrapper,e.nPlots),e.helpers.addRenderer(e.nPlots),e.nPlots++}function a(e,t){0<e.nPlots&&(e.removeRow(e.expanderWrapper,t),e.helpers.clearRenderer(t),e.nPlots--)}var d=NationalInstruments.HtmlVI.NISupport,c=NationalInstruments.Globals.jQuery,e=function(e){_inherits(s,e);var t=_createSuper(s);function s(){return _classCallCheck(this,s),t.apply(this,arguments)}return _createClass(s,[{key:"created",value:function(){_get(_getPrototypeOf(s.prototype),"created",this).call(this),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}},{key:"plotAdded",value:function(){this.deferLegendUpdates||r(this)}},{key:"plotRemoved",value:function(e){this.deferLegendUpdates||a(this,e)}},{key:"syncPlotLegendWithGraph",value:function(){if(this.deferLegendUpdates){var e=this.findGraph();if(!e)return;for(var t=e.plots.length;t<this.nPlots;){var n=this.nPlots-1;a(this,n)}for(;t>this.nPlots;)r(this)}}},{key:"createRows",value:function(){for(var e=0;e<this.nPlots;e++)this.createRow(this.expanderWrapper,e)}},{key:"removeRows",value:function(){for(var e=this.nPlots-1;0<=e;e--)this.removeRow(this.expanderWrapper,e)}},{key:"throttlePlotUpdates",value:function(e){var t=this.findGraph();null!==t&&(t.throttlePlotUpdates(e),this.deferLegendUpdates=e)}},{key:"attachToGraph",value:function(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))}},{key:"detachFromGraph",value:function(){this.helpers.clearCache(),this.helpers.graph=null,this.removeRows(),this.nPlots=0}},{key:"attached",value:function(){var e,t,i=this;_get(_getPrototypeOf(s.prototype),"attached",this).call(this),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=i.expanderWrapper.querySelectorAll("jqx-accordion-item")[e.detail.index].querySelector(".ni-details-box");i.loadContentIfNeeded(t,e.detail.index)}),this.addEventListener("ni-cartesian-plot-attached",function(){i.plotAdded(),i.helpers.clearCache()}),this.addEventListener("ni-cartesian-plot-detached",function(e){var t=e.detail.originalSource,n=i.helpers.getIndex(t);i.plotRemoved(n),i.helpers.clearCache()}),this.addEventListener("ni-cartesian-plot-changed",function(e){var t=e.detail.originalSource,n=i.helpers.getIndex(t);i.updatePlotName(n,i.helpers.getPlotName(n))}),this.addEventListener("ni-cartesian-plot-renderer-changed",function(e){var t=e.detail.originalSource,n=i.helpers.rendererToIndex(t);i.plotLegendItemDisplay.updateShape(n)}),this.addEventListener("ni-cartesian-plot-renderer-attached",function(e){var t,n=e.detail.originalSource;i.helpers.clearCache(),t=i.helpers.rendererToIndex(n),i.plotLegendItemDisplay.updateShape(t)}),this.addEventListener("ni-cartesian-plot-renderer-detached",function(e){var t,n=e.detail.originalSource;i.helpers.clearCache(),t=i.helpers.rendererToIndex(n),i.plotLegendItemDisplay.updateShape(t)}),this.addEventListener("ni-plot-count-changed",function(e){var t=e.detail.originalSource;if("compact"===i.mode){for(;t.plotCount<i.nPlots;){var n=i.nPlots-1;a(i,n)}for(;t.plotCount>i.nPlots;)r(i)}});var n=this.findGraph();null!==n&&this.attachToGraph(n)}},{key:"createRow",value:function(e,t){var n,i,r,s,a,o,l=document.createElement("jqx-accordion-item");l.animation="none",l.id="expander"+t,l.className="ni-plot-legend-box",e.appendChild(l),(n=document.createElement("div")).id="header"+t,n.className="ni-master-row",l.querySelector(".jqx-label").appendChild(n),(r=document.createElement("div")).className="ni-plot-display",n.appendChild(r),this.plotLegendItemDisplay.createHeaderDisplay(r,t),this.plotLegendItemDisplay.updateShape(t),(o=document.createElement("span")).className="ni-plot-title",s=this.helpers.getPlotName(t),"compact"===this.mode&&(this.helpers.getPlot(t)||(s="Plot "+(t+1))),this.tooltips&&(o.title=s),a=document.createTextNode(s),o.appendChild(a),n.appendChild(o),(i=document.createElement("div")).id="content"+t,i.className="ni-details-box",l.querySelector(".jqx-content-container").appendChild(i),"full"===this.mode&&(l.expanded=!1),this.applyFont()}},{key:"updatePlotName",value:function(e,t){var n=c(this.expanderWrapper).find(".ni-plot-title");c(n[e]).text(t)}},{key:"loadContentIfNeeded",value:function(e,t){if(null===e.querySelector(".ni-details")){var n,i,r,s,a,o=document.createElement("table");for(o.className="ni-details",e.appendChild(o),n=0;n<this.helpers.menu.length;n++){var l,c=this.helpers.menu[n];(l=document.createElement("tr")).className="ni-details-row "+(c.cssClass||""),o.appendChild(l),(s=document.createElement("td")).className="ni-detail-row-title-box",l.appendChild(s),(i=document.createElement("span")).className="ni-detail-row-title",s.appendChild(i);var u=d.i18n(c.tag);switch("[msg_"===u.substring(0,5)&&(u=c.name+"!"),r=document.createTextNode(u),i.appendChild(r),(a=document.createElement("td")).className="ni-details-row-operations-box",l.appendChild(a),c.type){case"buttons":this.uihelpers.addButtons(c,a,t);break;case"combobox":this.uihelpers.addComboBox(c,a,t,24,"ni-selector");break;case"colorbox":this.uihelpers.addColorBox(c,a,t,"ni-colorbox-selector ni-selector");break;case"checkbox":this.uihelpers.addCheckBox(c,a,t,"ni-hover-box")}}}}},{key:"removeRow",value:function(e,t){this.plotLegendItemDisplay.removeHeaderDisplay(null,t),e.removeAt(t)}},{key:"setFont",value:function(e,t,n,i){var r=this.firstElementChild,s=c(this),a=c(r).find(" .jqx-widget-content"),o=c(r).find(" .ni-plot-title"),l=c(r).find(" .ni-detail-row-title");s.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),a.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),o.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),l.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i})}},{key:"applyFont",value:function(){var e=this.firstElementChild,t=c(e).find(" .jqx-widget-content"),n=c(e).find(" .ni-plot-title"),i=c(e).find(" .ni-detail-row-title"),r=c(this).css("font-size"),s=c(this).css("font-family"),a=c(this).css("font-weight"),o=c(this).css("font-style");t.css({"font-size":r,"font-family":s,"font-weight":a,"font-style":o}),n.css({"font-size":r,"font-family":s,"font-weight":a,"font-style":o}),i.css({"font-size":r,"font-family":s,"font-weight":a,"font-style":o})}},{key:"propertyChangedHandler",value:function(e,t,n){_get(_getPrototypeOf(s.prototype),"propertyChangedHandler",this).call(this,e,t,n);var i=this;switch(e){case"graphRef":this.helpers.graph.plotLegend=null;var r=this.findGraph();this.attachToGraph(r);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,c(this.expanderWrapper)[0].disabled=this.isDisabledOrInEditMode(),c(this.expanderWrapper).find(".ni-details-box").each(function(){c(this).find(".ni-button").each(function(){this.disabled=i.isDisabledOrInEditMode()}),c(this).find(".ni-selector").each(function(){this.disabled=i.isDisabledOrInEditMode()}),c(this).find(".ni-colorbox-selector").each(function(){this.disabled=i.isDisabledOrInEditMode()}),c(this).find(".ni-hover-box").each(function(){this.disabled=i.isDisabledOrInEditMode()})});break;case"tooltips":c(this).find(".ni-plot-title").each(function(e,t){t.title=this.tooltips?this.helpers.getPlotName(e):""}.bind(this))}}}],[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(s),"properties",this),{mode:{value:"full",type:"string"},tooltips:{value:!1,type:"boolean"}})}}]),s}(NationalInstruments.HtmlVI.Elements.GraphLegend);JQX("ni-plot-legend",e)}(),function(){var n=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 r=NationalInstruments.HtmlVI.Elements.PlotLegendHelpers,e=r.prototype;e.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:[]}],e.addRenderer=function(){},e.clearRenderer=function(e){this.renderers[e]=null},e.clearCache=function(){for(var e=0;e<this.renderers.length;e++)this.renderers[e]=null},e.getPlot=function(e){var t=0,n=null,i=this.graph;if(null!==i)for(r in i.childNodes)if("ni-cartesian-plot"===i.childNodes[r].localName){if(t===e){n=i.childNodes[r];break}t++}return n},e.getIndex=function(e){var t,n=e._parentGraph;return null!==n&&(t=n.plots.indexOf(e)),t},e.getPlotName=function(e){var t=this.getPlot(e);return t&&"string"==typeof t.label?t.label:n.i18n("msg_defaultplotname")},e.getRenderer=function(e){var t,n=null;if(null===this.renderers[e]||void 0===this.renderers[e]){if(null!==(t=this.getPlot(e))&&(n=t.lastElementChild),null===n)return null;this.renderers[e]=n}return this.renderers[e]},e.rendererToIndex=function(e){var t,n,i=0,r=this.graph;if(null!==r)for(n in r.childNodes)if("ni-cartesian-plot"===r.childNodes[n].localName){if(r.childNodes[n].lastElementChild===e){t=i;break}i++}return t},e.handleClick=function(e,t,n){if(!0!==this.isInEditMode){var i="",r=this.getRenderer(n);if(null===r)return;switch(""!==r.lineStroke&&(i=r.lineStroke),""!==r.pointColor&&(i=r.pointColor),""!==r.barFill&&(i=r.barFill),""!==r.areaFill&&(i=r.areaFill),e){case"No line":r.lineWidth=0;break;case"1-pixel":r.lineWidth=1;break;case"2-pixels":r.lineWidth=2;break;case"3-pixels":r.lineWidth=3;break;case"4-pixels":r.lineWidth=4;break;case"5-pixels":r.lineWidth=5;break;case"Line":r.lineStroke=i,r.pointColor="",r.barFill="",r.areaFill="";break;case"Point":r.lineStroke="",r.pointColor=i,r.barFill="",r.areaFill="";break;case"Line & Point":r.lineStroke=i,r.pointColor=i,r.barFill="",r.areaFill="";break;case"Bar":r.lineStroke="",r.pointColor="",r.barFill=i,r.areaFill="";break;case"Fill":r.lineStroke="",r.pointColor="",r.barFill="",r.areaFill=i;break;case"Ellipse":r.pointShape="ellipse";break;case"Rectangle":r.pointShape="rectangle";break;case"Diamond":r.pointShape="diamond";break;case"Cross":r.pointShape="cross";break;case"Plus":r.pointShape="plus";break;case"No style":r.lineStyle="";break;case"Solid":r.lineStyle="solid";break;case"Dot":r.lineStyle="dot";break;case"Dot-dash":r.lineStyle="dashdot";break;case"Medium dash":r.lineStyle="mediumdash";break;case"Large dash":r.lineStyle="largedash";break;case"Zero":r.areaBaseLine="zero",r.barBaseLine="zero";break;case"-Inf":r.areaBaseLine="negativeinfinity",r.barBaseLine="negativeinfinity";break;case"Inf":r.areaBaseLine="positiveinfinity",r.barBaseLine="positiveinfinity";break;case"Color":""!==r.lineStroke&&(r.lineStroke=t),""!==r.pointColor?r.pointColor=t:""!==r.barFill?r.barFill=t:""!==r.areaFill&&(r.areaFill=t);break;case"Hover":this.getPlot(n).enableHover=t}}},e.getState=function(e,t){var n,i=this.getRenderer(t);if(null!==i){switch(e){case"No line":n=0===i.lineWidth;break;case"1-pixel":n=1===i.lineWidth;break;case"2-pixels":n=2===i.lineWidth;break;case"3-pixels":n=3===i.lineWidth;break;case"4-pixels":n=4===i.lineWidth;break;case"5-pixels":n=5===i.lineWidth;break;case"Line":n=""!==i.lineStroke&&""===i.pointColor;break;case"Point":n=""===i.lineStroke&&""!==i.pointColor;break;case"Line & Point":n=""!==i.lineStroke&&""!==i.pointColor;break;case"Bar":n=""!==i.barFill;break;case"Fill":n=""!==i.areaFill;break;case"Ellipse":n="ellipse"===i.pointShape;break;case"Rectangle":n="rectangle"===i.pointShape;break;case"Diamond":n="diamond"===i.pointShape;break;case"Cross":n="cross"===i.pointShape;break;case"Plus":n="plus"===i.pointShape;break;case"No style":n=""===i.lineStyle;break;case"Solid":n="solid"===i.lineStyle;break;case"Dot":n="dot"===i.lineStyle;break;case"Dot-dash":n="dashdot"===i.lineStyle;break;case"Medium dash":n="mediumdash"===i.lineStyle;break;case"Large dash":n="largedash"===i.lineStyle;break;case"Zero":n=""!==i.barFill?"zero"===i.barBaseLine||""===i.barBaseLine:"zero"===i.areaBaseLine||""===i.areaBaseLine;break;case"-Inf":n=""!==i.barFill?"negativeinfinity"===i.barBaseLine:"negativeinfinity"===i.areaBaseLine;break;case"Inf":n=""!==i.barFill?"positiveinfinity"===i.barBaseLine:"positiveinfinity"===i.areaBaseLine;break;case"Color":n=this.getPlotColorFromRenderer(i);break;case"Hover":n=this.getPlot(t).enableHover}return n}},e.getPlotColor=function(e){var t=this.getRenderer(e);return null!==t?this.getPlotColorFromRenderer(t):this.defaultPlotColors[e%this.defaultPlotColors.length]},e.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},e.getLineWidth=function(e){var t=this.getRenderer(e);return null!==t?t.lineWidth:1},e.getLineShape=function(e){var t="line",n=this.getRenderer(e);return null!==n&&(""!==n.lineStroke&&""===n.pointColor?t="line":""===n.lineStroke&&""!==n.pointColor?t="points":""!==n.lineStroke&&""!==n.pointColor?t="line & point":""!==n.barFill?t="bar":""!==n.areaFill&&(t="fill")),t},e.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"},e.getPointShape=function(e){var t=this.getRenderer(e);return null!==t?t.pointShape:"ellipse"}}(),function(){NationalInstruments.HtmlVI.Elements.PlotLegendItemDisplay=function(e){this.pointTypes=[{name:"ellipse",creator:a},{name:"rectangle",creator:o},{name:"diamond",creator:l},{name:"cross",creator:c},{name:"plus",creator:u}],this.lineTypes=[{name:"line",creator:t},{name:"fill",creator:n},{name:"bar",creator:i},{name:"points",creator:r}],this.shapes=[],this.helpers=e};var e=NationalInstruments.HtmlVI.Elements.PlotLegendItemDisplay.prototype;e.createHeaderDisplay=function(e,t){var n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg");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"),e.appendChild(i);var r=document.createElementNS(n,"g");i.appendChild(r),this.shapes[t]={},this.shapes[t].shapesGroup=r,s(t,r,n,this),r.setAttribute("stroke","rgba(255, 0, 0, 1)")},e.removeHeaderDisplay=function(e,t){this.shapes.splice(t,1)};var s=function(e,t,n,i){for(var r=0;r<i.lineTypes.length;r++)i.lineTypes[r].creator(e,t,n,i)},t=function(e,t,n,i){var r=document.createElementNS(n,"polyline");r.setAttribute("points","0,15 5,5 10,10 15,0"),r.setAttribute("fill","none"),r.setAttribute("stroke-width",i.helpers.getLineWidth(e)),r.setAttribute("stroke-dasharray",i.helpers.getLineStyle(e)),t.appendChild(r),i.shapes[e].shapesGroup.line=r},n=function(e,t,n,i){var r=document.createElementNS(n,"polyline");r.setAttribute("points","0,15 5,5 10,10 15,0, 15,15, 0,15"),r.setAttribute("fill",i.helpers.getPlotColor(e)),r.setAttribute("stroke-width",i.helpers.getLineWidth(e)),r.setAttribute("visibility","hidden"),t.appendChild(r),i.shapes[e].shapesGroup.fill=r},i=function(e,t,n,i){var r=document.createElementNS(n,"polyline");r.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"),r.setAttribute("fill",i.helpers.getPlotColor(e)),r.setAttribute("stroke-width",1),r.setAttribute("visibility","hidden"),t.appendChild(r),i.shapes[e].shapesGroup.bar=r},r=function(e,t,n,i){var r,s,a,o,l=[{x:.5,y:15.5},{x:10.5,y:10.5},{x:5.5,y:5.5},{x:15.5,y:.5}],c=document.createElementNS(n,"g");for(i.shapes[e].shapesGroup.points=c,s=0;s<i.pointTypes.length;s++){for(a=document.createElementNS(n,"g"),r=0;r<4;r++)o=i.pointTypes[s].creator(n,l[r],4),a.appendChild(o);a.setAttribute("fill",i.helpers.getPlotColor(e)),a.setAttribute("stroke-width",1),a.setAttribute("visibility","hidden"),c.appendChild(a),i.shapes[e].shapesGroup.points[i.pointTypes[s].name]=a}t.appendChild(c)},a=function(e,t,n){var i=document.createElementNS(e,"circle");return i.setAttribute("cx",t.x),i.setAttribute("cy",t.y),i.setAttribute("r",n/2),i},o=function(e,t,n){var i=document.createElementNS(e,"rect");return i.setAttribute("x",t.x-n/2),i.setAttribute("y",t.y-n/2),i.setAttribute("width",n),i.setAttribute("height",n),i},l=function(e,t,n){var i=document.createElementNS(e,"path"),r="M"+(t.x-n/2)+","+t.y;return r+=" L"+t.x+","+(t.y-n/2),r+=" L"+(t.x+n/2)+","+t.y,r+=" L"+t.x+","+(t.y+n/2),r+=" Z",i.setAttribute("d",r),i},c=function(e,t,n){var i=document.createElementNS(e,"path"),r="M"+(t.x-n/2)+","+(t.y-n/2);return r+=" L"+(t.x+n/2)+","+(t.y+n/2),r+="M"+(t.x+n/2)+","+(t.y-n/2),r+=" L"+(t.x-n/2)+","+(t.y+n/2),i.setAttribute("d",r),i},u=function(e,t,n){var i=document.createElementNS(e,"path"),r="M"+t.x+","+(t.y-n/2);return r+=" L"+t.x+","+(t.y+n/2),r+="M"+(t.x-n/2)+","+t.y,r+=" L"+(t.x+n/2)+","+t.y,i.setAttribute("d",r),i};e.updateLinesAttributes=function(e,t,n){var i=this.helpers.getLineShape(e);"line"!==i&&"line & point"!==i||(t.line.setAttribute("stroke-width",this.helpers.getLineWidth(e)),t.line.setAttribute("stroke-dasharray",this.helpers.getLineStyle(e))),t.fill.setAttribute("fill",n),t.bar.setAttribute("fill",n);for(var r=0;r<this.pointTypes.length;r++)t.points[this.pointTypes[r].name].setAttribute("fill",n)},e.updatePointVisibility=function(e,t,n){for(var i=this.helpers.getPointShape(e),r=0;r<this.pointTypes.length;r++)i!==this.pointTypes[r].name||"line & point"!==n&&"points"!==n?t.points[this.pointTypes[r].name].setAttribute("visibility","hidden"):t.points[this.pointTypes[r].name].setAttribute("visibility","visible")},e.updateVisibility=function(e,t){for(var n=this.helpers.getLineShape(e),i=0;i<this.lineTypes.length;i++)n===this.lineTypes[i].name?t[this.lineTypes[i].name].setAttribute("visibility","visible"):t[this.lineTypes[i].name].setAttribute("visibility","hidden");"line & point"===n&&(t.line.setAttribute("visibility","visible"),t.points.setAttribute("visibility","visible")),this.updatePointVisibility(e,t,n)},e.updateShape=function(e){var t,n=this.shapes[e];null!=n&&(t=this.helpers.getPlotColor(e),this.updateLinesAttributes(e,n.shapesGroup,t),this.updateVisibility(e,n.shapesGroup),n.shapesGroup.setAttribute("stroke",t))}}(),function(){var f=NationalInstruments.Globals.jQuery,a=NationalInstruments.HtmlVI.NISupport,r=window.NIColorValueConverters,e=function(e){_inherits(s,e);var t=_createSuper(s);function s(){return _classCallCheck(this,s),t.apply(this,arguments)}return _createClass(s,[{key:"created",value:function(){_get(_getPrototypeOf(s.prototype),"created",this).call(this),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)}},{key:"cursorAdded",value:function(t){var n=this;n.helpers.cursorAdded(t),n.createRow(n.table,t),n.helpers.cursorPositionChanged(t,function(e){n.updatePosition(t,e)})}},{key:"updatePosition",value:function(e){var t,n,i,r,s;e._parentGraph&&(t=this.helpers.getIndex(e),n=f(this).find(".ni-x-title")[t],i=f(this).find(".ni-y-title")[t],s=(r=e._parentGraph.graph).formatCursorPosition(r,e.cursor),void 0!==n&&(n.innerText=s.xTextValue),void 0!==i&&(i.innerText=s.yTextValue))}},{key:"cursorRemoved",value:function(e){var t=this.helpers.getIndex(e);0<=t&&(f(this).find(".ni-master-row").eq(t).remove(),f(this).find(".ni-details-box").eq(t).remove(),this.cursorLegendItemDisplay.clearShape(t),this.helpers.cursorRemoved(e))}},{key:"cursorChanged",value:function(e){this.cursorLegendItemDisplay.updateShape(e),this.updateName(e),this.updateVisible(e),this.updateColor(e),this.updateTargetShape(e),this.updateCrosshairStyle(e)}},{key:"updateName",value:function(e){var t=this.helpers.getIndex(e);f(this).find(".ni-cursor-title").eq(t).text(this.helpers.getState("name",e))}},{key:"updateVisible",value:function(e){var t=this.helpers.getState("visible",e),n=this.helpers.getIndex(e),i=f(this).find(".ni-visibility-button").eq(n);t?i.removeClass("ni-visibility-off-icon").addClass("ni-visibility-on-icon"):i.removeClass("ni-visibility-on-icon").addClass("ni-visibility-off-icon")}},{key:"updateColor",value:function(e){var t=this.helpers.getIndex(e),n=this.helpers.getState("Color",e),i=r.cssRGBAToCssHex(n);f(this).find(".ni-colorbox-selector").eq(t)[0].value=i}},{key:"updateTargetShape",value:function(e){var t=this.helpers.getIndex(e),n=this.helpers.targetShapeOptions,i=0;for(var r in n){if(!0===this.helpers.getState(r,e)){f(this).find(".ni-shape-selector").eq(t)[0].selectedIndexes=[i];break}i++}}},{key:"updateCrosshairStyle",value:function(e){var t=this.helpers.getIndex(e),n=this.helpers.crosshairStyleOptions,i=0;for(var r in n){if(!0===this.helpers.getState(r,e)){f(this).find(".ni-crosshair-selector").eq(t)[0].selectedIndexes=[i];break}i++}}},{key:"attachToGraph",value:function(e){this.detachFromGraph(),e&&e.isReady&&(this.helpers.graph=e).registerCursorLegend(this)}},{key:"detachFromGraph",value:function(){this.removeRows(),this.helpers.clearCache(),this.helpers.graph=null}},{key:"attached",value:function(){_get(_getPrototypeOf(s.prototype),"attached",this).call(this);var t=this;t.helpers.graph=t.findGraph(),t.helpers.isInEditMode=t.isInEditMode;var e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.id="div"+a.uniqueId(),t.appendChild(e),t.table=document.createElement("table"),t.table.className="ni-cursors-box",e.appendChild(t.table);var n=document.createElement("div");e.appendChild(n);var i=this.uihelpers.createJQXButton("ni-add-icon ni-command-button",!1);i.disabled=t.isDisabledOrInEditMode(),n.appendChild(i),t.addButton=i,f(i).on("click",function(){t.helpers.addCursor()}),t.addEventListener("ni-cursor-attached",function(e){t.cursorAdded(e.detail.originalSource)}),t.addEventListener("ni-cursor-detached",function(e){t.cursorRemoved(e.detail.originalSource)}),t.addEventListener("ni-cursor-changed",function(e){t.cursorChanged(e.detail.originalSource)});var r=this.findGraph();null!==r&&this.attachToGraph(r)}},{key:"removeRows",value:function(){for(var e=this.helpers.cursors.length-1;0<=e;e--){var t=this.helpers.getCursor(e);this.cursorRemoved(t)}}},{key:"createRow",value:function(e,t){var n=this,i=n.createMainRow(e,t),r=n.createDetailsRow(e,t);f(i).on("click",function(){var e,t;n.currentRow!==r?(e=n.currentRow,t=n.currentBtn,r.style.display="table-row",n.currentRow=r,i.classList.remove("ni-closed-icon"),i.classList.add("ni-open-icon"),n.currentBtn=i,null!==e&&(e.style.display="none"),null!==t&&(t.classList.remove("ni-open-icon"),t.classList.add("ni-closed-icon"))):(r.style.display="none",i.classList.remove("ni-open-icon"),i.classList.add("ni-closed-icon"),n.currentRow=null,n.currentBtn=null)}),n.applyFont()}},{key:"createMainRow",value:function(e,t){var n,i,r,s,a,o,l,c,u,d,h=this,p=document.createElement("tr");return p.className="ni-master-row",e.appendChild(p),(n=document.createElement("td")).className="ni-expand-box",p.appendChild(n),d=this.uihelpers.createJQXButton("ni-expand-button ni-closed-icon",!1),n.appendChild(d),d.width=20,d.height=20,d.disabled=h.isDisabledOrInEditMode(),(i=document.createElement("td")).className="ni-cursor-box",p.appendChild(i),null!==(c=h.cursorLegendItemDisplay.createHeaderDisplay(t))&&i.appendChild(c),(o=document.createElement("span")).className="ni-cursor-title",l=document.createTextNode(h.helpers.getState("name",t)),o.appendChild(l),i.appendChild(o),(r=document.createElement("td")).className="ni-x-box",p.appendChild(r),(o=document.createElement("span")).className="ni-x-title",l=document.createTextNode(parseFloat(h.helpers.getState("x",t))),o.appendChild(l),r.appendChild(o),(s=document.createElement("td")).className="ni-y-box",p.appendChild(s),(o=document.createElement("span")).className="ni-y-title",l=document.createTextNode(parseFloat(h.helpers.getState("y",t))),o.appendChild(l),s.appendChild(o),(a=document.createElement("td")).className="ni-actions-box",p.appendChild(a),u=this.uihelpers.createJQXButton("ni-delete-icon ni-action-button",!1),a.appendChild(u),f(u).on("click",function(){h.helpers.handleClick("delete","",t)}),u.disabled=h.isDisabledOrInEditMode(),u=this.uihelpers.createJQXButton("ni-center-icon ni-action-button",!1),a.appendChild(u),f(u).on("click",function(){h.helpers.handleClick("center","",t)}),u.disabled=h.isDisabledOrInEditMode(),u=this.uihelpers.createJQXButton("ni-snap-icon ni-action-button",!0),a.appendChild(u),f(u).on("click",function(){h.helpers.handleClick("snap","",t)}),u.disabled=h.isDisabledOrInEditMode(),u=this.uihelpers.createJQXButton("ni-visibility-button ni-action-button",!0),h.helpers.getState("visible",t)?u.classList.add("ni-visibility-on-icon"):u.classList.add("ni-visibility-off-icon"),f(u).on("click",function(){h.helpers.handleClick("visible","",t)}),a.appendChild(u),u.disabled=h.isDisabledOrInEditMode(),d}},{key:"createDetailsItem",value:function(e,t){var n,i,r,s,a=document.createElement("tr");return a.className="ni-details-row",e.appendChild(a),(n=document.createElement("td")).className="ni-details-row-title-box",a.appendChild(n),(r=document.createElement("span")).class="ni-details-row-title",n.appendChild(r),s=document.createTextNode(t),r.appendChild(s),(i=document.createElement("td")).className="ni-details-row-control-box",a.appendChild(i),i}},{key:"createDetailsRow",value:function(e,t){var n,i,r,s=document.createElement("tr");return s.className="ni-details-box",s.style.display="none",e.appendChild(s),(i=document.createElement("td")).colSpan=5,s.appendChild(i),(n=document.createElement("table")).className="ni-details",i.appendChild(n),r=this.createDetailsItem(n,"Color"),this.uihelpers.addColorBox({name:"Color"},r,t,"ni-colorbox-selector ni-selector"),r=this.createDetailsItem(n,"Shape"),this.uihelpers.addComboBox(this.helpers.getMenuItem("shape"),r,t,16,"ni-shape-selector ni-selector"),r=this.createDetailsItem(n,"Crosshair"),this.uihelpers.addComboBox(this.helpers.getMenuItem("crosshair"),r,t,16,"ni-crosshair-selector ni-selector"),s}},{key:"setFont",value:function(e,t,n,i){var r=this.firstElementChild,s=f(this),a=f("#"+r.id+" .jqx-widget-content"),o=f("#"+r.id+" .ni-cursor-title"),l=f("#"+r.id+" .ni-x-title"),c=f("#"+r.id+" .ni-y-title"),u=f("#"+r.id+" .ni-details-title");s.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),a.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),o.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),l.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),c.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),u.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i})}},{key:"applyFont",value:function(){var e=this.firstElementChild,t=f("#"+e.id+" .jqx-widget-content"),n=f("#"+e.id+" .ni-cursor-title"),i=f("#"+e.id+" .ni-x-title"),r=f("#"+e.id+" .ni-y-title"),s=f("#"+e.id+" .ni-details-title"),a=f(this).css("font-size"),o=f(this).css("font-family"),l=f(this).css("font-weight"),c=f(this).css("font-style");t.css({"font-size":a,"font-family":o,"font-weight":l,"font-style":c}),n.css({"font-size":a,"font-family":o,"font-weight":l,"font-style":c}),i.css({"font-size":a,"font-family":o,"font-weight":l,"font-style":c}),r.css({"font-size":a,"font-family":o,"font-weight":l,"font-style":c}),s.css({"font-size":a,"font-family":o,"font-weight":l,"font-style":c})}},{key:"propertyChangedHandler",value:function(e,t,n){var i=this;switch(_get(_getPrototypeOf(s.prototype),"propertyChangedHandler",this).call(this,e,t,n),e){case"graphRef":this.helpers.graph.cursorLegend=null;var r=this.findGraph();this.attachToGraph(r);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,null!==this.addButton&&(this.addButton.disabled=this.isDisabledOrInEditMode()),f(this.table).find(".ni-center-icon").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-expand-button").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-snap-icon").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-delete-icon").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-visibility-button").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-colorbox-selector").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-shape-selector").each(function(){this.disabled=i.isDisabledOrInEditMode()}),f(this.table).find(".ni-crosshair-selector").each(function(){this.disabled=i.isDisabledOrInEditMode()})}}}]),s}(NationalInstruments.HtmlVI.Elements.GraphLegend);JQX("ni-cursor-legend",e)}(),function(){NationalInstruments.HtmlVI.Elements.CursorLegendItemDisplay=function(e){this.helpers=e,this.items=[]};var e=NationalInstruments.HtmlVI.Elements.CursorLegendItemDisplay.prototype,i="http://www.w3.org/2000/svg";e.clearShape=function(e){this.items.splice(e,1)},e.createHeaderDisplay=function(e){var t;return void 0===e?null:((t=document.createElementNS(i,"svg")).setAttribute("class","ni-cursor-display"),t.setAttribute("width","16"),t.setAttribute("height","16"),t.setAttribute("viewBox","0,0,16,16"),t.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.addShapes(e,t,i),this.items.push(t),t)},e.addShapes=function(e,t,n){this.makeShape(e,t,n),this.makeCursorCross(e,t,n)},e.makeCursorCross=function(e,t,n){switch(e.crosshairStyle){case"none":break;case"vertical":this.makeLine(e,t,n,"8","1","8","4"),this.makeLine(e,t,n,"8","12","8","15");break;case"horizontal":this.makeLine(e,t,n,"12","8","15","8"),this.makeLine(e,t,n,"1","8","4","8");break;default:this.makeLine(e,t,n,"8","1","8","4"),this.makeLine(e,t,n,"12","8","15","8"),this.makeLine(e,t,n,"8","12","8","15"),this.makeLine(e,t,n,"1","8","4","8")}},e.makeShape=function(e,t,n){var i,r,s=e.targetShape,a=window.getComputedStyle(e).color;switch(s){case"ellipse":(r=document.createElementNS(n,"circle")).setAttribute("cx","8"),r.setAttribute("cy","8"),r.setAttribute("r","4"),r.setAttribute("stroke",a),r.setAttribute("stroke-width","1"),r.setAttribute("fill","rgba(0, 0, 0, 0)"),t.appendChild(r);break;case"rectangle":(i=document.createElementNS(n,"rect")).setAttribute("x","4"),i.setAttribute("y","4"),i.setAttribute("width","8"),i.setAttribute("height","8"),i.setAttribute("stroke",a),i.setAttribute("stroke-width","1"),i.setAttribute("fill","rgba(0, 0, 0, 0)"),t.appendChild(i);break;case"diamond":this.makeLine(e,t,n,"8","4","12","8"),this.makeLine(e,t,n,"12","8","8","12"),this.makeLine(e,t,n,"8","12","4","8"),this.makeLine(e,t,n,"4","8","8","4");break;case"cross":this.makeLine(e,t,n,"4","4","12","12"),this.makeLine(e,t,n,"4","12","12","4");break;case"plus":this.makeLine(e,t,n,"8","4","8","12"),this.makeLine(e,t,n,"4","8","12","8")}},e.makeLine=function(e,t,n,i,r,s,a){var o=document.createElementNS(n,"line"),l=window.getComputedStyle(e).color;o.setAttribute("x1",i),o.setAttribute("y1",r),o.setAttribute("x2",s),o.setAttribute("y2",a),o.setAttribute("stroke",l),o.setAttribute("stroke-width",1),t.appendChild(o)},e.updateShape=function(e){var t=this.helpers.getIndex(e),n=this.items[t];if(void 0===e)return null;if(void 0===n)return null;for(;n.firstChild;)n.removeChild(n.firstChild);this.addShapes(e,n,i)}}(),function(){var e=NationalInstruments.HtmlVI.NISupport,t=NationalInstruments.Globals.jQuery,i=Object.freeze({Ellipse:"Ellipse",Rectangle:"Rectangle",Diamond:"Diamond",Cross:"Cross",Plus:"Plus"}),r=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=r};var s=NationalInstruments.HtmlVI.Elements.CursorLegendHelpers,n=s.prototype;n.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:r.None,tag:"msg_nostyle",cssClass:"ni-no-crosshair-icon"},{name:r.Vertical,tag:"msg_vertical",cssClass:"ni-vertical-crosshair-icon"},{name:r.Horizontal,tag:"msg_horizontal",cssClass:"ni-horizontal-crosshair-icon"},{name:r.Both,tag:"msg_both",cssClass:"ni-both-crosshair-icon"}]}:void 0},n.cursorAdded=function(e){-1===this.getIndex(e)&&this.cursors.push(e)},n.cursorRemoved=function(e){this.cursors.splice(this.getIndex(e),1)},n.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)},n.cursorPositionChanged=function(e,n){if(void 0===e)throw new Error("cursor is undefined");t(e).on("cursorUpdated",function(e,t){n(t)})},n.clearCache=function(){this.cursors.length=0},n.getCursor=function(e){var t,n,i=0,r=null;if(null===this.cursors[e]||void 0===this.cursors[e]){if(null!==(t=this.graph))for(n in t.childNodes)if("ni-cursor"===t.childNodes[n].localName){if(i===e){r=t.childNodes[n];break}i++}null!==r&&(this.cursors[e]=r)}return this.cursors[e]},n.nextCursorName=function(){var e,t,n=0,i=this.graph;if(null!==i)for(s in i.childNodes)"ni-cursor"===i.childNodes[s].localName&&(t=i.childNodes[s],n<(e=parseInt(t.label.substring(this.defaultCursorName.length)))&&(n=e));return this.defaultCursorName+" "+(n+1)},n.deleteCursor=function(e){var t=this.graph;null!=e&&t.removeChild(e)},n.getIndex=function(e){return this.cursors.indexOf(e)},n.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 r.None:n.crosshairStyle="none";break;case r.Vertical:n.crosshairStyle="vertical";break;case r.Horizontal:n.crosshairStyle="horizontal";break;case r.Both:n.crosshairStyle="both";break;case"Color":n.setColor(t)}},n.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 r.None:n="none"===t.crosshairStyle;break;case r.Vertical:n="vertical"===t.crosshairStyle;break;case r.Horizontal:n="horizontal"===t.crosshairStyle;break;case r.Both:n="both"===t.crosshairStyle;break;case"Color":n=window.getComputedStyle(t).color}return n}},n.getTargetShape=function(e){var t=this.getCursor(e);return null!=t?t.targetShape:"ellipse"},n.getCrosshair=function(e){var t=this.getCursor(e);if(null!=t)return t.crosshairStyle}}(),function(){var h=NationalInstruments.Globals.jQuery,e=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"created",value:function(){_get(_getPrototypeOf(r.prototype),"created",this).call(this),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)}},{key:"scaleAdded",value:function(e){this.helpers.scaleToIndex(e)<this.nScales||(this.createRow(this.tbl,this.nScales),this.helpers.addScale(this.nScales),this.nScales++)}},{key:"scaleRemoved",value:function(e){for(var t,n,i=null,r=0,s=0;s<this.tbl.childNodes.length;s++){if("tr"===this.tbl.childNodes[s].localName&&(t=this.tbl.childNodes[s]).childNodes[0].innerText===e.label){i=t,n=r;break}r++}null!==i&&(this.tbl.removeChild(i),this.helpers.clearScale(n)),this.nScales--}},{key:"createRows",value:function(){for(var e=0;e<this.nScales;e++)this.createRow(this.tbl,e)}},{key:"removeRows",value:function(){for(var e=this.nScales-1;0<=e;e--){var t=this.helpers.getScale(e);null!==t&&this.scaleRemoved(t)}}},{key:"attachToGraph",value:function(e){this.detachFromGraph(),e&&e.isReady&&(this.helpers.graph=e).registerScaleLegend(this)}},{key:"detachFromGraph",value:function(){this.helpers.graph=null,this.helpers.clearScale(),this.removeRows()}},{key:"attached",value:function(){_get(_getPrototypeOf(r.prototype),"attached",this).call(this);var e=document.createElement("div"),s=this;this.helpers.graph=this.findGraph(),this.helpers.isInEditMode=this.isInEditMode,e.style.width="100%",e.style.height="100%",this.appendChild(e),this.tbl=document.createElement("table"),this.tbl.className="ni-scale-legend-box",e.appendChild(this.tbl),this.addEventListener("ni-cartesian-axis-attached",function(e){var t=e.detail.originalSource;t.initialAutoscale=t.autoScale,s.scaleAdded(t)}),this.addEventListener("ni-cartesian-axis-detached",function(e){s.scaleRemoved(e.detail.originalSource)}),this.addEventListener("ni-axis-changed",function(e){var t=e.detail.originalSource,n=s.helpers.scaleToIndex(t),i=h(this.tbl).find(".ni-row-title"),r=h(this.tbl).find(".ni-lock-button");h(i[n]).first().text(t.label),this.setLockBackground(r[n],!1,n)});var t=this.findGraph();null!==t&&this.attachToGraph(t)}},{key:"createRow",value:function(e,t){var n,i,r,s,a,o,l=this,c=document.createElement("tr");e.appendChild(c),(n=document.createElement("td")).className="ni-row-title-box",c.appendChild(n),(s=document.createElement("span")).className="ni-row-title",n.appendChild(s);var u=l.helpers.getState("name",t),d=document.createTextNode(u);s.appendChild(d),(i=document.createElement("td")).className="ni-lock-box",c.appendChild(i),(a=this.uihelpers.createJQXButton("ni-lock-button ni-button",!0)).disabled=!this.helpers.getState("canLock",t)||l.isDisabledOrInEditMode(),h(a).on("click",function(){l.helpers.handleClick("lock",t),l.setLockBackground(a,!1,t)}),l.setLockBackground(a,!0,t),i.appendChild(a),(r=document.createElement("td")).className="ni-reset-offset-box",c.appendChild(r),(o=this.uihelpers.createJQXButton("ni-reset-offset-icon ni-button",!1)).disabled=l.isDisabledOrInEditMode(),h(o).on("click",function(){l.helpers.handleClick("resetOffset",t),l.setLockBackground(a,!1,t)}),r.appendChild(o),this.applyFont()}},{key:"setLockBackground",value:function(e,t,n){var i=this.helpers.getState("lock",n);void 0!==i&&(!0===t&&(e.checked=i),!0===i?(e.classList.remove("ni-locked-icon"),e.classList.add("ni-unlocked-icon")):(e.classList.remove("ni-unlocked-icon"),e.classList.add("ni-locked-icon")))}},{key:"setFont",value:function(e,t,n,i){var r=this.firstElementChild,s=h(this),a=h(r).find(" .ni-row-title");s.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i}),a.css({"font-size":e,"font-family":t,"font-weight":n,"font-style":i})}},{key:"applyFont",value:function(){var e=this.firstElementChild,t=h(e).find(" .ni-row-title"),n=h(this).css("font-size"),i=h(this).css("font-family"),r=h(this).css("font-weight"),s=h(this).css("font-style");t.css({"font-size":n,"font-family":i,"font-weight":r,"font-style":s})}},{key:"updateDisabledState",value:function(){var e=this;h(this.tbl).find(".ni-lock-button").each(function(){this.disabled=e.isDisabledOrInEditMode()}),h(this.tbl).find(".ni-reset-offset-icon").each(function(){this.disabled=e.isDisabledOrInEditMode()})}},{key:"propertyChangedHandler",value:function(e,t,n){switch(_get(_getPrototypeOf(r.prototype),"propertyChangedHandler",this).call(this,e,t,n),e){case"graphRef":this.helpers.graph.scaleLegend=null;var i=this.findGraph();this.attachToGraph(i);break;case"disabled":case"isInEditMode":this.helpers.isInEditMode=this.isInEditMode,this.updateDisabledState()}}}]),r}(NationalInstruments.HtmlVI.Elements.GraphLegend);JQX("ni-scale-legend",e)}(),function(){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,n,i=0,r=null;if(null===this.scales[e]||void 0===this.scales[e]){if(null!==(t=this.graph))for(n in t.childNodes)if("ni-cartesian-axis"===t.childNodes[n].localName||"ni-color-scale"===t.childNodes[n].localName){if(i===e){r=t.childNodes[n];break}i++}if(null===r)return null;this.scales[e]=r}return this.scales[e]},e.scaleToIndex=function(e){var t,n=0,i=-1,r=this.graph;if(null!==r)for(t in r.childNodes)if("ni-cartesian-axis"===r.childNodes[t].localName||"ni-color-scale"===r.childNodes[t].localName){if(r.childNodes[t]===e){i=n;break}n++}return i},e.handleClick=function(e,t){if(!0!==this.isInEditMode){var n=this.getScale(t);if(null===n)return;switch(e){case"lock":"none"!==n.autoScale?(n.initialAutoscale=n.autoScale,n.autoScale="none"):n.autoScale=n.savedAutoScale&&"none"!==n.savedAutoScale?n.savedAutoScale:n.initialAutoscale&&"none"!==n.initialAutoscale?n.initialAutoscale:"loose",n.resetOffset&&n.resetOffset(!0,!0);break;case"resetOffset":n.resetOffset&&n.resetOffset(!1,!0)}}},e.getState=function(e,t){var n,i=this.getScale(t);if(null!==i){switch(e){case"canLock":n="ni-color-scale"!==i.localName;break;case"lock":n="none"!==i.autoScale;break;case"resetOffset":break;case"name":n=i.label}return n}}}(),function(){var k=Object.freeze({LOCKED:"locked",PAN:"pan",ZOOM:"zoom"}),b=NationalInstruments.Globals.jQuery,n=NationalInstruments.HtmlVI.NISupport,S={};S[k.LOCKED]=[!0,!1,!1],S[k.PAN]=[!1,!0,!1],S[k.ZOOM]=[!1,!1,!0];var e=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"created",value:function(){_get(_getPrototypeOf(r.prototype),"created",this).call(this),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=[]}},{key:"addTrackedEventHandler",value:function(e,t,n){e.addEventListener(t,n),this._eventHandlers.push({element:e,event:t,handler:n})}},{key:"removeTrackedEventHandler",value:function(t,n,i){t.removeEventListener(n,i);var e=this._eventHandlers.findIndex(function(e){return t===e.element&&n===e.event&&i===e.handler});-1<e&&this._eventHandlers.splice(e,1)}},{key:"removeTrackedEventHandlers",value:function(){this._eventHandlers.forEach(function(e){e.element.removeEventListener(e.event,e.handler)}),this._eventHandlers=[]}},{key:"ready",value:function(){_get(_getPrototypeOf(r.prototype),"ready",this).call(this),this.addListeners()}},{key:"attachToGraph",value:function(e){e&&e.isReady&&(this._parentGraph=e).registerGraphTools(this)}},{key:"updateCartesianAxesFromFlot",value:function(){this._parentGraph.axes.forEach(function(e){e instanceof JQX.CartesianAxis&&e.syncWithFlot()}),this.rangeMismatch=!1}},{key:"addListeners",value:function(){var n=this;this.addTrackedEventHandler(this,"ni-cartesian-graph-box-selected",function(e){var o=e.detail.originalSource.ranges,t=n._parentGraph.graph;b.each(t.getAxes(),function(e,t){var n,i,r,s,a;!0!==t.options.disableZoom&&o[e]&&(n=t,i=o[e],r=n.options,s=i.from-n.min,a=i.to-n.max,r.offset?(r.offset.below=(r.offset.below||0)+s,r.offset.above=(r.offset.above||0)+a):r.offset={above:a,below:s})}),t.setupGrid(),t.draw(),t.clearSelection(),this.updateCartesianAxesFromFlot()}),this.addTrackedEventHandler(this,"ni-cartesian-graph-interaction",function(){this.updateCartesianAxesFromFlot()}),this.addTrackedEventHandler(this,"ni-axis-reset",function(){this.rangeMismatch=!0})}},{key:"allAutoScaleOn",value:function(){return this._parentGraph.axes.every(function(e){return"none"!==e.autoScale})}},{key:"setAutoScaleButtonActiveState",value:function(){this.allAutoScaleOn()?this.toggleAutoScaleButton.classList.add("ni-active-button"):this.toggleAutoScaleButton.classList.remove("ni-active-button")}},{key:"attached",value:function(){var e;_get(_getPrototypeOf(r.prototype),"attached",this).call(this),(e=document.createElement("div")).id="div"+n.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)}},{key:"detached",value:function(){_get(_getPrototypeOf(r.prototype),"detached",this).call(this),this.removeTrackedEventHandlers(),void 0!==this._parentGraph&&(this._parentGraph.graphTools=void 0),this._parentGraph=void 0,this.table=void 0,b(this).empty()}},{key:"asyncProcessAllImagesForComposition",value:function(e){var t=this;function n(){}var i,r,s,a,o,l,c,u=t._parentGraph.graph.getCanvas(),d=document.createElementNS("http://www.w3.org/2000/svg","svg"),h=t._parentGraph.graph.getSurface().SVGContainer.childNodes[0],p=t._parentGraph.graph.getEventHolder(),f=(s=t._parentGraph,(a=s.graph.getPlaceholder())&&a.find(".flot-thumbs")[0]?a.find(".flot-thumbs")[0].firstChild:null),m=function(e){for(var t,n=["ni-light-plot-legend","ni-chart","ni-cartesian-graph","ni-intensity-graph"],i=null,r=0;r<n.length&&(t=n[r]+'[graph-ref="'+e+'"] svg.legendLayer',null==(i=document.querySelector(t)));r++);return i}(t._parentGraph.graphRef);!function(e,t){var n=b.plot.browser.getPixelRatio(t.getContext("2d")),i=20*n;document.body.insertBefore(e,document.body.childNodes[0]),n<1?(e.setAttributeNS(null,"width",t.width/n+i),e.setAttributeNS(null,"height",t.height/n+i)):(e.setAttributeNS(null,"width",t.width+i),e.setAttributeNS(null,"height",t.height+i)),e.style.width=t.style.width+i,e.style.height=t.style.height+i,e.style.position="absolute";var r=t.getBoundingClientRect().left+window.scrollX-10,s=t.getBoundingClientRect().top+window.scrollY-10;e.style.left=r+"px",e.style.top=s+"px"}(d,u),r=void 0!==e?e:window.getComputedStyle(t._parentGraph).backgroundColor,o=d,l=r,(c=document.createElementNS(o,"rect")).setAttributeNS(null,"x",0),c.setAttributeNS(null,"y",0),c.setAttributeNS(null,"style","fill:"+l),c.setAttributeNS(null,"width",o.width.baseVal.value+"px"),c.setAttributeNS(null,"height",o.height.baseVal.value+"px"),o.appendChild(c),i=[d,u,h,p,f,m];var y,g=document.createElement("canvas");return t._parentGraph.takeGraphSnapshot(i,g).then((y=d,function(){y.parentNode.removeChild(y)}),n).then(function(){return g},n)}},{key:"downloadSnapshot",value:function(){var t=this;function n(){return function(e){var r=document.createElement("img");r.width=e.width,r.height=e.height,r.src=e.toDataURL("image/png");function t(e){var t=URL.createObjectURL(e);r.src=t;var n=document.createElement("A");n.download="Snapshot_"+function(){var e=new Date,t=e.getFullYear(),n=e.getMonth()+1,i=e.getDate(),r=e.getHours(),s=e.getMinutes(),a=e.getSeconds();n<10&&(n="0"+n);i<10&&(i="0"+i);r<10&&(r="0"+r);s<10&&(s="0"+s);a<10&&(a="0"+a);return t+"."+n+"."+i+"_"+r+"."+s+"."+a}()+".png",n.href=r.src;var i=new MouseEvent("click");n.dispatchEvent(i)}return b.plot.browser.isEdge()?t(e.msToBlob()):e.toBlob(t),e}}function i(){}t._parentGraph.graph.getEventHolder().addEventListener("onDrawingDone",function e(){t.asyncProcessAllImagesForComposition().then(n(),i),t._parentGraph.graph.getEventHolder().removeEventListener("onDrawingDone",e)}),t._parentGraph.updateGraphConfig()}},{key:"createRow",value:function(e){var t,n,i,r,s,a,o,l,c,u,d,h,p,f=this;function m(e,t,n){l.classList.remove("ni-active-button"),c.classList.remove("ni-active-button"),u.classList.remove("ni-active-button"),(l.disabled=e)&&l.classList.add("ni-active-button"),(c.disabled=t)&&c.classList.add("ni-active-button"),(u.disabled=n)&&u.classList.add("ni-active-button")}function y(e){var t=S[e];t&&(m.apply(null,t),f.mode=e)}function g(e){return void 0!==e.jqxId?e.jqxId:e.label}function b(){var e=f._parentGraph;for(var t in e.childNodes){var n,i=e.childNodes[t];"ni-cartesian-axis"!==i.localName&&"ni-color-scale"!==i.localName||void 0!==(n=g(i))&&(f.autoScaleStates[n]=i.autoScale,i.savedAutoScale=i.autoScale,i.autoScale="none")}}function v(e){var t=g(e);return f.autoScaleStates[t]}function C(){var e=f._parentGraph;for(var t in e.childNodes){var n,i=e.childNodes[t];"ni-cartesian-axis"!==i.localName&&"ni-color-scale"!==i.localName||(void 0!==(n=v(i))?i.autoScale="none"!==n?n:"loose":void 0!==i.initialAutoScale&&"none"!==i.initialAutoScale?i.autoScale=i.initialAutoScale:i.autoScale="loose")}f.autoScaleStates={}}function _(t){f._parentGraph.axes.forEach(function(e){e.resetOffset&&e.resetOffset(t)})}f.addTrackedEventHandler(f,"ni-axis-changed",function(e){var t,n=e.detail.originalSource;"none"!==n.autoScale&&void 0!==v(n)&&(y(k.LOCKED),t=g(n),delete f.autoScaleStates[t]),f.setAutoScaleButtonActiveState()}),t=document.createElement("tr"),e.appendChild(t),(n=document.createElement("td")).className="ni-button-box",t.appendChild(n),l=this.uihelpers.createJQXButton("ni-locked-icon ni-button",!1),this.addTrackedEventHandler(l,"click",function(){y(k.LOCKED)}),n.appendChild(l),f.lockButton=l,(i=document.createElement("td")).className="ni-button-box",t.appendChild(i),c=this.uihelpers.createJQXButton("ni-pan-icon ni-button",!1),this.addTrackedEventHandler(c,"click",function(){C(),b(),_(!0),y(k.PAN)}),i.appendChild(c),f.panButton=c,(r=document.createElement("td")).className="ni-button-box",t.appendChild(r),u=this.uihelpers.createJQXButton("ni-zoom-region-icon ni-button",!1),this.addTrackedEventHandler(u,"click",function(){C(),b(),_(!0),y(k.ZOOM)}),r.appendChild(u),f.zoomButton=u,y(this.mode),(s=document.createElement("td")).className="ni-button-box",t.appendChild(s),(d=this.uihelpers.createJQXButton("ni-zoom-out-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(d,"click",function(){_(!1)}),s.appendChild(d),f.zoomOutButton=d,(a=document.createElement("td")).className="ni-button-box",t.appendChild(a),(h=this.uihelpers.createJQXButton("ni-toggle-autoscale-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(h,"click",function(){f.allAutoScaleOn()?b():(y(k.LOCKED),C()),f.setAutoScaleButtonActiveState(),_(!0)}),a.appendChild(h),f.toggleAutoScaleButton=h,(o=document.createElement("td")).className="ni-button-box",t.appendChild(o),(p=this.uihelpers.createJQXButton("ni-snapshot-icon ni-button",!1)).disabled=!1,this.addTrackedEventHandler(p,"click",function(){f.downloadSnapshot()}),o.appendChild(p),f.snapshotButton=p}},{key:"allowsScrollWheelZoom",value:function(){return this.mode===k.PAN||this.mode===k.ZOOM}},{key:"allowsPan",value:function(){return this.mode===k.PAN}},{key:"sendEventToParentGraph",value:function(e){var t;void 0!==this._parentGraph&&(t={bubbles:!0,cancelable:!0,detail:{element:this}},this._parentGraph.dispatchEvent(new CustomEvent(e,t)))}},{key:"updateDisabledState",value:function(){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)}},{key:"propertyChangedHandler",value:function(e,t,n){switch(_get(_getPrototypeOf(r.prototype),"propertyChangedHandler",this).call(this,e,t,n),e){case"graphRef":var i=this.findGraph();null!=i&&this.attachToGraph(i);break;case"mode":this.sendEventToParentGraph("ni-graph-tools-changed");break;case"disabled":this.updateDisabledState()}}}],[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(r),"properties",this),{mode:{value:k.LOCKED,type:"string"}})}}]),r}(NationalInstruments.HtmlVI.Elements.GraphLegend);JQX("ni-graph-tools",e)}();
//# sourceMappingURL=webcharts-legends.min.js.map