Code:
Ext.define('MyApp.view.charts.line.Basic', {
extend: 'Ext.Panel',
xtype: 'line-chart',
title: 'Prototype Display for Aircraft Flight Times',
draggable: true,
resizeable: true,
tools:[{
type:'search',
tooltip: 'Undo Zoom',
handler: function(event, toolEl, panelHeader) {
var chart = Ext.getCmp('timechart'),
interaction = chart && Ext.ComponentQuery.query('interaction', chart)[0],
undoButton = interaction && interaction.getUndoButton(),
handler = undoButton && undoButton.handler;
if (handler) {
handler();
}
}
}],
initComponent: function() {
var me = this;
this.myDataStore = Ext.create('Ext.data.JsonStore', {
fields: [
{name: 'ACTUAL_DATE', type: 'date', dateFormat: 'd-m-y'},
{name: 'HRS', type: 'int'}
],
proxy: {
type: 'ajax',
url : 'app/store/charts/airTime.php',
reader: {
type: 'json'
}
},
autoLoad: true
});
me.items = [{
xtype: 'cartesian',
id: 'timechart',
width: '100%',
height: 500,
store: this.myDataStore,
insetPadding: 40,
interactions: {
type: 'crosszoom',
zoomOnPanGesture: false
},
axes: [{
type: 'numeric',
position: 'left',
grid: true,
fields: ['HRS'],
renderer: function (v) { return v; },
minimum: 480000,
maximum: 660000
}, {
type: 'time',
step: [Ext.Date.MONTH, 2],
dateFormat: 'd-m-y',
groupBy: 'year,month,day',
position: 'bottom',
grid: true,
fields: ['ACTUAL_DATE'],
fromDate: new Date('1/1/00'),
toDate: new Date('7/1/13'),
label: {
rotate: {
degrees: -90
}
}
}],
series: [{
type: 'line',
axis: 'left',
xField: 'ACTUAL_DATE',
yField: 'HRS',
style: {
lineWidth: 4
},
marker: {
radius: 2
}
}]
}];
this.callParent();
}
});
Aucun commentaire:
Enregistrer un commentaire