I'm posting weather data to a few channels on ThingSpeak, for example this outdoor temperature:
I know how to change the color for the entire line in the graph, but since this is an outdoor temperature in Norway - where the temperature changes between above and below freezing on a regular basis - it would be really nice to have the graph line have different colors above and below freezing. Specifically, I would like it to be blue below 0 (freezing point on the Centigrade scale) and red above 0.
Any ideas how to do that?
I dont know if any way to modify the thingspeak basic grapsh. If you use a Matlab visualization you can sort your values into 2 series (above and below zero in your case) and plot them on the same graph with different colors.
Hopefully someone with matlab skills can give us code for that..
Here is an example MATLAB code snippet to help you get started:
% Read data from your channel
[data, time] = thingSpeakRead(130083, 'NumPoints', 8000, 'Fields', 1);
% Create variables for holding values greater than zero and less than zero
dataGtZero = NaN(1, length(data));
dataLsZero = NaN(1, length(data));
% Assign values to the variables
% dataGtZero has all values of data that are greater than zero
dataGtZero(data>0) = data(data>0);
% dataLsZero has all values of data that are less than zero
dataLsZero(data<0) = data(data<0);
% Plot both chunks of data and specify color to be blue ('b') for data less than zero and red for the other.
plot(time, dataLsZero, 'b');
plot(time, dataGtZero, 'r')
Most Users Ever Online: 114
Currently Browsing this Page:
Guest Posters: 1
Administrators: Hans, lee