Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript function to check for missing dates on JSON object
    primarykey
    data
    text
    <p>I am in my rookie stage learning javascript. I made an API that gets a number of users registered on a certain date and returns this data as a JSON object. Here is a sample of that data</p> <pre><code>{"myjsonobject": [{"users": 3, "joined": "2013-05-25"}, {"users": 1, "joined": "2013-05-26"}, {"users": 1, "joined": "2013-05-30"}, {"users": 1, "joined": "2013-05-31"}]} </code></pre> <p>I then parse the data and graph on <a href="http://www.chartjs.org" rel="nofollow">ChartJS</a> linegraph using the javascript function below</p> <pre><code>$(document).ready(function() { url = "http://mylink/getjson/" Create_jsonObject(url) }); function Create_jsonObject(url) { $.getJSON(url, function (data) { myJSONObject=data; var dataSource=myJSONObject.myjsonoject; var chart = $("#chartContainer").dxChart({ dataSource: dataSource, commonSeriesSettings: { argumentField: 'joined' }, series: [ { valueField: 'users', name: 'users' }, ], argumentAxis:{ grid:{ visible: true } }, tooltip:{ enabled: true }, title: 'Volunteer Registration', legend: { verticalAlignment: 'bottom', horizontalAlignment: 'center' }, commonPaneSettings: { border:{ visible: true, right: false } } }); }); }; </code></pre> <p>The function works in charting the JSON data on the linegraph. I would like to incorporate a javascript function that checks for missing dates and inserts 0 users where a date is missing. Thus the graph will plot zero where not date was returned. It should check this against the earliest date returned. Any ideas anyone? </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload