Forum Replies Created by bjndugga

Viewing 3 posts - 1 through 3 (of 3 total)
  • in reply to: Reading Exernal data from URL not working in line Graph #23797

    Hi Team,

    Please help me find a way I can pass dataPoints from a node.js function to the chart and allow it to refresh every time the datapoints are refreshed. The data will be sent in form of JSON format.

      This is the sample Code I had written

    The java script branch runs well in node.js and data is shown

                window.onload = function () {
                    var CanvasJS = require('./canvasjs.min');
                    var HazelcastClient = require('hazelcast-client').Client;
                    var Config = require('hazelcast-client').Config;
                    var config = new Config.ClientConfig();
                    config.networkConfig.addresses = [{host: '', port: '5701'}];
                    var map = {};
                    HazelcastClient.newHazelcastClient().then(function (hazelcastClient) {
                        map = hazelcastClient.getMap("mdstcnt");
                        setInterval(() => {
                        }, 500);
                    var dataPoints = [];
                    var chart = new CanvasJS.Chart("chartContainer", {
                        theme: "light2",
                        title: {
                            text: "Live Data"
                        data: [{
                                type: "line",
                                xValueType: "dateTime",
                                xValueFormatString: "hh:mm TT",
                                yValueFormatString: "#,###",
                                showInLegend: true,
                                dataPoints: dataPoints
                    function readMap(map) {
                        map.get('MICROBUNDLE').then(function (entries) {
                            var entry = JSON.parse(entries);
                            var entryTime = entry.time.split(":");
                            var time = new Date;
                            dataPoints.push({x: time.getTime(), y: parseInt(entry.value)});
                            //setTimeout(readMap, 500);
            <div id="chartContainer" style="height: 300px; width: 100%;"></div>
            <script type="text/javascript" src=""></script>
            <script type="text/javascript" src=""></script>
    in reply to: Reading Exernal data from URL not working in line Graph #23782

    Hi Vishwas R,

    I actually noticed that I need to parse JSON data before publishing it. I am trying to implement this on Node.js, however I have not reference code.

    in reply to: Running in node.js #23781

    Hi The Sample implementation of CanvasJS on Node.js is no longer available @Priyanka M S or anyone please share.

Viewing 3 posts - 1 through 3 (of 3 total)