This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
I have an issue whenever I use the Line Graph Widget in GUI composer. It displays my data perfectly if there is no pre/post processing function specified. However, as soon as I define a pre and post processing function to scale the data (following what the Wiki says), the graph stops displaying anything. This issue occurs only for the Line Graph. All other widgets (including the Scalar Line Graph) scale the data according to the pre/post processing functions in the app.js file. Is there any extra step that must be taken to scale data on the LIne Graph Widget?
I have tried this on multiple projects in CCS, and have also tried re-installing CCS. I found this problem in both CCS v5.4 and v5.5
Hi Anirban,
Can you attach the pre and post functions that you are using in your app here? I am guessing that the functions that you have didn't return the correct values to the GUI Composer server.
Patrick
Hi Patrick
The Pre and Post processing functions from my app.js file are pasted below:
/*
* This file is provided for custom JavaScript logic that your HTML files might need.
* GUI Composer includes this JavaScript file by default within HTML pages authored in GUI Composer.
*/
require([
"dojo/ready"], function(ready){
ready(
function(){
// logic that requires that Dojo is fully initialized should go here
});
});
function scale1( valueFromTarget) {
// return valueFromTarget/2;
return valueFromTarget/40.96;
}
function scale2( valueToTarget) {
// return valueToTarget*2;
return valueToTarget*40.96;
}
I used the same scale functions for a line graph, a fuel gauge and a digital meter widget, both separately as well as all together. The digital meter and the fuel gauge scaled the values according to the function, but the line graph did not display anything. (the function of the program is to read the ADC and display the value on a 0-100 scale).
The line graph is bound to an array called TempSensorVoltage of integer type. The fuel gauge and digital meter are bound to TempSensorVoltage[0].
For the line graph, the input parameter for each functions is an array. You will need to do something like this,
function post( valueToTarget) {
var result = [];
for (var i = 0; i < valueToTarget.length; ++i) {
result.push(valueToTarget[i]*5);
}
return result;
}
function pre( valueFromTarget) {
var result = [];
for (var i = 0; i < valueFromTarget.length; ++i) {
result.push(valueFromTarget[i]/5);
}
return result;
}