This section allows you to explore the overall trend for multiple areas simultaneously. Average trends have been calculated for practices with all records within the main built-up area.
Results by Built-up Areas with CAZ
viewof caztype = Inputs. select (caztypes, {value : "CAZ D" , label : "Type" })
cazfiltered = transpose (cazdata). filter (function (record) {
return caztype. includes (record. type ) ;
})
Plot. plot ({
y : {domain : [0 , 70 ],
grid : true ,
label : "SABA ratio(%)" ,
transform : (f) => (f* 100 )
},
x : {
transform : (x) => d3. timeParse ("%Y-%m-%d" )(x),
interval : "month"
},
color : {legend : true },
marks : [
Plot. ruleY ([0 ]),
Plot. lineY (cazfiltered,
{x : "date" ,
y : "calc_value" ,
stroke : "name" ,
marker : "dot" ,
strokeOpacity : 0.3 }),
Plot. linearRegressionY (cazfiltered,
{x : "date" ,
y : "calc_value" ,
stroke : "name" })
]
})
Linar trends (Avg % Change per month)
Trends in each NHS region
Select the start month to calculate the linear trend
viewof month_min = Inputs. range (
[0 , 60 ],
{value : 28 , step : 1 , label : "Start month:" }
)
Select the NHS regions of interest (max 6):
viewof names = Inputs. select (lstNames, {multiple : 6 , label : "NHS Regions" , value : ["NHS BRADFORD DISTRICT AND CRAVEN" , "NHS LIVERPOOL" ]})
rfiltered = transpose (mydata). filter (function (record) {
return month_min < record. month && names. includes (record. name ) ;
})
Plot. plot ({
y : {domain : [0 , 70 ],
grid : true ,
label : "SABA ratio(%)" ,
transform : (f) => (f* 100 )
},
x : {
transform : (x) => d3. timeParse ("%Y-%m-%d" )(x),
interval : "month"
},
color : {legend : true },
marks : [
Plot. ruleY ([0 ]),
Plot. lineY (transpose (mydata),
{x : "date" ,
y : "calc_value" ,
stroke : "#aaa7ad" ,
z : "name" ,
strokeOpacity : 0.2 }),
Plot. lineY (rfiltered,
{x : "date" ,
y : "calc_value" ,
stroke : "name" ,
marker : "dot" ,
strokeOpacity : 0.6 }),
Plot. linearRegressionY (rfiltered,
{x : "date" ,
y : "calc_value" ,
stroke : "name" })
]
})