I have the following array which is generated using for loop.
{x:320, y:420, count:360},
{x:340, y:440, count:370},
{x:380, y:480, count:390},
{x:400, y:500, count:400},
{x:420, y:520, count:410},
{x:440, y:540, count:420},
{x:460, y:560, count:430},
{x:480, y:580, count:440},
{x:500, y:600, count:450},
{x:520, y:620, count:460},
{x:540, y:640, count:470},
{x:560, y:660, count:480},
{x:580, y:680, count:30}
I am using this to create a heatmap using the addon from following url:
http://www.patrick-wied.at/static/heatmapjs/examples.html
I need to pass the above array as a javascript object to heatmap.js file in the following format. How can I achieve this? How can I convert my array into JavaScript object?
data: {
[
{x:320, y:420, count:360},
{x:340, y:440, count:370},
{x:380, y:480, count:390},
{x:400, y:500, count:400},
{x:420, y:520, count:410},
{x:440, y:540, count:420},
{x:460, y:560, count:430},
{x:480, y:580, count:440},
{x:500, y:600, count:450}
]
};
I am calling this functin
setDataSet: function(obj, internal)
isn’t valid. You’re missing a key for the array:
You could do it like this:
or
if you need
datainside to get a correct data object.