jQuery UI Widgets Forums Chart TypeError: Cannot read property 'offset' of undefined

This topic contains 2 replies, has 2 voices, and was last updated by  Hristo 3 years, 7 months ago.

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

  • shawn
    Participant

    I’m getting the error
    TypeError: Cannot read property ‘offset’ of undefined
    but I don’t know why….

    My JSON is valid and looks like this:
    (this is truncated… there are usually 100-200 records in rData)

    {
    	"rData": [
    		{
    			"autoID": "30587",
    			"rid": "4",
    			"capacityDL": 267,
    			"capacityUL": 178,
    			"currentDL": 22,
    			"currentUL": 1,
    			"signal": -61,
    			"dateTime": "02/24/2020 00:00:35",
    			"benchDL": 270,
    			"benchUL": 240,
    			"benchSignal": -60
    		},
    		{
    			"autoID": "31907",
    			"rid": "4",
    			"capacityDL": 273,
    			"capacityUL": 243,
    			"currentDL": 12,
    			"currentUL": 1,
    			"signal": -61,
    			"dateTime": "02/24/2020 09:10:34",
    			"benchDL": 270,
    			"benchUL": 240,
    			"benchSignal": -60
    		},
    		{
    			"autoID": "31919",
    			"rid": "4",
    			"capacityDL": 270,
    			"capacityUL": 240,
    			"currentDL": 11,
    			"currentUL": 1,
    			"signal": -61,
    			"dateTime": "02/24/2020 09:15:35",
    			"benchDL": 270,
    			"benchUL": 240,
    			"benchSignal": -60
    		}
    	],
    	"hul": 243,
    	"hdl": 273,
    	"hsig": 0,
    	"error": "0"
    }

    My settings look like this when populated:

    {
    	"title": "hillsdale-erie",
    	"description": "",
    	"enableAnimations": true,
    	"showLegend": true,
    	"padding": {
    		"left": 10,
    		"top": 5,
    		"right": 10,
    		"bottom": 5
    	},
    	"titlePadding": {
    		"left": 10,
    		"top": 0,
    		"right": 0,
    		"bottom": 10
    	},
    	"source": {
    		"_source": {
    			"datatype": "json",
    			"datafields": [
    				{
    					"name": "autoID"
    				},
    				{
    					"name": "rid"
    				},
    				{
    					"name": "capacityDL"
    				},
    				{
    					"name": "capacityUL"
    				},
    				{
    					"name": "currentDL"
    				},
    				{
    					"name": "currentUL"
    				},
    				{
    					"name": "signal"
    				},
    				{
    					"name": "dateTime",
    					"type": "date",
    					"format": "MM/dd/yyyy HH:mm:ss"
    				},
    				{
    					"name": "benchDL"
    				},
    				{
    					"name": "benchUL"
    				},
    				{
    					"name": "benchSignal"
    				}
    			],
    			"localdata": {
    				"rData": [
    					{
    						"autoID": "30586",
    						"rid": "3",
    						"capacityDL": 666,
    						"capacityUL": 682,
    						"currentDL": 24,
    						"currentUL": 1,
    						"signal": -48,
    						"dateTime": "02/24/2020 00:00:24",
    						"benchDL": 680,
    						"benchUL": 680,
    						"benchSignal": -51
    					},
    				{
    					"autoID": "31954",
    					"rid": "3",
    					"capacityDL": 675,
    					"capacityUL": 682,
    					"currentDL": 37,
    					"currentUL": 1,
    					"signal": -49,
    					"dateTime": "02/24/2020 09:30:24",
    					"benchDL": 680,
    					"benchUL": 680,
    					"benchSignal": -51
    				}
    			],
    			"hul": 686,
    			"hdl": 681,
    			"hsig": 0,
    			"error": "0"
    		}
    	},
    	"xAxis": {
    		"dataField": "dateTime",
    		"type": "date",
    		"baseUnit": "minute",
    		"valuesOnTicks": true,
    		"unitInterval": 114.99999999999999
    	},
    	"valueAxis": {
    		"unitInterval": 100,
    		"minValue": 0,
    		"maxValue": 1000,
    		"title": {
    			"text": "<br>"
    		},
    		"flip": false
    	},
    	"colorScheme": "scheme03",
    	"seriesGroups": [
    		{
    			"type": "line",
    			"series": [
    				{
    					"dataField": "capacityDL",
    					"displayText": "capacity download"
    				},
    				{
    					"dataField": "currentDL",
    					"displayText": "current download"
    				}
    			]
    		}
    	]
    }

    I’m wondering if the extra fields at the end of the JSON (hul,hdl,hsig,error) are throwing something off?


    shawn
    Participant

    Follow up:

    Removing the extra fields did the trick.

    var pJson=json.rData;
    
    // prepare the data
    var source =
    {
        datatype: "json",
        datafields: [
    		{ name: "autoID" },
    		{ name: "rid" },
    		{ name: "capacityDL" },
    		{ name: "capacityUL" },
    		{ name: "currentDL" },
    		{ name: "currentUL" },
    		{ name: "signal" },
    		{ name: "dateTime", type: "date", format: "MM/dd/yyyy HH:mm:ss" },
    		{ name: "benchDL" },
    		{ name: "benchUL" },
    		{ name: "benchSignal" }
        ],
        localdata: pJson,
        root: 0
    };

    Hristo
    Participant

    Hello shawn,

    I assume that this case has been resolved?
    Also, you could try to use the rData” value for the root member.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.