Hi,
I'm hoping somebody can point out what I am doing wrong here.
I have a new weewx installation on a Raspberry Pi and everything is working
great. So I am modifying my skin, using the Responsive and Washboard skins
as a base.
I have two weather stations a Davis and a Weatherflow and would like to use
chartist to draw a graph with both temperature values on for comparison.
Chartist is not the problem, getting the data from the weatherflow sensor
on to the chart is the problem.
At one point in the index.html.templ I have:
<td>$latest($data_binding='weatherflow_binding').outTemp</td>
<td>$current.outTemp</td>
and I get the expected differing values, so I know the weatherflow sensor
and database are ok and the 'weatherflow_binding' is working properly. But
the following code, just creates a page with two copies of the default
outTemp data, so I end up with a pretty chart, but with only one line on it.
new Chartist.Line('#temperature', {
series: [
{
name: 'Davis',
data: [
#for $record in $day.records
#set $floatminute = float($record.dateTime.format("%M")) / 60;
#set $decimalminute = str($floatminute - int($floatminute))[2:];
{x: "$record.dateTime.format("%H").$decimalminute", y:
"$record.outTemp.nolabel("%1f","undefined")"},
#end for
]
},
{
name: 'Weatherflow',
data: [
#for $record in $day($data_binding='weatherflow_binding').records
#set $floatminute = float($record.dateTime.format("%M")) / 60;
#set $decimalminute = str($floatminute - int($floatminute))[2:];
{x: "$record.dateTime.format("%H").$decimalminute", y:
"$record.outTemp.nolabel("%1f","undefined")"},
#end for
]
},
]
}, {
showPoint: false,
axisX: {
type: Chartist.FixedScaleAxis,
divisor: 24,
low: 0,
high: 24,
}
});
the output looks like:
new Chartist.Line('#temperature', {
series: [
{
name: 'Davis',
data: [
{x: "00.0833333333333", y: "3.455556"},
{x: "00.166666666667", y: "3.382222"},
{x: "00.25", y: "3.330247"},
{x: "00.333333333333", y: "3.251208"},
{x: "00.416666666667", y: "3.191667"},
<snip of a lot of similar lines>
]
},
{
name: 'Weatherflow',
data: [
{x: "00.0833333333333", y: "3.455556"},
{x: "00.166666666667", y: "3.382222"},
{x: "00.25", y: "3.330247"},
{x: "00.333333333333", y: "3.251208"},
{x: "00.416666666667", y: "3.191667"},
<snip of another lot of similar lines>
It looks to me like the data_binding in the second for loop is being
ignored, but I know nothing and user error is probable.
Can anybody point out what I'm doing wrong here?
Best regards
Mike
https://duckrising.com/weewx/
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.