87,992
社区成员
发帖
与我相关
我的任务
分享
/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
Ext.chart.Chart.CHART_URL = '../../resources/charts_2.8.swf';
var graphPanelHeight = 220;
var eTradingGridWidth = 1500;
var count = 5;
var width=eTradingGridWidth/(count);
Ext.onReady(function(){
var eTradingGraphPanelLevel1 = new Ext.Panel({
title:"outer",
id: 'eTradingGraphsLevel1',
renderTo: 'level1',
width: eTradingGridWidth,
height: graphPanelHeight+50,
layout: 'column',
footer: true
});
});
function createPanel(){
document.getElementById('level2').innerHTML="<div id=\"container\">";
var eTradingGraphPanel = new Ext.Panel({
id: 'eTradingGraphs',
renderTo: 'container',
width: eTradingGridWidth,
height: graphPanelHeight+50,
layout: 'column',
footer: true
});
function pupolateData(){
var data = [];
for(var i=0;i<8;i++){
//alert(Math.random());
data[i] ={
name:'Jul 0'+(i+1),
visits: Math.random()*10+30,
views: Math.random()*20+10,
sampleData1: Math.random()*10+20,
sampleData2: Math.random()*15+5
};
}
return data;
}
// extra extra simple
for(var i =0;i<count;i++){
var store = new Ext.data.JsonStore({
fields:['name', 'visits', 'views','sampleData1','sampleData2'],
data: pupolateData()
});
if(i==count-1)width=width-5;
var panel = new Ext.Panel({
iconCls:'chart',
title: 'ExtJS.com Visits and Pageviews, 2007/2008 (Full styling)',
frame:true,
//renderTo: 'container',
width:width,
height:graphPanelHeight,
//layout:'fit',
items: {
xtype: 'linechart',
store: store,
url:'../../resources/charts.swf',
xField: 'name',
yAxis: new Ext.chart.NumericAxis({
displayName: 'Visits',
labelRenderer : Ext.util.Format.numberRenderer('0,0')
}),
extraStyle: {
legend: {
display: 'bottom',
font: {
name: 'Tahoma',
color: 0x15428B,
size: 10,
bold: true
}
}
},
tipRenderer : function(chart, record, index, series){
if(series.yField == 'visits'){
return Ext.util.Format.number(record.data.visits, '0,0') + ' visits in ' + record.data.name;
}else{
return Ext.util.Format.number(record.data.views, '0,0') + ' page views in ' + record.data.name;
}
},
chartStyle: {
animationEnabled: true,
font: {
name: 'Tahoma',
color: 0x444444,
size: 11
},
dataTip: {
padding: 5,
border: {
color: 0x99bbe8,
size:1
},
background: {
color: 0xDAE7F6,
alpha: .9
},
font: {
name: 'Tahoma',
color: 0x15428B,
size: 10,
bold: true
}
},
xAxis: {
color: 0x69aBc8,
majorTicks: {color: 0x69aBc8, length: 4},
minorTicks: {color: 0x69aBc8, length: 2},
majorGridLines: {size: 1, color: 0xeeeeee}
},
yAxis: {
color: 0x69aBc8,
majorTicks: {color: 0x69aBc8, length: 4},
minorTicks: {color: 0x69aBc8, length: 2},
majorGridLines: {size: 1, color: 0xdfe8f6}
}
},
series: [{
type: 'line',
displayName: 'Page Views',
yField: 'views',
style: {
image:'bar.gif',
mode: 'stretch',
color:0x99BBE8
}
},{
type:'line',
displayName: 'Visits',
yField: 'visits',
style: {
color: 0x15428B
}
},{
type:'line',
displayName: 'Sample Data',
yField: 'sampleData1',
style: {
color: 0x99B28B
}
},{
type:'line',
displayName: 'Sample Data',
yField: 'sampleData2',
style: {
color: 0x98B9B2
}
}]
}
});
eTradingGraphPanel.add(panel);
}
eTradingGraphPanel.doLayout();
}