PDA

View Full Version : [FIXED] Requires for Ext.chart.*



AussieFlem
20 Apr 2015, 3:19 AM
When opening an existing project with Ext.chart objects, the require management is removing any chart related classes, and does not auto-add them when you add charts, axes, series etc.

I presume that charts are not supported (yet) - or is there a config option somewhere?

Mark.Brocato
20 Apr 2015, 8:45 AM
There must be a bug in the way the plugin detects references to chart classes. Can you include a code snippet that illustrates the problem? I might be able to get it fixed for 0.2.

AussieFlem
26 Apr 2015, 8:24 PM
/**
* This class is the main view for the application. It is specified in app.js as the
* "autoCreateViewport" property. That setting automatically applies the "viewport"
* plugin to promote that instance of this class to the body element.
*
* TODO - Replace this content of this view to suite the needs of your application.
*/
Ext.define('SenchaBugs.view.main.Main', {
extend: 'Ext.container.Container',
requires: [
'SenchaBugs.view.main.MainController',
'SenchaBugs.view.main.MainModel',
'Ext.chart.CartesianChart',
'Ext.chart.interactions.PanZoom',
'Ext.chart.axis.Numeric',
'Ext.chart.axis.Category',
'Ext.chart.series.Area'
],


xtype: 'app-main',


controller: 'main',
viewModel: {
type: 'main'
},


layout: {
type: 'border'
},


items: [
{
region: 'center',
xtype: 'tabpanel',
items: [
{
xtype: 'chart',
title: 'Chart 1',
store: {
fields: ['name', 'g1', 'g2'],
data: [
{"name": "Item-0", "g1": 18.34, "g2": 0.04},
{"name": "Item-1", "g1": 2.67, "g2": 14.87},
{"name": "Item-2", "g1": 1.90, "g2": 5.72},
{"name": "Item-3", "g1": 21.37, "g2": 2.13},
{"name": "Item-4", "g1": 2.67, "g2": 8.53},
{"name": "Item-5", "g1": 18.22, "g2": 4.62},
{"name": "Item-6", "g1": 28.51, "g2": 12.43},
{"name": "Item-7", "g1": 34.43, "g2": 4.40},
{"name": "Item-8", "g1": 21.65, "g2": 13.87},
{"name": "Item-9", "g1": 12.98, "g2": 35.44},
{"name": "Item-10", "g1": 22.96, "g2": 38.70},
{"name": "Item-11", "g1": 0.49, "g2": 51.90},
{"name": "Item-12", "g1": 20.87, "g2": 62.07},
{"name": "Item-13", "g1": 25.10, "g2": 78.46},
{"name": "Item-14", "g1": 16.87, "g2": 56.80}
]
},


interactions: {
type: 'panzoom'
},


legend: {
docked: 'right'
},


axes: [
{
type: 'numeric',
position: 'left',
grid: true
},
{
type: 'category',
position: 'bottom',
visibleRange: [0, 0.4]
}
],


series: [
{
type: 'area',
xField: 'name',
yField: ['g1', 'g2'],
title: ['G1', 'G2'],
style: {
stroke: '#666666',
fillOpacity: 0.8
}
}
]
}
]
}
]
});


This works - generated app with the chart example from the Guides (and minor cleanup of redundant stuff for the sake of the example).

Turn on the plugin management of requires and requires: changes to:





requires: [
'SenchaBugs.view.main.MainController',
'SenchaBugs.view.main.MainModel',
'Ext.layout.container.Border',
'Ext.tab.Panel',
'Ext.chart.series.Cartesian'
],


Interestingly it does keep the cartesian series, but doesn't see the rest of the chart elements as required.

And I do have:


"requires": [
"sencha-charts"
],


set in app.json...

AussieFlem
4 May 2015, 5:57 AM
Hi Mark - just checking you saw that I'd posted the requested code example.

Cheers :)

Mark.Brocato
5 May 2015, 7:21 AM
Thanks AussieFlem! I have opened a bug in our bug tracker. Also I just fixed it in development so it should be in the 0.3 release which will most likely be out next week.