Tag Archives: javascript

A node.js chart service powered by Excel

Updated 17:15 EEST: added a diagram of the flow and updated chartServer.js

In a previous article I have shown how to use Excel to generate image charts with Microsoft Excel. In this article I will take this one step further and add a HTTP interface to that script so you can invoke it from a browser.

The ingredients are node.js and Microsoft Excel.  node.js offers an extremely lightweight ( 5.5 MB) framework to run a JavaScript server that receives HTTP requests, dispatches the requests to excelPieChart.vbs which in turn produces image charts via Excel. These images are served back as the response for the HTTP requests.

node_js

Installing and starting this server should take less than 2 minutes, with the biggest part of it being the download of node.js. The solution does not require any node.js modules other than the standard ones.

Using the service is even simpler:

Request

http://giediprime:8000/chart?labels="High|Medium|Low"&data="2|25|8"&title="node.js chart example"

Response
rpeactual_nodeJsCharts

Continue reading

Arrays in RPE

The series started with JavaScript Objects in RPE continues with collections. This post covers using collections, more specifically arrays, sorting collections and an end to end example on using collections to manipulate live data:

  • read the data from a provider and store it in an array
  • sort the array on arbitrary rules
  • render the content of the array using an iteration element

In RPE collections can be used to solve many complex problems including but not limited to:

  • sorting not supported directly by RPE ( sorting on child properties)
  • combining data from multiple sources more easily/efficiently ( avoid repeated passes over the data)
  • restructuring the data ( avoid complex template nesting)

Continue reading