此圖表用于以線圖格式表示數(shù)據(jù)。 它是一個(gè)笛卡爾圖表。
這里是簡(jiǎn)單的語法。
Ext.create('Ext.chart.CartesianChart',{
series: [{
type: 'line',
xField: 'name',
yField: 'G1'
}]
render, legend and other properties
});
下面是一個(gè)簡(jiǎn)單的例子顯示用法。
<!DOCTYPE html>
<html>
<head>
<link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
<script src="./ext-6.0.0/build/ext-all.js"></script>
<script src="./ext-6.0.0/build/packages/charts/classic/charts.js"></script>
<link href="./ext-6.0.0/build/packages/charts/classic/classic/resources/charts-all.css" rel="stylesheet" />
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.chart.CartesianChart', {
renderTo: document.body,
width: 600,
height: 200,
store: {
fields: ['name', 'g1', 'g2'],
data: [
{"name": "Item-0", "g1": 57, "g2": 59},
{"name": "Item-1", "g1": 45, "g2": 50},
{"name": "Item-2", "g1": 67, "g2": 43},
{"name": "Item-3", "g1": 45, "g2": 18},
{"name": "Item-4", "g1": 30, "g2": 90}
]
},
legend: {
docked: 'bottom'
},
//define x and y axis.
axes: [{
type: 'numeric',
position: 'left'
}, {
type: 'category',
visibleRange: [0, 1],
position: 'bottom'
}],
//define the actual series
series: [{
type: 'line',
xField: 'name',
yField: 'g1',
title: 'Normal'
}, {
type: 'line',
xField: 'name',
yField: 'g2',
title: 'Smooth'
}]
});
});
</script>
</head>
<body>
</body>
</html>
這將產(chǎn)生以下結(jié)果
更多建議: