Sapui5 SAP UI5:在x轴上形成viz框架图
我目前正在试用带有sensortag的HCP。 Sensortag每60秒向HCP发送一次温度,图表运行良好。 唯一的问题是,我只看到图表中的最后30个值,因为时间戳是axis的值Sapui5 SAP UI5:在x轴上形成viz框架图,sapui5,Sapui5,我目前正在试用带有sensortag的HCP。 Sensortag每60秒向HCP发送一次温度,图表运行良好。 唯一的问题是,我只看到图表中的最后30个值,因为时间戳是axis的值 设置图表格式的可能性有哪些?我是否可以将这些数据值相加,使x轴显示为每小时f.e 例如,是否可以为每天添加第二行。 也就是说,颜色为1的数据点显示第1天的温度,颜色为2的数据点显示第2天的温度等,x轴显示从0到24的小时数 编辑: 好的,用以下代码格式化从x轴算起的小时数: Axis : { scale: { fi
编辑: 好的,用以下代码格式化从x轴算起的小时数:
Axis : { scale: { fixedRange : true, minValue : "0:00", maxValue : "24:00" } } –
因此,第2点。保持打开状态,如何设置度量值的格式
measures: [
{
name: "C_SENSORTEMP",
value: "{C_SENSORTEMP}"
},
{
name: "C_SENSORHUMIDITY",
value: "{C_SENSORHUMIDITY}"
}
],
谢谢大家
var vizFrame = new sap.viz.ui5.controls.VizFrame("graph").addStyleClass("sapUiSmallMarginBegin").addStyleClass("sapUiSmallMarginTop");
vizFrame.setWidth("900px");
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [
{
name: "Date",
value: {
path: "G_CREATED",
formatter: function(val){
if (val == null) {
return "string null";
}
var date = new Date(parseInt(val.substr(6,20)));
var dd = date.getDate();
var mm = date.getMonth()+1; //January is 0!
var yyyy = date.getFullYear();
var hr = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var fromdate1 = dd+'/'+mm+'/'+yyyy + " " + hr + ":" + min + ":" + sec;
return fromdate1;
}
}
}
],
measures: [
{
name: "C_SENSORTEMP",
value: "{C_SENSORTEMP}"
},
{
name: "C_SENSORHUMIDITY",
value: "{C_SENSORHUMIDITY}"
}
],
data: {
path: "/items"
}
});
vizFrame.setDataset(oDataset);
vizFrame.setVizType('line');
vizFrame.setVizProperties({
plotArea: {
colorPalette : ["#5cbae6", "#b6d957", "#fac364"]
},
categoryAxis: {
title: {
text: "Date/Time"
}
},
valueAxis: {
title: {
text: "temp/humidity"
}
},
title: {
visible:false
}
});
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis",
'type': "Measure",
'values': ["C_SENSORTEMP", "C_SENSORHUMIDITY"]
}),
feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "categoryAxis",
'type': "Dimension",
'values': ["Date"]
});
vizFrame.addFeed(feedValueAxis);
vizFrame.addFeed(feedCategoryAxis);
var container = new sap.m.VBox({
items: [vizFrame],
width: "100%",
height: "100%",
alignItems: "Center"
});
问题解决了:
1) omodel中有30个数据集的限制
2) xAxis比例值:
yAxis : {scale: {
fixedRange : true,
minValue : "15",
maxValue : "30"
}},
以颜色显示的每个日期的类别/组:
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name: "hour",value: "{hour}"},
name: "date", value: "{date}"}
...
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis",
'type': "Measure",
'values': ["SENSORTEMP"]
}),
feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "categoryAxis",
'type': "Dimension",
'values': ["hour"]
}),
feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem({
"uid": "color",
"type": "Dimension",
"values": ["date"]
});