Skip to content

Commit

Permalink
Support ExtJs 5 and Solid Gauge series
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe authored and Joe committed Sep 14, 2014
1 parent 1c6a2c7 commit 79d0920
Show file tree
Hide file tree
Showing 115 changed files with 4,742 additions and 112 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ver 3.1.0
- Support ExtJs 5
- Demo now refers ExtJs CDN

ver 3.0.2
- Minor fix and improve how series object create

Expand Down
37 changes: 19 additions & 18 deletions Chart/ux/Highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* @author
* Joe Kuan <[email protected]>
*
* version 3.0.2
* version 3.1.0
*
* <!-- You are not permitted to remove the author section (above) from this file. -->
*
* Documentation last updated: 28 May 2014
* Documentation last updated: 14 Sept 2014
*
* A much improved & ported from ExtJs 3 Highchart adapter.
*
* - Supports the latest Highcharts
* - Supports the latest Highcharts 5
* - Supports both Sencha ExtJs 4 and Touch 2
* - Supports Highcharts animations
* - Supports Highmaps
Expand Down Expand Up @@ -188,7 +188,7 @@ Ext.define("Chart.ux.Highcharts", {
* @static
* Version string of the current Highcharts extension
*/
version: '3.0.2',
version: '3.1.0',

/***
* @property {Object} sencha
Expand Down Expand Up @@ -230,7 +230,7 @@ Ext.define("Chart.ux.Highcharts", {
* @property {Boolean} debug
* Switch on the debug logging to the console
*/
debug: true,
debug: false,

switchDebug : function() {
this.debug = true;
Expand Down Expand Up @@ -355,7 +355,6 @@ Ext.define("Chart.ux.Highcharts", {
afterChartRendered: null,

constructor: function(config) {
console.log(config);
config.listeners && (this.afterChartRendered = config.listeners.afterChartRendered);
this.afterChartRendered && (this.afterChartRendered = Ext.bind(this.afterChartRendered, this));
if (config.animation == false) {
Expand Down Expand Up @@ -651,17 +650,19 @@ console.log(config);
}
}

for( i = 0; i < _this.series.length; i++) {
if(!_this.series[i].visible)
_this.chart.series[i].hide();
}
if (Ext.isArray(_this.series)) {
for( i = 0; i < _this.series.length; i++) {
if(!_this.series[i].visible)
_this.chart.series[i].hide();
}

// Refresh the data only if it is not loading
// no point doing this, as onLoad will pick it up
if (this.store && !this.store.isLoading()) {
this.log("Call refresh from draw");
this.refresh();
}
// Refresh the data only if it is not loading
// no point doing this, as onLoad will pick it up
if (this.store && !this.store.isLoading()) {
this.log("Call refresh from draw");
this.refresh();
}
}
},

/***
Expand Down Expand Up @@ -813,9 +814,10 @@ console.log(config);
serie.bindRecord && (point.record = record);
data[i].push(point);
}
} else if (serie.type == 'gauge') {
} else if (serie.type == 'gauge' || serie.type == 'solidgauge') {
// Gauge is a dial type chart, so the data can only
// have one value
console.log(record);
data[i][0] = serie.getData(record, x);
} else if (serie.data && serie.data.length) {
// This means the series is added within its own data
Expand Down Expand Up @@ -1016,7 +1018,6 @@ console.log(config);
if(!this.updateTask) {
this.updateTask = new Ext.util.DelayedTask(this.draw, this);
}
console.log("update delay " + cdelay);
this.updateTask.delay(cdelay);
},

Expand Down
44 changes: 31 additions & 13 deletions Chart/ux/Highcharts/Serie.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,33 +289,51 @@ Ext.define('Chart.ux.Highcharts.Serie', {
serieCls : true,

constructor : function(config) {

var sencha = Chart.ux.Highcharts.sencha;

config.type = this.type;
if(!config.data) {
config.data = [];
}

this.mixins.observable.constructor.call(this, config);

this.addEvents(
/**
* @event pointclick
* Fires when the point of the serie is clicked.
* @param {Chart.ux.Highcharts.Serie} serie the serie where is fired
* @param {Object} point the point clicked
* @param {Ext.data.Record} record the record associated to the point
* @param {Object} evt the event param
*/
'pointclick'
);

// Sencha Touch initialises fields differently
if (Chart.ux.Highcharts.sencha.product == 't') {
if (sencha.product == 't') {
config.xField && (this.xField = config.xField);
config.yField && (this.yField = config.yField);
config.zField && (this.zField = config.zField);
config.dataIndex && (this.dataIndex = config.dataIndex);

this.addEvents(
/**
* @event pointclick
* Fires when the point of the serie is clicked.
* @param {Chart.ux.Highcharts.Serie} serie the serie where is fired
* @param {Object} point the point clicked
* @param {Ext.data.Record} record the record associated to the point
* @param {Object} evt the event param
*/
'pointclick'
);

} else {
// addEvents is deprecated in ExtJs 5.0 and raise error
(sencha.major < 5) && this.addEvents(
/**
* @event pointclick
* Fires when the point of the serie is clicked.
* @param {Chart.ux.Highcharts.Serie} serie the serie where is fired
* @param {Object} point the point clicked
* @param {Ext.data.Record} record the record associated to the point
* @param {Object} evt the event param
*/
'pointclick'
);
}


this.config = config;

this.yField = this.yField || this.config.dataIndex;
Expand Down
17 changes: 17 additions & 0 deletions Chart/ux/Highcharts/SolidGaugeSerie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Serie class for solid gauge series type
*
* See {@link Chart.ux.Highcharts.Serie} class for more info
*
* SolidGauge series is a one dimensional series type, i.e only y-axis data
*/
Ext.define('Chart.ux.Highcharts.SolidGaugeSerie', {
extend : 'Chart.ux.Highcharts.Serie',
alternateClassName: [ 'highcharts.solidgauge' ],
type : 'solidgauge'

/***
* @cfg xField
* @hide
*/
});
4 changes: 4 additions & 0 deletions desktop.extjs5/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#banner .x-panel-header {
padding-left: 10px;
}

104 changes: 104 additions & 0 deletions desktop.extjs5/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
Ext.Loader.setConfig({
enabled : true,
disableCaching : true, // For debug only
paths : {
// 'Chart' : HOME + '/highcharts_extjs4' // For website
'Chart' : '../Chart'
}
});

Ext.require('Chart.ux.Highcharts');
Ext.require('Chart.ux.Highcharts.Serie');
Ext.require('Chart.ux.Highcharts.AreaRangeSerie');
Ext.require('Chart.ux.Highcharts.AreaSerie');
Ext.require('Chart.ux.Highcharts.AreaSplineRangeSerie');
Ext.require('Chart.ux.Highcharts.AreaSplineSerie');
Ext.require('Chart.ux.Highcharts.BarSerie');
Ext.require('Chart.ux.Highcharts.BoxPlotSerie');
Ext.require('Chart.ux.Highcharts.BubbleSerie');
Ext.require('Chart.ux.Highcharts.ColumnRangeSerie');
Ext.require('Chart.ux.Highcharts.ColumnSerie');
Ext.require('Chart.ux.Highcharts.ErrorBarSerie');
Ext.require('Chart.ux.Highcharts.FunnelSerie');
Ext.require('Chart.ux.Highcharts.GaugeSerie');
Ext.require('Chart.ux.Highcharts.SolidGaugeSerie');
Ext.require('Chart.ux.Highcharts.LineSerie');
Ext.require('Chart.ux.Highcharts.PieSerie');
Ext.require('Chart.ux.Highcharts.RangeSerie');
Ext.require('Chart.ux.Highcharts.ScatterSerie');
Ext.require('Chart.ux.Highcharts.SplineSerie');
Ext.require('Chart.ux.Highcharts.WaterfallSerie');
Ext.require('Chart.ux.Highcharts.PyramidSerie');

// ALWAYS POST!!
Ext.override(Ext.data.proxy.Ajax,{
getMethod: function(request) {
return 'POST';
}
});

Ext.ns("Demo");

Ext.application({
name : 'Highcharts',
// appFolder : HOME + '/demos/Highcharts_ExtJs_4/app', // For website
appFolder : 'app',
controllers : ['Charts'],
requires: [
'Highcharts.ChartsDesktopConfig'
],
launch : function() {

// For joekuan.org website
if (Ext.get('loading-mask'))
Ext.get('loading-mask').fadeOut({remove:true});

var title = 'ExtJs version: ' + Ext.versions.core.version + ", " +
'Highcharts version: ' + Highcharts.version + ", " +
'Chart.ux.Highchart: ' + Chart.ux.Highcharts.version;

Ext.create('Ext.container.Viewport', {
layout : 'border',
border : '5 5 5 5',
title: title,
listeners: {
close: function(window) {
$("#layerslider", parent.document.body).slideDown(400, function() {
$('#demo', parent.document.body).html('');
});
}
},
items : [{
region: 'north',
title: title,
border: true
}, {
region : 'west',
width : 200,
title : 'Charts',
id: 'leftTree',
xtype : 'chartsTree',
margins : '0 0 5 5',
split: true
}, {
region : 'center',
id : 'centerpane',
xtype : 'panel',
layout : 'fit',
margins : '0 5 5 0',
tbar : [{
text : 'Reload Data',
id : 'reload',
disabled : true,
action: 'reload'
}, {
text: 'Add Series',
id: 'addSeries',
disabled: true,
action: 'addSeries'
}]
}]
}).show();

}
});
Loading

0 comments on commit 79d0920

Please sign in to comment.