View Full Version : problem with chart

29 Jul 2013, 2:20 AM
I'm sorry for my bad english, I'm using Google Translate, I'm trying to insert a chart into a panel, but there is an error that does not make me open the window.

{title: 'Main Content',
items: [{
/*xtype: 'chart',
animate: false,
renderTo: Ext.getBody(),
width: 400,
height: 300,
store: store,
axes: [
title: 'Temperature',
type: 'Numeric',
position: 'left',
fields: ['temperature'],
minimum: 0,
maximum: 100
title: 'Time',
type: 'Time',
position: 'bottom',
fields: ['date'],
dateFormat: 'ga'
series: [
type: 'line',
xField: 'date',
yField: 'temperature'
theme: 'Green'*/


}, {
title: 'Histogram',

html: 'Content for Histogram Tab'
}, {
title: 'Cross Section',
html: 'Content for Cross Section Tab'

Ext.define('WeatherPoint', {
extend: 'Ext.data.Model',
fields: ['temperature', 'date']

});var store = Ext.create('Ext.data.Store', {
model: 'WeatherPoint',
data: [
{ temperature: 58, date: new Date(2011, 1, 1, 8) },
{ temperature: 63, date: new Date(2011, 1, 1, 9) },
{ temperature: 73, date: new Date(2011, 1, 1, 10) },
{ temperature: 78, date: new Date(2011, 1, 1, 11) },
{ temperature: 81, date: new Date(2011, 1, 1, 12) }


I have not included all the code because it was long, if you want, I can insert it after all.
I put only the final part of the code, that is the part that gives me error if I remove the code comments.
I know that with the comments, you open the window, but if I try to remove the comments, the window does not work anymore
I do not understand what is wrong.
I ask again sorry for my english, I think I wrote strange things XD

29 Jul 2013, 4:06 AM
you should remove renderTo: Ext.getBody() line because it will be rendered inside your center region automatically. That might be causing the problem.

Also, you dont need to insert chart inside another panel (this causes one extra encapsulation than required). Since chart is itself a panel, you can just use the chart as the center region.