How To Visualize Data In MeteorJS

Meteor is a powerful platform for building responsive web and mobile applications. It uses modular components, full-stack reactivity, and data on the wire.

It is a full-stack framework where you can build real-time web applications for desktop and mobile platforms. Even a beginner can quickly build something impressive and useful and that is why advanced developers do appreciate the flexibility of MeteorJS. It uses MongoDB for the database as its own build and test tools. It also uses the distributed data protocol and publish-subscribe pattern which helps in propagating change in data to clients without and synchronized code written by a developer. You can also extend it with external packages like Atmosphere, or MPM.

Let’s take a look at what Meteor requires to function properly –
Chocolatey – Install Chocolatey. For Installing it with cmd.exe, execute the following command in the terminal:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

MeteorJS – To install MeteorJS, execute the following command in the terminal:
choco install meteor

FusionCharts – To install FusionCharts module, execute the following command in the terminal:
meteor npm install fusioncharts --save

FusionMaps – To install FusionMaps module, execute the following command in the terminal:
meteor npm install fusionmaps

Creating Project

Once you’ve installed Meteor, create a project. Run the following command in the terminal:
meteor create myapp

The above command will create a new folder named myapp with all the files that a Meteor app needs.

To run the newly created app, execute the following commands:
cd myappmeteor

The above command will take us to a page in a browser – http://localhost:3000/

Let’s move on to the next phase of the process to edit the HTML and JS file to render FusionMaps.

Code Modification

Edit HTML file: Replace the existing html code with the code given below:

Importing dependencies:- In the JS file, replace the existing js code with the code given below to import the required dependency:

Passing dependency: – Now we need to pass the dependency using the following code:

Create instance: – Next, we will create the instance of the template fusioncharts using the following code-

DOM: – Copy the JS code given below to your file, to insert the instance of the FusionCharts template into the DOM

Render the map: – Start the server using command meteor and check the URL- http://localhost:3000/ in your browser. The output looks like as shown below:

If you see any errors in your code or have trouble executing the above sample, click here to download the complete source code of the sample project we have created for this tutorial.


Leave a Comment