1
我正在使用extjs 4.2.2圖表。我的要求是顯示折線圖也希望顯示節點中的值。在我看到的一些帖子中,可以使用Series標籤完成。不知何故,它不顯示節點或數據點中的值。以下是圖表代碼。EXTJS 4.2.2在數據點處顯示值的折線圖
items : [ {
xtype : 'chart',
// renderTo : Ext.getBody(),
width : 1600,
animate : true,
height : 400,
shadow : true,
// theme: 'Category2',
store : 'SWeatherPoint',
axes : [ {
title : 'Temperature',
type : 'Numeric',
position : 'left',
fields : [ 'temperature' ],
minimum : 0,
maximum : 100,
minorTickSteps : 1,
// grid: true
grid : {
odd : {
opacity : 1,
fill : '#ddd',
stroke : '#bbb',
'stroke-width' : 0.5
}
}
}, {
title : 'Day of the Month',
type : 'Time',
position : 'bottom',
fields : [ 'date' ],
dateFormat : 'M d',
constrain : true,
fromDate : new Date('1/1/07'),
toDate : new Date('1/30/07'),
grid : true
} ],
series : [ {
type : 'line',
xField : 'date',
yField : 'temperature',
highlight : {
size : 7,
radius : 7
},
axis : 'left',
smooth : true,
fill : true,
label : {
// display : 'under', // or 'rotate'
field : 'temperature',
renderer : function(label, storeItem, item, i, display, animate, index) {
console.log(this);
console.log(item.get('temperature')+''+item+'' + i+''+display+ ''+index);
return String(item.get('temperature'));
}
},
tips : {
trackMouse : true,
width : 200,
height : 28,
renderer : function(storeItem, item) {
this.setTitle(storeItem.get('temperature') + ': '
+ storeItem.get('date') + ' views');
}
},
style : {
fill : '#18428E',
stroke : '#18428E',
'stroke-width' : 3,
'stroke-dasharray' : 10
// You need to add this!
},
markerConfig : {
type : 'circle',
size : 4,
radius : 4,
'stroke-width' : 0,
fill : '#18428E',
stroke : '#18428E'
}
} ]
如果有人能指出問題,這將會有所幫助。
感謝, 阿米特
提示適合我。我想要的東西不僅會在鼠標懸停到數據點時不斷顯示圖形中的「溫度」。在系列組件中,我爲此目的添加了一個lebel。但它不顯示數據點的溫度值。 – Dutta
啊。得到它了。必須運行,但這看起來很有希望: http://stackoverflow.com/questions/20216570/i-want-to-show-node-value-in-extjs-4-line-chart – JesseRules
謝謝傑西..我已經訪問線程...我嘗試了他們提到的方式,但沒有運氣 – Dutta