I can't format the values in a Visualisation | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
I can't format the values in a Visualisation
No permission to create posts
August 9, 2018
8:22 am
Avatar
Jos

Silver
Members
Forum Posts: 7
Member Since:
July 4, 2018
sp_UserOfflineSmall Offline

Hello
I have crated a couple of visualisations but several of them show BIG values at the sides. I need only ( and at most) 2 decimals.
What is the cause of this weird behaviour?
How can I get this right?

ThingSpeak_Problem.jpgImage Enlarger

Thanks,
Jos

sp_PlupAttachments Attachments
August 9, 2018
1:55 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 437
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

If it is a MATLAB plot, you can use ytickformat('%.2f') If you are using thingSpeakPlotYY, then you will have to reformat the data in your channel before plotting. You can read it and then use round(X,2), before plotting.

August 12, 2018
4:10 am
Avatar
Jos

Silver
Members
Forum Posts: 7
Member Since:
July 4, 2018
sp_UserOfflineSmall Offline

Thank for this hint, cstapels.
To start with: I have set the 'ROUNDING' in the ThingSpeak channels to '2', I assumed that this would be sufficeint to solve the problem...... Well, it doesn't.

So I tried your ytickformat('%.2f') suggestion.
But it is not working (yet).

I have two Y-axis, one on the left and one on the right side of the chart. How do i distinguish between these two, and how shoud i put this in the my code?

The code (so far) is:

% Channel ID to read data from
readChannelID = 531447;
% ORP Field ID
ORPFieldID = 4;
% Temperature Field ID
TempFieldID = 2;

% Channel Read API Key
% If your channel is private, then enter the read API
% Key between the '' below:
readAPIKey = '#############';

[data,timeStamps] = thingSpeakRead(readChannelID,'Fields',[ORPFieldID TempFieldID], ...
'NumPoints',900, ...
'ReadKey',readAPIKey);

ORPData = data(:,1);

% Read Temperature Data
TempData = data(:,2);

thingSpeakPlotYY(timeStamps,ORPData,timeStamps,TempData, 'Ylabel1','ORP', 'Ylabel2','Celsius');

August 14, 2018
5:19 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 437
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Since you are using the thingSpeakPlotYY, then yTickFormat() will not work.

Here is a good example using thingSpeakPlotYY()
https://www.mathworks.com/help/thingspeak/Plot-Temperature-and-Wind-Speed-on-Two-Different-Axes.html

After you read the data from your thingSpeak channel, then use the round function.

dataRound=round(data,2);

Then use thingSpeakPlotYY with dataRound.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
27 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

AgnesMer, JavierLecy, gwenbk2, eloisedq3, AEtedesar, RichardWosus

Administrators: Hans: 387, lee: 457