How to use the Graph widget to actively view the changing variable values? Is there a Demo for it?
Hello,
I want to use the Graph Widget to see the changing variable values graphically and also record the same. The recording of the variables can be done by the Data Logger I think.
But I am not able to get around the Graph Widget for now. How can I route the variable values to the Graph Widget to see them changing actively/simultaneously ? Is that actually possible at the first place?
Also, is there a Demo file available in which Graph and Lists are used.
Thanking you in anticipation.
-
Hi,
seems like the tricky part is filling the lists correctly.
I've played around with the Graph Widget a while ago when trying to add new items at the left end.
Here is the method of the script called every 100ms and filling two lists with some sample data displayed by two Graph Widgets then:
void $addToList$ ()
{
int result = 0;
if (value0 < 6.28) {
value0 += 0.1;
} else {
value0 = 0;
}
value1 += 0.5;
if (value1 == 100) {
value1 = -100;
}
smWrite(VariableIDs.data1, value1);
CustomListData data1;
data1.WriteDouble(CustomListColumn.TestList1_Column_0, value1);
data1.WriteDouble(CustomListColumn.TestList1_Column_1, cos(value0) * 90);
data1.WriteDouble(CustomListColumn.TestList1_Column_2, tan(value0) * 20);
// append items at the right end
if (ListManagerGetCount(ListDataType.TestList1) == 100) {
ListManagerRemoveItem(ListDataType.TestList1, 99);
}
result = ListManagerAddItem(ListDataType.TestList1, data1);
ListManagerSetPosition(ListDataType.TestList1, ListManagerGetCount(ListDataType.TestList1) - 1);
ListManagerMoveTo(ListDataType.TestList1, 0);
ListManagerSetPosition(ListDataType.TestList1, ListManagerGetCount(ListDataType.TestList1) - 1);
CustomListData data2;
data2.WriteDouble(CustomListColumn.TestList2_Column_0, value1);
data2.WriteDouble(CustomListColumn.TestList2_Column_1, cos(value0) * 90);
data2.WriteDouble(CustomListColumn.TestList2_Column_2, tan(value0) * 20);
// append items at the left end
result = ListManagerAddItem(ListDataType.TestList2, data2);
ListManagerSetPosition(ListDataType.TestList2, ListManagerGetCount(ListDataType.TestList2) - 1);
if (ListManagerGetCount(ListDataType.TestList2) == 100) {
ListManagerRemoveItem(ListDataType.TestList2, 0);
}
}
Please sign in to leave a comment.
Comments
1 comment