Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ni-webcharts

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ni-webcharts - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

dist/webcharts.min.js
!function(){"use strict";NationalInstruments.HtmlVI.DataPipeline={}}();
!function(){"use strict";NationalInstruments.HtmlVI.DataPipeline.GraphDataPipeline=function(){};var r=Object.freeze({niAnalogWaveform:"niAnalogWaveform",niAnalogWaveformArray:"niAnalogWaveformArray",XYClusterOfArrays:"XYClusterOfArrays",XYArrayOfClusters:"XYArrayOfClusters",XYArrayOfClusterOfArrays:"XYArrayOfClusterOfArrays",XYArrayOfArrayOfClusters:"XYArrayOfArrayOfClusters",oneDimensionNumericArray:"1DNumericArray",twoDimensionsNumericArray:"2DNumericArray",oneDimensionComplexArray:"1DComplexArray",twoDimensionsComplexArray:"2DComplexArray",empty:"empty",unknown:"unknown"}),e=NationalInstruments.HtmlVI.DataPipeline.GraphDataPipeline,n=NationalInstruments.HtmlVI.NIComplex,t=NationalInstruments.HtmlVI.NIAnalogWaveform,a=e.prototype;a.toFlot=function(r,e,n){return C(r,e,n)};var o=function(r){return!Array.isArray(r)&&"object"==typeof r&&Array.isArray(r.Y)},s=function(r){return Array.isArray(r)&&o(r[0])},u=function(r){return!Array.isArray(r)&&"object"==typeof r&&2===Object.keys(r).length&&Object.keys(r).every(function(e){return Array.isArray(r[e])})},i=function(r){return Array.isArray(r)&&"object"==typeof r[0]&&2===Object.keys(r[0]).length&&"number"==typeof r[0][Object.keys(r[0])[0]]},y=function(r){return Array.isArray(r)&&u(r[0])},A=function(r){return Array.isArray(r)&&i(r[0])},f=function(r){return Array.isArray(r)&&"string"==typeof r[0]},l=function(r){return Array.isArray(r)&&Array.isArray(r[0])&&"string"==typeof r[0][0]},m=function(e){return o(e)?r.niAnalogWaveform:s(e)?r.niAnalogWaveformArray:u(e)?r.XYClusterOfArrays:i(e)?r.XYArrayOfClusters:Array.isArray(e)?0===e.length?r.empty:"number"==typeof e[0]?r.oneDimensionNumericArray:y(e)?r.XYArrayOfClusterOfArrays:A(e)?r.XYArrayOfArrayOfClusters:f(e)?r.oneDimensionComplexArray:l(e)?r.twoDimensionsComplexArray:Array.isArray(e[0])?r.twoDimensionsNumericArray:r.unknown:r.unknown},c=function(r){return r.toTimeAndValueArray()},p=function(r){for(var e=[],n=Object.keys(r),t=Math.min(r[n[0]].length,r[n[1]].length),a=0;a<t;a++)e.push([r[n[0]][a],r[n[1]][a]]);return e},h=function(r){for(var e=[],n=Object.keys(r[0]||{}),t=0;t<r.length;t++)e.push([r[t][n[0]],r[t][n[1]]]);return e},O=function(r){return r.map(function(r){return p(r)})},g=function(r){return r.map(function(r){return h(r)})},C=function(e,a,o){var s,u,i,y,A=[];switch(m(a)){case r.niAnalogWaveform:return u=new t(a),"string"==typeof u.channelName&&u.channelName.length>0&&e.updatePlotName(0,u.channelName),[c(u)];case r.niAnalogWaveformArray:for(s=[],y=0;y<a.length;y++)u=new t(a[y]),"string"==typeof u.channelName&&u.channelName.length>0&&e.updatePlotName(y,u.channelName),s.push(c(u));return s;case r.XYClusterOfArrays:return[p(a)];case r.XYArrayOfClusters:return[h(a)];case r.XYArrayOfClusterOfArrays:return O(a);case r.XYArrayOfArrayOfClusters:return g(a);case r.oneDimensionNumericArray:for(i=0;i<a.length;i++)A.push([i,a[i]]);return[A];case r.twoDimensionsNumericArray:for(s=[],y=0;y<a.length;y++){for(A=[],i=0;i<a[y].length;i++)A.push([i,a[y][i]]);s.push(A)}return s;case r.oneDimensionComplexArray:for(i=0;i<a.length;i++)A.push(n.prototype.parseFromString(a[i]));return[A];case r.twoDimensionsComplexArray:for(s=[],y=0;y<a.length;y++){for(A=[],i=0;i<a[y].length;i++)A.push(n.prototype.parseFromString(a[y][i]));s.push(A)}return s}return s||[A]}}();
NationalInstruments.HtmlVI.Elements.CartesianGraphBase=function(){"use strict"},function(e,t){"use strict";var a=NationalInstruments.Globals.jQuery,n=NationalInstruments.HtmlVI.NISupport,i=NationalInstruments.HtmlVI.DataPipeline.GraphDataPipeline;n.inheritFromParent(e,t);var r=e.prototype,o=!0,s=!1;r.getSettings=function(){var e={lines:{show:!0,lineWidth:1},canvas:!0,series:{shadowSize:0,downsample:{threshold:1e3}},axisLabels:{show:!0},xaxes:[{}],yaxes:[{}],zoom:{interactive:!0,trigger:null},pan:{interactive:!0},selection:{mode:null},grid:{backgroundColor:"#FFFFFF"}};return e},r.configureGraph=function(){var e,t=this.getSettings();for(""!==this.plotAreaMargin&&(void 0===t.grid&&(t.grid={}),t.grid.margin=JSON.parse(this.plotAreaMargin)),t.xaxes=[],t.yaxes=[],t.cursors=[],e=0;e<this.axes.length;e++){var a=this.axes[e],n=a.getViewConfig();n&&(!n.position||"left"!==n.position&&"right"!==n.position||t.yaxes.push(n),!n.position||"top"!==n.position&&"bottom"!==n.position||t.xaxes.push(n))}for(e=0;e<this.cursors.length;e++){var i=this.cursors[e],r=i.getViewConfig();t.cursors.push(r)}return this.graphTools&&(t.zoom.interactive=this.graphTools.allowsScrollWheelZoom(),t.pan.interactive=this.graphTools.allowsPan(),t.selection.mode="zoom"===this.graphTools.mode?"smart":null),t},r.updateGraphConfig=function(){var e;this.plots.length>0&&(e=this.plots[0].getViewConfig());var t=this.graphdiv;if(void 0!==t){var i=this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value))),r=this.configureGraph();this.setHover(i,r);try{this.graph=a.plot(t,i,r)}catch(e){n.log(e.message)}var o=this;this.graph.getCursors().forEach(function(e,t){e.cookie=o.cursors[t],o.cursors[t].setCursor(e)})}},r.onCursorUpdates=function(e,t){t.forEach(function(e,a){e.target.cookie.updateCursorElement(t[a])})},r.throttlePlotUpdates=function(e){o=!e,o&&s&&(this.updateGraphConfig(),s=!1)},r.updateGraphConfigWhenPlotsUpdatesAreEnabled=function(){o?(this.updateGraphConfig(),s=!1):s=!0},r.convertToFlotFormat=function(e){return i.prototype.toFlot(this,e)},r.updatePlotName=function(e,t){t&&this.plots[e]&&(this.plots[e].label=t)},r.createData=function(e,t){var a=[];return t.forEach(function(t,n){var i=e[n];i?(a[n]=i.getViewConfig(),a[n].data=t.length>0&&i.show?t:[]):(a[n]={},a[n].data=t.length>0?t:[])}),a},r.updateData=function(){var e=this.graph;e.setData(this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value)))),e.setupGrid(),e.draw()},r.addAllProperties=function(e){t.prototype.addAllProperties.call(this,e),r.addProperty(e,{propertyName:"value",defaultValue:"[]"}),r.addProperty(e,{propertyName:"plotAreaMargin",defaultValue:""})},r.createdCallback=function(){t.prototype.createdCallback.call(this),this.plots=[],this.axes=[],this.cursors=[],this.plotLegend=null,this.cursorLegend=null,this.scaleLegend=null,this.graphTools=null,this.graphdiv=void 0,this.tooltip=null},r.findGraphItems_early=function(){var e,t=[],a=NationalInstruments.HtmlVI.Elements.CartesianPlot.prototype.elementInfo.tagName.toUpperCase(),n=NationalInstruments.HtmlVI.Elements.CartesianAxis.prototype.elementInfo.tagName.toUpperCase();for(e=0;e<this.children.length;e++)this.children[e].tagName===n?t.push(this.children[e]):this.children[e].tagName===a&&t.push(this.children[e]);return t},r.forceResize=function(e){t.prototype.forceResize.call(this,e);var a=this.graph;void 0!==a&&(a.clearTextCache(),a.resize(),a.setupGrid(),a.draw())},r.createGraph=function(){var e=this,t=document.createElement("div");t.style.width="100%",t.style.height="100%",this.appendChild(t);var i=document.createElement("div");i.id="tooltip"+n.uniqueId(),i.className="ni-graph-tooltip",this.appendChild(i),this.tooltip=i,this.graphdiv=t;var r=this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value))),o=this.configureGraph();this.setHover(r,o);try{this.graph=a.plot(t,r,o)}catch(e){n.log("Failed to create a flot chart. Make sure that the placeholder element has a non-zero size !")}a(t).bind("plothover",function(t,n,r){if(r&&e.plots[r.seriesIndex]){var o=r.datapoint[0],s=r.datapoint[1],l=e.plots[r.seriesIndex].hoverFormat||"{0}, {1}",h=e.format(l,o,s);a(i).html(h).css({top:r.pageY-e.offsetTop+5,left:r.pageX-e.offsetLeft+5}).fadeIn(100)}else a(i).hide()});try{this.graph.getPlaceholder().bind("cursorupdates",this.onCursorUpdates),this.graph.getCursors().forEach(function(t,a){t.cookie=e.cursors[a],e.cursors[a].setCursor(t)})}catch(e){}},r.attachedCallback=function(){var e,a=t.prototype.attachedCallback.call(this);return a===!0&&(e=this.findGraphItems_early(),this.addGraphItemListeners(e),this.createGraph(),this.attachLegends()),a},r.addGraphItemListeners=function(e){var t=this;t.addEventListener("ni-cartesian-plot-attached",function(a){var n;if(a.target===t){for(t.plots.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-attached",a.detail.element)}}),t.addEventListener("ni-cartesian-plot-detached",function(e){var a;if(t.notifyPlotLegend("ni-cartesian-plot-detached",e.detail.element),e.target===t){for(a=0;a<t.plots.length;a++)if(t.plots[a]===e.detail.element){t.plots.splice(a,1);break}t.updateGraphConfigWhenPlotsUpdatesAreEnabled()}}),t.addEventListener("ni-cartesian-axis-attached",function(a){var n;if(a.target===t){for("string"==typeof t.axes&&(t.axes=[]),"string"==typeof t.plots&&(t.plots=[]),t.axes.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfig(),t.notifyScaleLegend("ni-cartesian-axis-attached",a.detail.element)}}),t.addEventListener("ni-cartesian-axis-detached",function(e){var a;if(e.target===t){for(a=0;a<t.axes.length;a++)if(t.axes[a]===e.detail.element){t.axes.splice(a,1);break}t.updateGraphConfig(),t.notifyScaleLegend("ni-cartesian-axis-detached",e.detail.element)}}),t.addEventListener("ni-cursor-attached",function(a){var n;if(a.target===t){for("string"==typeof t.cursors&&(t.cursors=[]),t.cursors.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-attached",a.detail.element)}}),t.addEventListener("ni-cursor-detached",function(e){var a;if(e.target===t){for(a=0;a<t.cursors.length;a++)if(t.cursors[a]===e.detail.element){t.cursors.splice(a,1);break}t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-detached",e.detail.element)}}),t.addEventListener("ni-axis-changed",function(e){t.updateGraphConfig(),t.notifyScaleLegend("ni-axis-changed",e.detail.element)}),t.addEventListener("ni-cursor-changed",function(e){t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-changed",e.detail.element)}),t.addEventListener("ni-cartesian-plot-changed",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-changed",e.detail.element)}),t.addEventListener("ni-cartesian-plot-renderer-changed",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-changed",e.detail.originalSource)}),t.addEventListener("ni-cartesian-plot-renderer-attached",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-attached",e.detail.originalSource)}),t.addEventListener("ni-cartesian-plot-renderer-detached",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-detached",e.detail.originalSource)}),t.addEventListener("ni-graph-tools-changed",function(){t.updateGraphConfig()})},r.registerPlotLegend=function(e){this.plotLegend=e},r.notifyPlotLegend=function(e,t){var a;null!==this.plotLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.plotLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerCursorLegend=function(e){var t;if(this.cursorLegend=e,this.cursors.length>0)for(t=0;t<this.cursors.length;t++)this.notifyCursorLegend("ni-cursor-attached",this.cursors[t])},r.notifyCursorLegend=function(e,t){var a;null!==this.cursorLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.cursorLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerScaleLegend=function(e){var t;if(this.scaleLegend=e,this.axes.length>0)for(t=0;t<this.axes.length;t++)this.notifyScaleLegend("ni-cartesian-axis-attached",this.axes[t])},r.notifyScaleLegend=function(e,t){var a;null!==this.scaleLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.scaleLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerGraphTools=function(e){var t=this;this.graphTools=e,this.updateGraphConfig(),a(this.graphdiv).on("plotselected",function(e,a){t.notifyGraphTools("ni-cartesian-graph-box-selected",{ranges:a})}),a(this.graphdiv).on("plotpan",function(e,a){t.notifyGraphTools("ni-cartesian-graph-interaction",{ranges:a})}),a(this.graphdiv).on("plotzoom",function(e,a){t.notifyGraphTools("ni-cartesian-graph-interaction",{ranges:a})}),a(this.graphdiv).on("re-center",function(e){t.notifyGraphTools("ni-cartesian-graph-reCenter",e)})},r.notifyGraphTools=function(e,t){var a;null!==this.graphTools&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.graphTools.dispatchEvent(new CustomEvent(e,a)))},r.attachLegends=function(){for(var e=this,t=["ni-cursor-legend".toUpperCase(),"ni-plot-legend".toUpperCase(),"ni-cursor-legend".toUpperCase(),"ni-graph-tools".toUpperCase()],a=this.parentElement.children,n=[],i=0;i<a.length;i++){var r=a[i];t.indexOf(r.tagName)!==-1&&r.graphName===this.niControlId&&n.push(r)}n.forEach(function(t){t.attachToGraph(e)})},r.propertyUpdated=function(e){switch(t.prototype.propertyUpdated.call(this,e),e){case"value":this.updateData();break;case"plotAreaMargin":this.updateGraphConfig()}},r.format=function(){var e=arguments,t=e[0];return t.replace(/{(\d+)}/g,function(t,a){var n=parseInt(a)+1,i=e[n];if("undefined"!=typeof i){var r=i.toFixed(2).length,o=i.toExponential(2).length;return r<o?i.toFixed(2):i.toExponential(2)}return t})},r.setHover=function(e,t){var n,i=!1;for(n=0;n<e.length;n++)if(e[n].hoverable){i=!0;break}i===!0?(void 0===t.grid&&(t.grid={}),t.grid.hoverable=i):null!==this.tooltip&&a(this.tooltip).hide()}}(NationalInstruments.HtmlVI.Elements.CartesianGraphBase,NationalInstruments.HtmlVI.Elements.Visual);
NationalInstruments.HtmlVI.Elements.CartesianGraphBase=function(){"use strict"},function(e,t){"use strict";var a=NationalInstruments.Globals.jQuery,n=NationalInstruments.HtmlVI.NISupport,i=NationalInstruments.HtmlVI.DataPipeline.GraphDataPipeline;n.inheritFromParent(e,t);var r=e.prototype,o=!0,s=!1;r.getSettings=function(){var e={lines:{show:!0,lineWidth:1},canvas:!0,series:{shadowSize:0,downsample:{threshold:1e3}},axisLabels:{show:!0},xaxes:[{}],yaxes:[{}],zoom:{interactive:!0,trigger:null},pan:{interactive:!0},selection:{mode:null},grid:{backgroundColor:"#FFFFFF"}};return e},r.configureGraph=function(){var e,t=this.getSettings();for(""!==this.plotAreaMargin&&(void 0===t.grid&&(t.grid={}),t.grid.margin=JSON.parse(this.plotAreaMargin)),t.xaxes=[],t.yaxes=[],t.cursors=[],e=0;e<this.axes.length;e++){var a=this.axes[e],n=a.getViewConfig();n&&(!n.position||"left"!==n.position&&"right"!==n.position||t.yaxes.push(n),!n.position||"top"!==n.position&&"bottom"!==n.position||t.xaxes.push(n))}for(e=0;e<this.cursors.length;e++){var i=this.cursors[e],r=i.getViewConfig();t.cursors.push(r)}return this.graphTools&&(t.zoom.interactive=this.graphTools.allowsScrollWheelZoom(),t.pan.interactive=this.graphTools.allowsPan(),t.selection.mode="zoom"===this.graphTools.mode?"smart":null),t},r.updateGraphConfig=function(){var e;this.plots.length>0&&(e=this.plots[0].getViewConfig());var t=this.graphdiv;if(void 0!==t){var i=this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value))),r=this.configureGraph();this.setHover(i,r);try{this.graph=a.plot(t,i,r)}catch(e){n.log(e.message)}var o=this;this.graph.getCursors().forEach(function(e,t){e.cookie=o.cursors[t],o.cursors[t].setCursor(e)})}},r.onCursorUpdates=function(e,t){t.forEach(function(e,a){e.target.cookie.updateCursorElement(t[a])})},r.throttlePlotUpdates=function(e){o=!e,o&&s&&(this.updateGraphConfig(),s=!1)},r.updateGraphConfigWhenPlotsUpdatesAreEnabled=function(){o?(this.updateGraphConfig(),s=!1):s=!0},r.convertToFlotFormat=function(e){return i.prototype.toFlot(this,e)},r.updatePlotName=function(e,t){t&&this.plots[e]&&(this.plots[e].label=t)},r.createData=function(e,t){var a=[];return t.forEach(function(t,n){var i=e[n];i?(a[n]=i.getViewConfig(),a[n].data=t.length>0&&i.show?t:[]):(a[n]={},a[n].data=t.length>0?t:[])}),a},r.updateData=function(){var e=this.graph;e.setData(this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value)))),e.setupGrid(),e.draw()},r.addAllProperties=function(e){t.prototype.addAllProperties.call(this,e),r.addProperty(e,{propertyName:"value",defaultValue:"[]",fireEvent:!0,addNonSignalingProperty:!0,isElementValueProperty:!0}),r.addProperty(e,{propertyName:"plotAreaMargin",defaultValue:""})},r.createdCallback=function(){t.prototype.createdCallback.call(this),this.plots=[],this.axes=[],this.cursors=[],this.plotLegend=null,this.cursorLegend=null,this.scaleLegend=null,this.graphTools=null,this.graphdiv=void 0,this.tooltip=null},r.findGraphItems_early=function(){var e,t=[],a=NationalInstruments.HtmlVI.Elements.CartesianPlot.prototype.elementInfo.tagName.toUpperCase(),n=NationalInstruments.HtmlVI.Elements.CartesianAxis.prototype.elementInfo.tagName.toUpperCase();for(e=0;e<this.children.length;e++)this.children[e].tagName===n?t.push(this.children[e]):this.children[e].tagName===a&&t.push(this.children[e]);return t},r.forceResize=function(e){t.prototype.forceResize.call(this,e);var a=this.graph;void 0!==a&&(a.clearTextCache(),a.resize(),a.setupGrid(),a.draw())},r.createGraph=function(){var e=this,t=document.createElement("div");t.style.width="100%",t.style.height="100%",this.appendChild(t);var i=document.createElement("div");i.id="tooltip"+n.uniqueId(),i.className="ni-graph-tooltip",this.appendChild(i),this.tooltip=i,this.graphdiv=t;var r=this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value))),o=this.configureGraph();this.setHover(r,o);try{this.graph=a.plot(t,r,o)}catch(e){n.log("Failed to create a flot chart. Make sure that the placeholder element has a non-zero size !")}a(t).bind("plothover",function(t,n,r){if(r&&e.plots[r.seriesIndex]){var o=r.datapoint[0],s=r.datapoint[1],l=e.plots[r.seriesIndex].hoverFormat||"{0}, {1}",h=e.format(l,o,s);a(i).html(h).css({top:r.pageY-e.offsetTop+5,left:r.pageX-e.offsetLeft+5}).fadeIn(100)}else a(i).hide()});try{this.graph.getPlaceholder().bind("cursorupdates",this.onCursorUpdates),this.graph.getCursors().forEach(function(t,a){t.cookie=e.cursors[a],e.cursors[a].setCursor(t)})}catch(e){}},r.attachedCallback=function(){var e,a=t.prototype.attachedCallback.call(this);return a===!0&&(e=this.findGraphItems_early(),this.addGraphItemListeners(e),this.createGraph(),this.attachLegends()),a},r.addGraphItemListeners=function(e){var t=this;t.addEventListener("ni-cartesian-plot-attached",function(a){var n;if(a.target===t){for(t.plots.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-attached",a.detail.element)}}),t.addEventListener("ni-cartesian-plot-detached",function(e){var a;if(t.notifyPlotLegend("ni-cartesian-plot-detached",e.detail.element),e.target===t){for(a=0;a<t.plots.length;a++)if(t.plots[a]===e.detail.element){t.plots.splice(a,1);break}t.updateGraphConfigWhenPlotsUpdatesAreEnabled()}}),t.addEventListener("ni-cartesian-axis-attached",function(a){var n;if(a.target===t){for("string"==typeof t.axes&&(t.axes=[]),"string"==typeof t.plots&&(t.plots=[]),t.axes.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfig(),t.notifyScaleLegend("ni-cartesian-axis-attached",a.detail.element)}}),t.addEventListener("ni-cartesian-axis-detached",function(e){var a;if(e.target===t){for(a=0;a<t.axes.length;a++)if(t.axes[a]===e.detail.element){t.axes.splice(a,1);break}t.updateGraphConfig(),t.notifyScaleLegend("ni-cartesian-axis-detached",e.detail.element)}}),t.addEventListener("ni-cursor-attached",function(a){var n;if(a.target===t){for("string"==typeof t.cursors&&(t.cursors=[]),t.cursors.push(a.detail.element),n=0;n<e.length;n++)if(e[n]===a.detail.element){e.splice(n,1);break}t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-attached",a.detail.element)}}),t.addEventListener("ni-cursor-detached",function(e){var a;if(e.target===t){for(a=0;a<t.cursors.length;a++)if(t.cursors[a]===e.detail.element){t.cursors.splice(a,1);break}t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-detached",e.detail.element)}}),t.addEventListener("ni-axis-changed",function(e){t.updateGraphConfig(),t.notifyScaleLegend("ni-axis-changed",e.detail.element)}),t.addEventListener("ni-cursor-changed",function(e){t.updateGraphConfig(),t.notifyCursorLegend("ni-cursor-changed",e.detail.element)}),t.addEventListener("ni-cartesian-plot-changed",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-changed",e.detail.element)}),t.addEventListener("ni-cartesian-plot-renderer-changed",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-changed",e.detail.originalSource)}),t.addEventListener("ni-cartesian-plot-renderer-attached",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-attached",e.detail.originalSource)}),t.addEventListener("ni-cartesian-plot-renderer-detached",function(e){t.updateGraphConfigWhenPlotsUpdatesAreEnabled(),t.notifyPlotLegend("ni-cartesian-plot-renderer-detached",e.detail.originalSource)}),t.addEventListener("ni-graph-tools-changed",function(){t.updateGraphConfig()})},r.registerPlotLegend=function(e){this.plotLegend=e},r.notifyPlotLegend=function(e,t){var a;null!==this.plotLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.plotLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerCursorLegend=function(e){var t;if(this.cursorLegend=e,this.cursors.length>0)for(t=0;t<this.cursors.length;t++)this.notifyCursorLegend("ni-cursor-attached",this.cursors[t])},r.notifyCursorLegend=function(e,t){var a;null!==this.cursorLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.cursorLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerScaleLegend=function(e){var t;if(this.scaleLegend=e,this.axes.length>0)for(t=0;t<this.axes.length;t++)this.notifyScaleLegend("ni-cartesian-axis-attached",this.axes[t])},r.notifyScaleLegend=function(e,t){var a;null!==this.scaleLegend&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.scaleLegend.dispatchEvent(new CustomEvent(e,a)))},r.registerGraphTools=function(e){var t=this;this.graphTools=e,this.updateGraphConfig(),a(this.graphdiv).on("plotselected",function(e,a){t.notifyGraphTools("ni-cartesian-graph-box-selected",{ranges:a})}),a(this.graphdiv).on("plotpan",function(e,a){t.notifyGraphTools("ni-cartesian-graph-interaction",{ranges:a})}),a(this.graphdiv).on("plotzoom",function(e,a){t.notifyGraphTools("ni-cartesian-graph-interaction",{ranges:a})}),a(this.graphdiv).on("re-center",function(e){t.notifyGraphTools("ni-cartesian-graph-reCenter",e)})},r.notifyGraphTools=function(e,t){var a;null!==this.graphTools&&(a={bubbles:!1,cancelable:!0,detail:{element:this,originalSource:t}},this.graphTools.dispatchEvent(new CustomEvent(e,a)))},r.attachLegends=function(){for(var e=this,t=["ni-cursor-legend".toUpperCase(),"ni-plot-legend".toUpperCase(),"ni-cursor-legend".toUpperCase(),"ni-graph-tools".toUpperCase()],a=this.parentElement.children,n=[],i=0;i<a.length;i++){var r=a[i];t.indexOf(r.tagName)!==-1&&r.graphName===this.niControlId&&n.push(r)}n.forEach(function(t){t.attachToGraph(e)})},r.propertyUpdated=function(e){switch(t.prototype.propertyUpdated.call(this,e),e){case"value":this.updateData();break;case"plotAreaMargin":this.updateGraphConfig()}},r.format=function(){var e=arguments,t=e[0];return t.replace(/{(\d+)}/g,function(t,a){var n=parseInt(a)+1,i=e[n];if("undefined"!=typeof i){var r=i.toFixed(2).length,o=i.toExponential(2).length;return r<o?i.toFixed(2):i.toExponential(2)}return t})},r.setHover=function(e,t){var n,i=!1;for(n=0;n<e.length;n++)if(e[n].hoverable){i=!0;break}i===!0?(void 0===t.grid&&(t.grid={}),t.grid.hoverable=i):null!==this.tooltip&&a(this.tooltip).hide()}}(NationalInstruments.HtmlVI.Elements.CartesianGraphBase,NationalInstruments.HtmlVI.Elements.Visual);
NationalInstruments.HtmlVI.Elements.CartesianGraph=function(){"use strict"},function(t,a){"use strict";var r=NationalInstruments.Globals.jQuery,s=NationalInstruments.HtmlVI.NISupport;s.inheritFromParent(t,a);var e=t.prototype;e.updateGraphConfig=function(){var t=this.graphdiv;if(void 0!==t){var a=this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value))),s=this.configureGraph();this.setHover(a,s);try{this.graph=r.plot(t,a,s);var e=this;this.graph.getCursors().forEach(function(t,a){t.cookie=e.cursors[a],e.cursors[a].setCursor(t)})}catch(t){}}},e.updateData=function(){var t=this.graph;t.setData(this.createData(this.plots,this.convertToFlotFormat(JSON.parse(this.value)))),t.setupGrid(),t.draw()},e.defineElementInfo(e,"ni-cartesian-graph","HTMLNICartesianGraph")}(NationalInstruments.HtmlVI.Elements.CartesianGraph,NationalInstruments.HtmlVI.Elements.CartesianGraphBase);

@@ -5,0 +5,0 @@ NationalInstruments.HtmlVI.Elements.Chart=function(){"use strict"},function(t,e,r){"use strict";var n=NationalInstruments.HtmlVI.NISupport;n.inheritFromParent(t,e);var i=t.prototype;i.setHistoryBuffer=function(t){this.historyBuffer=t},i.getHistoryBuffer=function(){return this.historyBuffer},i.createdCallback=function(){e.prototype.createdCallback.call(this),this.historyBuffer=new r.HistoryBuffer(1024,1)},i.getSettings=function(){var t=e.prototype.getSettings.call(this);return t.series.historyBuffer=this.historyBuffer,t},i.addAllProperties=function(t){e.prototype.addAllProperties.call(this,t),i.addProperty(t,{propertyName:"bufferSize",defaultValue:1024})},i.defineElementInfo(i,"ni-chart","HTMLNIChart")}(NationalInstruments.HtmlVI.Elements.Chart,NationalInstruments.HtmlVI.Elements.CartesianGraphBase,"object"==typeof global&&global?global:this);

{
"name": "ni-webcharts",
"version": "0.0.7",
"version": "0.0.8",
"description": "webcharts graph, chart, intensity graphs, plots and axes",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc