{"id":1828,"date":"2017-05-25T13:04:07","date_gmt":"2017-05-25T13:04:07","guid":{"rendered":"http:\/\/mindfusion.eu\/blog\/?p=1828"},"modified":"2021-01-21T14:15:11","modified_gmt":"2021-01-21T14:15:11","slug":"a-javascript-application-for-server-load-monitoring","status":"publish","type":"post","link":"https:\/\/mindfusion.dev\/blog\/a-javascript-application-for-server-load-monitoring\/","title":{"rendered":"A JavaScript Application for Server Load Monitoring"},"content":{"rendered":"<p>In two blog posts we will look at the main steps to create a sample server load web application. We will use the chart, gauge and diagram libraries. The data is simulated with random numbers.<\/p>\n<div id=\"attachment_1851\" style=\"width: 1260px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1851\" class=\"size-full wp-image-1851\" src=\"http:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor.png\" alt=\"Server Load Application in JavaScript\" width=\"1250\" height=\"898\" srcset=\"https:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor.png 1250w, https:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor-300x216.png 300w, https:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor-768x552.png 768w, https:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor-1024x736.png 1024w, https:\/\/mindfusion.dev\/blog\/wp-content\/uploads\/2017\/05\/server-load-monitor-418x300.png 418w\" sizes=\"auto, (max-width: 1250px) 100vw, 1250px\" \/><\/a><p id=\"caption-attachment-1851\" class=\"wp-caption-text\">Server Load Application in JavaScript<\/p><\/div>\n<p align=\"center\"><a href=\"https:\/\/mindfusion.dev\/samples\/javascript\/chart\/ServerLoad\/index.html\">Run The Application<\/a><\/p>\n<p>The chart shows number of users on a given connection between two stations in the network at each moment. The graphic includes data for the last 30 seconds. The diagram shows the servers and clients that build the network. By default the charts shows data only for the two most important connections, out of total 10. Users can select different connections and view their graphics. The <a href=\"http:\/\/mindfusion.dev\/javascript-chart.html\">gauge control<\/a> provides data for the average count of users at any given moment.<\/p>\n<p><strong>I. Project Setup<\/strong><\/p>\n<p>We create an empty website and add a Scripts folder with the necessary files:<\/p>\n<pre>MindFusion.Gauges.js\nMindFusion.Diagramming.js\nMindFusion.Common.js\nMindFusion.Charting.js\nrequire.js\n<\/pre>\n<p>and a reference to <a href=\"https:\/\/jquery.com\/\">jQuery<\/a> or the jQuery library itself:<\/p>\n<pre>jquery.js\n<\/pre>\n<p>We create a blank HTML file and we create three <a href=\"https:\/\/www.w3schools.com\/html\/html5_canvas.asp\">HTML Canvas<\/a> elements &#8211; one for each of the controls: <a href=\"http:\/\/mindfusion.dev\/javascript-chart.html\">chart<\/a>, <a href=\"http:\/\/mindfusion.dev\/javascript-diagram.html\">diagram<\/a>, <a href=\"http:\/\/mindfusion.dev\/javascript-chart.html\">gauge<\/a>.<\/p>\n<p>We use the <a href=\"https:\/\/www.w3schools.com\/css\/css3_flexbox.asp\">Flexbox layout<\/a> and we create a CSS file referenced by the index.html file where we write the CSS settings for the layout:<\/p>\n<pre>\u00a0<\/pre>\n<p>\u00a0<\/p>\n<p>We initialize a section region that would have a <a href=\"https:\/\/www.w3schools.com\/css\/css3_flexbox.asp\">Flexbox<\/a> layout:<\/p>\n<pre>section {\n   display: flex;\n   max-width: 700px;\n}\n<\/pre>\n<p>\u00a0<\/p>\n<p>The CSS class used for &lt;div&gt; elements inside &lt;section&gt;:<\/p>\n<pre>.column {\n  margin: 10px 10px 0px 0px;\n  flex: 1 1 0;\n  border: 1px solid #cecece;\n}\n\nsection:first-of-type .column:first-of-type {\n  flex: 1 1 auto;\n}\n<\/pre>\n<p>We specify that the first column on the second row would be twice wider than the other column. This is the diagram, and the other column is occupied by the gauge.<\/p>\n<pre>section:nth-of-type(2) .column:first-of-type {\n  flex: 2 2 22;\n}\n<\/pre>\n<p>\u00a0<\/p>\n<p>That&#8217;s how the HTML uses the CSS attributes:<\/p>\n<pre id=\"line1\">&lt;<span class=\"start-tag\">section<\/span>&gt;\n<span id=\"line288\"><\/span>&lt;<span class=\"start-tag\">div<\/span> <span class=\"attribute-name\">class<\/span>=\"<a class=\"attribute-value\">column<\/a>\"&gt;&lt;\/<span class=\"end-tag\">div<\/span>&gt;\n<span id=\"line289\"><\/span>&lt;\/<span class=\"end-tag\">section<\/span>&gt;<\/pre>\n<p>Note the <strong>id=&#8221;lineChart&#8221;<\/strong> attribute &#8211; we will use the id to initialize the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Controls_LineChart.htm\">LineChart<\/a> object in the *.js file. The diagram and gauge Canvas instances also have id-s.<\/p>\n<p>At the end of the index.html we include a reference to the require.js file to load the chart and gauge libraries this way:<\/p>\n<pre id=\"line1\">&lt;<span class=\"start-tag\">script<\/span> <span class=\"attribute-name\">src<\/span>=\"<a class=\"attribute-value\" href=\"view-source:https:\/\/mindfusion.dev\/blog\/a-javascript-application-for-server-load-monitoring\/Scripts\/diagram.js\">Scripts\/diagram.js<\/a>\" <span class=\"attribute-name\">type<\/span>=\"<a class=\"attribute-value\">text\/javascript<\/a>\"&gt;&lt;\/<span class=\"end-tag\">script<\/span>&gt;\n<span id=\"line294\"><\/span>&lt;<span class=\"start-tag\">script<\/span> <span class=\"attribute-name\">data-main<\/span>=\"<a class=\"attribute-value\">charts<\/a>\" <span class=\"attribute-name\">src<\/span>=\"<a class=\"attribute-value\" href=\"view-source:https:\/\/mindfusion.dev\/blog\/a-javascript-application-for-server-load-monitoring\/Scripts\/require.js\">Scripts\/require.js<\/a>\"&gt;&lt;\/<span class=\"end-tag\">script<\/span>&gt;\n<span id=\"line295\"><\/span><\/pre>\n<p><strong>Note:<\/strong> Internet Explorer might not load properly the JavaScript libraries if they are declared at the beginning of the file, (in the head section) before the initialization of the Canvas-es. Therefore it is best to put the script references at the bottom, right before the closing &lt;\/body&gt; tag.<\/p>\n<p><strong>II. The Gauge<\/strong><\/p>\n<p>The code for the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_OvalGauge_Members_1.htm\">OvalGauge<\/a> and the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Controls_LineChart.htm\">LineChart<\/a> is in a single method:<\/p>\n<pre>var lineChart = null;\n\ndefine([\"require\", \"exports\", 'MindFusion.Common', 'Scripts\/MindFusion.Charting', 'MindFusion.Gauges'], function (require, exports, MindFusion_Common_1, m, g) {\n    \"use strict\";\n.........\n.........\n} \n\n<\/pre>\n<p>\u00a0<\/p>\n<p>Before the method we declare a global variable for the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Controls_LineChart.htm\">LineChart.<\/a> We need to access it in the diagram file so it must have a global visibility.<\/p>\n<p>The OvalGauge control is created using the id of the HTML Canvas:<\/p>\n<pre>var userCounter = g.OvalGauge.create($('#userCounter')[0], false);\n<\/pre>\n<p>\u00a0<\/p>\n<p>We will use two <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_Events_0.htm\">Events<\/a> &#8211; raised before the background was painted and before the pointer was painted &#8211; to customize how the gauge background and pointer look.<\/p>\n<pre>\/\/use custom painting of the background and of the pointer\nuserCounter.addEventListener(g.Events.prepaintBackground, onGaugerepaintBackground.bind(this));\nuserCounter.addEventListener(g.Events.prepaintPointer, onPrepaintPointer.bind(this));\n<\/pre>\n<p>\u00a0<\/p>\n<p>The gauge needs a scale &#8211; we create an <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_OvalScale_1.htm\">OvalScale<\/a> and set its min and max value:<\/p>\n<pre>var scale = new g.OvalScale(userCounter);\nscale.setMinValue(0);\nscale.setMaxValue(40);\n................\n<\/pre>\n<p>\u00a0<\/p>\n<p>We will also set all three types of settings on the scale &#8211; <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MajorTickSettings_1.htm\">MajorTickSettings,<\/a> <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MiddleTickSettings_1.htm\">MiddleTickSettings<\/a> and <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MinorTickSettings_1.htm\">MinorTickSettings<\/a><\/p>\n<pre>\/\/initialize the major settings\nvar majorSettings = scale.majorTickSettings;\nmajorSettings.setTickShape(TickShape.Ellipse);\n..........................\n<\/pre>\n<p>\u00a0<\/p>\n<p>A <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_CustomInterval_1.htm\">CustomInterval<\/a> at the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MajorTickSettings_1.htm\">MajorTickSettings<\/a> indicates a special range. We will use one to paint in red the portion on the scale that corresponds to the high amount of users:<\/p>\n<pre> var interval = new g.CustomInterval();\n    interval.setMinValue(35);\n    interval.setFill('Red');\n    majorSettings.addCustomInterval(interval);\n<\/pre>\n<p>\u00a0<\/p>\n<p>Then we customize the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MajorTickSettings_1.htm\">MajorTickSettings,<\/a> the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MiddleTickSettings_1.htm\">MiddleTickSettings<\/a> and <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_MinorTickSettings_1.htm\">MinorTickSettings<\/a>:<\/p>\n<pre>\/\/initialize the middle settings\nvar middleSettings = scale.middleTickSettings;\nmiddleSettings.setShowLabels(false);\n...............\n\n\/\/initalize the minor settings\nvar minorSettings = scale.minorTickSettings;\nminorSettings.setShowLabels(false);\nminorSettings.setShowTicks(false);\n<\/pre>\n<p>\u00a0<\/p>\n<p>The scale shows a <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_Range_1.htm\">Range<\/a>: that is a visual indication of regions on the gauge. It is determined by its <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?M_MindFusion_Gauges_Range_setMinValue_1_Number_0.htm\">setMinValue<\/a> and <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?M_MindFusion_Gauges_Range_setMaxValue_1_Number_0.htm\">setMaxValue<\/a> values and in our case we will show it on the whole gauge:<\/p>\n<pre>\/\/add a range in gradient colors\nvar range = new g.Range();\nrange.setMinValue(0);\nrange.setMaxValue(40);\nrange.setFill(g.Utils.createLinearGradient(320, [1, '#ce0000', 0.8, '#ce0000', 0.7, '#FFA500', 0.6, '#FFD700', 0.5, '#008000', 0, '#008000']));\n...............\nscale.addRange(range);\n<\/pre>\n<p>\u00a0<\/p>\n<p>That&#8217;s how we handle the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_Events_0.htm\">PrepaintBackground event<\/a> to draw custom background for the gauge:<\/p>\n<pre>\/\/paint the background in gradient\nfunction onGaugerepaintBackground(sender, args) {\n   args.setCancelDefaultPainting(true);\n   var context = args.getContext();\n   var element = args.getElement();\n   var size = sender.getSize();\n   var ellipse = new g.Ellipse();\n   ellipse.setFill('gray');\n   ellipse.setStroke('transparent');\n   args.paintVisualElement(ellipse, size);\n   var ellipse = new g.Ellipse();\n   ellipse.setFill(g.Utils.createLinearGradient(300, [0, '#808080', 0.2, '#808080', 0.8, '#909090', 1, '#909090']));\n   ellipse.setStroke('transparent');\n   ellipse.setMargin(new g.Thickness(0.015));\n   args.paintVisualElement(ellipse, size);\n}\n<\/pre>\n<p>\u00a0<\/p>\n<p>The code that handles the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_Events_0.htm\">prepaint pointer event<\/a> is similar. The value of the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Gauges_Pointer_1.htm\">Pointer<\/a> is set this way:<\/p>\n<pre>\/\/add some initial value\npointer.setValue(26);\n<\/pre>\n<p>\u00a0<\/p>\n<p>When the last chart values changes &#8211; each second &#8211; we update the pointer value:<\/p>\n<pre>var pointer = userCounter.scales[0].pointers[0];\npointer.setValue(sum\/10);\n<\/pre>\n<p>\u00a0<\/p>\n<p><strong>III. The Chart<\/strong><\/p>\n<p>First we create the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Controls_LineChart.htm\">LineChart<\/a> object from the Canvas that we have initialized in the HTML. We take the width and height of the control from its parent container:<\/p>\n<pre>var lineChartEl = document.getElementById('lineChart');\nlineChartEl.width = lineChartEl.offsetParent.clientWidth;\nlineChartEl.height = lineChartEl.offsetParent.clientHeight;\nlineChart = new Controls.LineChart(lineChartEl);\n<\/pre>\n<p>\u00a0<\/p>\n<p>The data for the line series is stored in 10 <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Series2D_0.htm\">Series2D<\/a> instances. For each of them we need a list with the X and Y values. The X-values are the same for all series, the Y-values are randomly generated numbers. All of them are instances of the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Collections_List.htm\">List<\/a> class:<\/p>\n<pre>var values1 = new Collections.List();\nvar values2 = new Collections.List();\n......................................\nvar xValues = new Collections.List();\nvar xLabels = new Collections.List();\n<\/pre>\n<p>\u00a0<\/p>\n<p>Here we fill the xValues list with numbers:<\/p>\n<pre>\/\/initialize x-values and labels, generate sample data for the series\nfor (var i = 0; i &lt; 30; i++) {\n  xValues.add(i);\n  setXLabels(false);\n  generateData();\n}\n<\/pre>\n<p>\u00a0<\/p>\n<p>The setXLabels method takes care of the custom labels at the X-axis. At each 3rd call, it removes the first three values and adds three new ones: one with the current time stamp and two more as empty strings.<\/p>\n<pre>if (d.getSeconds() % 3 == 0)\n   {\n     \/\/clear the first three values\n     \/\/if the count of the labels is more than 30\n     if (removeFirst) {\n         xLabels.removeAt(0);\n         xLabels.removeAt(0);\n         xLabels.removeAt(0);\n       }\n\n       \/\/add a label and two empty strings\n       xLabels.add(d.getHours() + \":\" + d.getMinutes() + \":\" + d.getSeconds());\n       xLabels.add(\"\");\n       xLabels.add(\"\");                \n    }   \n<\/pre>\n<p>\u00a0<\/p>\n<p>We create the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Series2D_0.htm\">Series2D<\/a> instances and add them to the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Series_0.htm\">Series<\/a> property of the line chart:<\/p>\n<pre>\/\/the series for the chart\nvar series = new Collections.ObservableCollection(new Array(\n    new Charting.Series2D(xValues, values1, xLabels),\n    new Charting.Series2D(xValues, values2, null),\n    ...........\n    new Charting.Series2D(xValues, values10, null)));\n<\/pre>\n<p>\u00a0<\/p>\n<p>The xLables are assigned just to the first series, they will serve as labels source for the X-axis.To show them, we must first hide the coordinates and assign them to the xAxis:<\/p>\n<pre>lineChart.xAxis.labels = xLabels;\nlineChart.showXCoordinates = false;\n<\/pre>\n<p>\u00a0<\/p>\n<p>then we must &#8220;tell&#8221; the first series that its labels are used for the XAxis:<\/p>\n<pre>\/\/tell the series that the labels are for the X-axis.\nseries.item(0).supportedLabels = m.MindFusion.Charting.LabelKinds.XAxisLabel;\n<\/pre>\n<p>\u00a0<\/p>\n<p>We use the title property of a Series object to identify the series. That&#8217;s why we assign to them unique labels:<\/p>\n<pre>\/\/series titles are important - we identify the series with them\nfor (var i = 0; i &lt; 4; i++)\n    series.item(i).title = \"Client\" + i;\n\nfor (var i = 0; i &lt; 3; i++)\n    series.item(i + 4).title =\"Network\" + i;\n\nfor (var i = 0; i &lt; 3; i++)\n    series.item(i + 7).title =\"Data\" + i;\n<\/pre>\n<p>\u00a0<\/p>\n<p>Since it is going to be a long chart, we want a second Y-axis to appear to the right. That can be done by adding another <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_YAxisRenderer_Members_0.htm\">YAxisRenderer<\/a> with the same yAxis to the components rendered by default by the LineChart control. We add the new <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_YAxisRenderer_Members_0.htm\">YAxisRenderer<\/a> to a vertical <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Components_StackPanel_0.htm\">StackPanel<\/a>:<\/p>\n<pre> var y2Stack = new m.MindFusion.Charting.Components.StackPanel();\n y2Stack.orientation = m.MindFusion.Charting.Components.Orientation.Vertical;\n y2Stack.gridRow = 0;\n \/\/add the stack panel to the last grid column\n y2Stack.gridColumn = lineChart.chartPanel.columns.count() - 1;\n\n lineChart.chartPanel.children.add(y2Stack);\n<\/pre>\n<p>\u00a0<\/p>\n<p>The layout manager for a LineChart is a <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?Grid_0.htm\">Grid<\/a> panel. We add a new column to it, where the second Y-axis will be rendered. Then we add the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_Components_StackPanel_0.htm\">StackPanel<\/a> with the YAxisRenderer to this column. Next we add the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?P_MindFusion_Charting_Controls_BiaxialChart_yAxis_0.htm\">yAxis<\/a> and we specify that the plot is not to the left side of it:<\/p>\n<pre>\/\/create the second Y-axis\nvar secondYAxis = new Charting.YAxisRenderer(lineChart.yAxis);\nsecondYAxis.plotLeftSide = false;\nlineChart.yAxisRenderers.add(secondYAxis);\ny2Stack.children.add(secondYAxis); \n<\/pre>\n<p>\u00a0<\/p>\n<p>Then we customize the grid and trigger the timer that will update the data values at each second:<\/p>\n<pre>lineChart.gridType = Charting.GridType.Crossed;\nlineChart.backColor = new Drawing.Color.fromArgb(230, 230, 230);\nlineChart.theme.gridColor1 = Drawing.Color.fromArgb(1, 255, 255, 255);\nlineChart.theme.gridColor2 = Drawing.Color.fromArgb(1, 255, 255, 255);\nlineChart.theme.gridLineColor = Drawing.Color.fromArgb(0.5, 240, 240, 240);\n\/\/start the timer\nsetInterval(setTime, 1000);\n<\/pre>\n<p>\u00a0<\/p>\n<p>Finally, let&#8217;s look at the styling of the series. We keep the brushes in a list. The colors for those brushes are stored in a list with lists &#8211; each one with three elements for the red, green and blue values of the color.<\/p>\n<pre>\/\/the colors for the brushes\nvar brushes = new Collections.List();\n\nvar rgbColors = new Collections.List();\nrgbColors.add(new Array(102, 154, 204));\n..............\n<\/pre>\n<p>\u00a0<\/p>\n<p>What we actually do to show the graphics of the connections that are selected in the diagram is thicken the strokes for those line graphics and set the thickness to the rest to 0.15 to make them barely visible.<\/p>\n<p>We do that by using the thicknesses property of the <a href=\"http:\/\/www.mindfusion.dev\/onlinehelp\/chart.javascript\/index.htm?T_MindFusion_Charting_PerSeriesStyle_Members_0.htm\">PerSeriesStyle<\/a> class that we use for styling the chart.<\/p>\n<pre>lineChart.plot.seriesStyle = new Charting.PerSeriesStyle(brushes, brushes, thicknesses);\n<\/pre>\n<p>\u00a0<\/p>\n<p>And here is how we create the thicknesses and the brushes:<\/p>\n<pre>\/\/create brushes for the chart\nvar thicknesses = new Collections.List();\n  for (var i = 0; i &lt; 10; i++)\n   {        \n      var a = rgbColors.item(i);\n      brushes.add(new Drawing.Brush(new Drawing.Color.fromArgb(a[0], a[1], a[2])));\n      if (i == 5 || i == 8)\n          thicknesses.add(3.0);\n      else\n         thicknesses.add(0.15);\n      \n  }\n<\/pre>\n<p><br \/><br \/>Only the 5th and 8th thickness are set to 3, the others are almost zero &#8211; enough to draw the silhouettes of the graphics.<\/p>\n<p>And that&#8217;s all for this part I of the tutorial on how to build the client side of a sample server load monitor application in JavaScript. In part II we will look at the diagram control. You can run the sample from here:<\/p>\n<p align=\"center\"><a href=\"http:\/\/mindfusion.dev\/samples\/javascript\/chart\/ServerLoad\/index.html\">Run the online server load monitor application<\/a><\/p>\n<p>Here is the link to download the full source code for the application:<\/p>\n<p align=\"center\"><a href=\"https:\/\/mindfusion.dev\/samples\/javascript\/chart\/ServerLoad.zip\">Download Source Code<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/MindFusionComponents\/JavaScript-Chart-Samples\/tree\/master\/ServerLoad\">You can also fork it from GitHub.<\/a><\/p>\n<p>Find out more about the <a href=\"http:\/\/mindfusion.dev\/javascript-chart.html\">chart, gauge<\/a> and <a href=\"http:\/\/mindfusion.dev\/javascript-diagram.html\">diagram<\/a> JavaScript libraries from their official pages on the MindFusion website.<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In two blog posts we will look at the main steps to create a sample server load web application. We will use the chart, gauge and diagram libraries. The data is simulated with random numbers. Run The Application The chart &hellip; <a href=\"https:\/\/mindfusion.dev\/blog\/a-javascript-application-for-server-load-monitoring\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[61,95],"tags":[472,425,473,474,476,475,477],"class_list":["post-1828","post","type-post","status-publish","format-standard","hentry","category-charting-2","category-diagramming-2","tag-javascript-application","tag-javascript-chart","tag-javascript-diagram","tag-javascript-server-load-application","tag-online-server-load-application","tag-server-load-monitoring","tag-web-server-load-monitoring"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3RlKs-tu","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/posts\/1828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/comments?post=1828"}],"version-history":[{"count":26,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/posts\/1828\/revisions"}],"predecessor-version":[{"id":2621,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/posts\/1828\/revisions\/2621"}],"wp:attachment":[{"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/media?parent=1828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/categories?post=1828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mindfusion.dev\/blog\/wp-json\/wp\/v2\/tags?post=1828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}