rectY = ({
controls: [
{ type: "text", value: "// Sales histogram \nPlot.rectY(data,", indent: 0 },
{ type: "text", value: "Plot.binX({", indent: 1 },
{
param: "reducer",
label: "y",
type: "select",
options: ["sum", "count"],
value: "count"
},
{ type: "text", value: "},{", indent: 1 },
{ param: "x", value: "date" },
{ param: "y", value: "value" },
{
param: "fill",
options: ["blue", "brand", "red"],
type: "select"
},
{
param: "thresholds",
options: [10, 50, "d3.utcDay", "d3.utcWeek", "d3.utcMonth"],
type: "select"
},
{
param: "fillOpacity",
type: "range",
min: 0.1,
max: 1,
value: 0.5,
step: 0.05
},
{ type: "text", value: "}", indent: 1 },
{ type: "text", value: "})" }
],
plot: (config) => `Plot.plot({
marks: [
Plot.rectY(
data,
Plot.binX(
{ y: "${config.reducer}" },
{
x: "date",
y: "value",
fill: "${config.fill}",
fillOpacity: ${config.fillOpacity},
thresholds: ${config.thresholds}
}
)
)
],
marginLeft: 100,
height: 200,
width: ${plotWidth}
})`
})