Comments (11)
Below is the Ajax request I am making. Any clues where it goes wrong?
$.ajax({
type: "POST",
url: "MY-SERVER",
datatype: 'json',
complete: function(data){
totaldata = JSON.parse(data.responseText);
appointmentsdata = totaldata.appointments;
droppedappointmentsdata = totaldata.droppedappointments;
$.each(appointmentsdata, function() {
this.date = new Date(this.date.toString());
this.value = parseInt(this.value);
});
$.each(droppedappointmentsdata, function() {
this.date = new Date(this.date.toString());
this.value = parseInt(this.value);
});
options = {
'width': '100%',
'height': '250px'
};
totalappointments = {
'label': 'Appointments',
'data': appointmentsdata
};
totaldroppedappointments = {
'label': 'Dropped Appointments',
'data': droppedappointmentsdata
};
graph = new links.Graph(document.getElementById('mygraph'));
graph.draw([totalappointments, totaldroppedappointments], options);
},
error: function(){
return false;
}
});
from chap-links-library.
The tooltips being shown show a value of 3 as 3.000
from chap-links-library.
The separate datasets may have differing time series, though each dataset is supposed to be ordered in time.
Can you give a (small) example of the data that you retrieve from your server?
from chap-links-library.
Hello, thanks for the reply.
Here is the data being retreived.
{"appointments":[{"date":"2012 11 29","value":1},{"date":"2012 11 27","value":1},{"date":"2012 11 25","value":5},{"date":"2012 11 23","value":2},{"date":"2012 11 22","value":1},{"date":"2012 11 21","value":2},{"date":"2012 11 20","value":3},{"date":"2012 11 19","value":4},{"date":"2012 11 18","value":1},{"date":"2012 11 15","value":5},{"date":"2012 11 14","value":1},{"date":"2012 11 05","value":7},{"date":"2012 11 04","value":1},{"date":"2012 10 30","value":4},{"date":"2012 10 29","value":3},{"date":"2012 10 28","value":1},{"date":"2012 10 27","value":1},{"date":"2012 10 22","value":4},{"date":"2012 10 16","value":2},{"date":"2012 10 15","value":1},{"date":"2012 10 14","value":1},{"date":"2012 10 12","value":9},{"date":"2012 10 10","value":2},{"date":"2012 10 09","value":1},{"date":"2012 10 08","value":2},{"date":"2012 10 07","value":1},{"date":"2012 10 06","value":2},{"date":"2012 10 05","value":1},{"date":"2012 10 03","value":1},{"date":"2012 10 02","value":1},{"date":"2012 10 01","value":2},{"date":"2012 10 01","value":1},{"date":"2012 09 30","value":2},{"date":"2012 09 27","value":1},{"date":"2012 09 26","value":1},{"date":"2012 09 25","value":1},{"date":"2012 09 24","value":2},{"date":"2012 09 23","value":2},{"date":"2012 09 22","value":1},{"date":"2012 09 20","value":4},{"date":"2012 09 19","value":2},{"date":"2012 09 18","value":1},{"date":"2012 09 17","value":3},{"date":"2012 09 16","value":5},{"date":"2012 09 15","value":13},{"date":"2012 09 13","value":10}],"droppedappointments":[{"date":"2012 11 21","value":"3"},{"date":"2012 11 19","value":"8"},{"date":"2012 11 18","value":"1"},{"date":"2012 11 15","value":"3"},{"date":"2012 11 04","value":"1"},{"date":"2012 10 28","value":"1"},{"date":"2012 10 22","value":"10"},{"date":"2012 10 16","value":"2"},{"date":"2012 10 15","value":"16"},{"date":"2012 10 07","value":"3"},{"date":"2012 10 03","value":"2"},{"date":"2012 10 02","value":"2"},{"date":"2012 09 27","value":"1"},{"date":"2012 09 26","value":"6"},{"date":"2012 09 25","value":"4"}]}
Basically 2 arrays in JSON namely appointments and droppedappointments
{"appointments":[{"date":"2012 11 29","value":1}],"droppedappointments":[{"date":"2012 11 21","value":"3"}]}
Any tips? Thanks in advance!
from chap-links-library.
I see that in one array the value is in quotes and in the other it isn't although it isn't the reason. I rectified and tested it with both types equal. With and without parseInt().
It seems like a Date related error. It's even happening in the Timeline - it simply does not run in IE8.
Just want to let you know that your help is greatly appreciated!
from chap-links-library.
Can IE handle a date like "2012 11 29"? I have never seen/used this date format before (A date is typically "2012-11-29").
The dates in your data seem to be in descending order, while the Graph expects dates in ascending (chronological) order. Maybe that is causing the problem?
from chap-links-library.
Oh is it - I will check try the suggestion and get back very soon.
Thanks a lot again!
On 28-Dec-2012, at 12:30 AM, Jos de Jong [email protected] wrote:
Can IE handle a date like "2012 11 29"? I have never seen/used this date format before (A date is typically "2012-11-29").
The dates in your data seem to be in descending order, while the Graph expects dates in ascending (chronological) order. Maybe that is causing the problem?
—
Reply to this email directly or view it on GitHub.
from chap-links-library.
Tooltips now work. Your suggestion of ASC dates and format was perfect!
The table tag needs to be closed in line 2028
label.innerHTML = '<table>' +
'<tr><td>Date:</td><td>' + dataPoint.date + '</td></tr>' +
'<tr><td>Value:</td><td>' + dataPoint.value + '</td></tr>';
Also while passing values as {"date":"2012-09-13","value":"10"}
toPrecision() throws an error - so I removed it from the table data and from the function links.Graph.StepNumber.prototype.getCurrent
Sad though no error is shown in IE - neither is the graph.
from chap-links-library.
There is a JSON.parse error on IE. The error is resolved using json.js or json2.js - the graph shows up - but the data is not drawn
I have even tried this script - http://code.google.com/p/json-sans-eval/
Same - graph is there - data not drawn. I bet there is some encoding problem.
Found out - IE cannot parse date
this.date = new Date(this.date.toString());
from chap-links-library.
SOLVED.
I am using the script mentioned above (http://code.google.com/p/json-sans-eval/) and after it doing this.
Parsing the JSON as
totaldata = jsonParse(data.responseText);
$.each(appointmentsdata, function() {
this.date = Date.parse(this.date.toString());
this.value = parseInt(this.value);
});
Works seamlessly till IE7
from chap-links-library.
Glad it is working now. I have fixed the unclosed table element, thanks.
from chap-links-library.
Related Issues (20)
- chap links timeline customisation HOT 3
- Start and group after double click HOT 7
- Timeline - Wrong item top position with empty group HOT 3
- Network - How can I fire an event on node/link selection HOT 1
- Timeline - Set custom time with click HOT 2
- Can't scroll vertically when on mobile HOT 1
- (timeline) fix top and group axis left to scroll down with touch - Question HOT 12
- zoomin and zoomout feature not working in chaps link library timeline slider HOT 1
- On executing draw/redraw the slider not rendering after first time calling the draw method of chaps link library timeline. HOT 1
- 1 month offset in timeline HOT 2
- Destroy method for timeline
- Drag and Drop from external events
- Time limit
- Input textbox not working.
- Timeline "isSelected" and "unselectItem" don't work with clusters
- Can't load graphs while running GWT projects, but it runs with JS version
- graph3d.js enhancements HOT 1
- Stacking not always working
- B.C. Dates possible?
- Keep -dump output pristine
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chap-links-library.