我花了几天时间试图解决这个问题:
我正在尝试创建一个包含多个系列的图表。在一个系列中,我展示了一条包含所有点的线(在我的代码“val”系列中)。在第二个系列中,我希望只显示部分点(“温度”系列)。这两个系列都显示了 int 数据类型。
我试图为“温度”字段设置一个非常低的值,以便从图表中省略它,但它也导致相应的“val”被跳过!
在 ExtJs 4.1.1 中:“val”字段的 10am 值被跳过。
在 ExtJs 4.0.7 中:“val”字段的 10am 值存在!
(我希望我可以在这里发布图片,但我没有 10 个声望点。:-( )
这是我的代码:
Ext.define('WeatherPoint', {
extend: 'Ext.data.Model',
fields: ['temperature', 'date', 'val']
});
var store1 = Ext.create('Ext.data.Store', {
model: 'WeatherPoint',
data: [
{ temperature: 58, date: new Date(2011, 1, 1, 8), val: 10 },
{ temperature: 63, date: new Date(2011, 1, 1, 9), val: 20 },
{ temperature: -100, date: new Date(2011, 1, 1, 10), val: 40 },
{ temperature: 78, date: new Date(2011, 1, 1, 11), val: 90 },
{ temperature: 81, date: new Date(2011, 1, 1, 12), val: 50 }
]
});
var chart1 = Ext.create('Ext.chart.Chart',{
xtype: 'chart',
animate: false,
store: store1,
legend: true,
insetPadding: 30,
axes: [{
title: 'Temperature',
type: 'Numeric',
position: 'left',
fields: ['temperature', 'val'],
minimum: 0,
maximum: 100
}, {
title: 'Time',
type: 'Time',
position: 'bottom',
fields: ['date'],
dateFormat: 'ga',
step: [Ext.Date.HOUR, 1],
fromDate: new Date(2011, 1, 1, 8),
toDate: new Date(2011, 1, 1, 12)
}],
series: [{
type: 'scatter',
axis: ['left','bottom'],
xField: 'date',
yField: 'temperature'
}, {
type: 'line',
title: 'val',
axis: ['left','bottom'],
xField: 'date',
yField: 'val'
}]
});
var panel1 = Ext.create('widget.panel', {
width: 600,
height: 400,
renderTo: Ext.getBody(),
layout: 'fit',
items: chart1
});
- 为什么 4.1.1 由于一个系列中的值超出范围而使所有系列都跳过?
- 如何仅显示一个系列中的部分点而第二个系列中的所有点?