PDA

View Full Version : Help for Highcharts Adapter Extension



talha06
10 Apr 2010, 8:59 AM
Hi everyone,

I'm trying to use Highcharts Adapter Extension (http://www.extjs.com/forum/showthread.php?93669-Highcharts-adapter-and-plugin-for-ExtJS) that takes data from DB.
First of all I want to learn that can I use this extension with data from DB?

If I can, here's my configuration; can someone help me to explore my mistake :


var chartRecord = new Ext.data.Record.create([{
name: 'sayi',
type: 'int',
allowBlank: false
}]);
var chartStore = new Ext.data.JsonStore({
record : chartRecord,
fields : [{
name : 'sayi'
}],
url : 'chartStoreDoldur',
//autoDestroy : true,
autoLoad : true,
root : 'data',
idProperty : 'sayi'
});
Ext.override(Ext.data.Record, {
getJson: function () {
return Ext.util.JSON.encode(Ext.apply(this.data));
}
});

var data;
Ext.Ajax.request({
url : 'chartStoreDoldur',
method : 'GET',
//success : function(response, options) {
// data = eval("(" + response.responseText + ")");
//}
success : function(result, request) {
data = result.responseText;
}
});

var highPanel = new Ext.ux.HighchartPanelJson({
renderTo : document.body,
frame : true,
title : 'Personel Ya? Da??l?m Grafi?i',
layout : 'fit',
border : true,
id : 'myChart',
chartConfig: {
chart: {
defaultSeriesType: 'spline'
},
title: {
text: 'Personel Ya? Da??l?m?'
},
subtitle: {
text: 'Source: google.com'
},
xAxis: {
categories: ['15-20', '20-25', '25-30', '35-40', '40-45', '45+'],
title: {
text: 'Ya? Aral?klar?'
}
},
yAxis: {
title: {
text: 'Ki?i Say?s?'
}
},
tooltip: {
formatter: function() {
return '<b>' + this.x +'</b> aral???nda <br/><b>'+
this.y + '</b> ki?i var.';
}
},
legend: {
enabled : true
},
series: [
{
name: 'Ki?i Say?s?',
//data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
//dataURL : 'chartStoreDoldur',
data : chartStore
}
]
}
});

The data that I take from chartStore servlet is like this : (copy & paste from Firebug)


{"data":[{"sayi":2},{"sayi":17},{"sayi":2},{"sayi":2},{"sayi":3},{"sayi":3},{"sayi":0}]}

Thanx in advance,
With regards,
Talha

talha06
10 Apr 2010, 12:44 PM
aren't there anyone that used this extension with data from DB?? :-/