Highcharts is really awesome. If you need to neat looking charts, this is the answer.
I faced a bit problem with setting the X Axis date format to stick with Month-Year format. That is because Highcharts automatically adjust the best possible date range. To maintain the date range to monthly (Month-Year format), is by using tick interval configuration.
To get monthly date range, set the tick interval to approximately one month, so the value is: 31* 24 * 3600 * 1000.
If Highcharts' Licensing does not fit you, then take a look at jqPlot. Not as fancy as Highcharts, but in my opinion it's the best for totally free js charting solution.
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Thursday, October 6, 2011
Tuesday, January 19, 2010
Serialize Form to JSON
I came across a handy javascript function to serialize form to JSON, taken from here
add above script to your document, then if you are using jQuery you can just do something like the following:
and as per need, simply use json2.js to convert the (JSON) form object into string:
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
add above script to your document, then if you are using jQuery you can just do something like the following:
$("form#data").serializeObject();
and as per need, simply use json2.js to convert the (JSON) form object into string:
JSON.stringify($("form#invite_users").serializeObject());
Subscribe to:
Posts (Atom)