viewof scatter = vl
.markPoint({
size: 250,
opacity: 1,
stroke: "white",
strokeWidth: 1
})
.data(locationData)
.encode(
vl
.x()
.fieldT("datum")
.scale({
domain: [
{ month: "Apr", year: minYear },
{ month: "Oct", year: currYear }
]
})
.title(null),
vl
.y()
.fieldN("quality")
.axis({ grid: true })
.scale({
domain: ["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"]
})
.sort(["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"])
.title(null),
vl
.color()
.fieldN("quality")
.scale({
range: waterColors,
domain: ["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"],
opacity: 1
})
.sort(["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"])
.title(null)
.legend({ orient: "top", titleOrient: "top" }), //
vl
.fill()
.fieldN("quality")
.scale({
range: waterColors,
domain: ["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"]
})
.sort(["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"])
.legend({ orient: "top", titleOrient: "top" }), //{ orient: "left", titleOrient: "top", padding: 4 }
vl
.shape()
.fieldN("quality")
.scale({
range: ["cross", "square", "circle", "triangle"],
domain: ["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"]
})
.sort(["Ausgezeichnet", "Gut", "Ausreichend", "Mangelhaft"])
.legend({ orient: "top", titleOrient: "top" }), //{ orient: "left", titleOrient: "top", padding: 4 }
vl.tooltip([
{
field: "datum",
type: "temporal",
title: "Datum"
},
{ field: "quality", type: "nominal", title: "Qualität" }
])
//vl.column().fieldT("year") // show the date and quality fields in a tooltip
)
.width(width / 2.25) // specifying responsive width
.height(350)
.autosize({ resize: true, type: "fit" })
.config({
// locale: { number: localeNumber, time: localeTime },
view: { stroke: null },
// scale: { bandPaddingInner: 0.2, bandPaddingOuter: 0.2, stroke: 2 },
background: "#ffffff",
axis: {
labelFont: ZHFonts.regular,
labelFontSize: 14,
labelColor: "black",
titleFont: ZHFonts.regular,
titleFontSize: 14,
titleFontColor: "black",
tickColor: "lightgrey",
domainColor: "#949494",
gridColor: "lightgrey"
},
axisX: {
title: null,
labelAngle: 0,
zindex: 1,
labelAlign: "left",
tickCount: Math.ceil(widthNow / 80),
labelExpr:
"[timeFormat(datum.value, '%b'), timeFormat(datum.value, '%m') == '01' ? timeFormat(datum.value, '%Y') : '']",
labelOffset: 4,
labelPadding: -24,
tickSize: 30,
grid: true,
gridDash: {
condition: {
test: { field: "value", timeUnit: "month", equal: 1 },
value: []
},
value: [2, 2]
},
tickDash: {
condition: {
test: { field: "value", timeUnit: "month", equal: 1 },
value: []
},
value: [2, 2]
}
},
axisY: {
labelPadding: 10,
titleAlign: "left",
titleAngle: 0,
titleX: 0,
titleY: -20,
tickCount: Math.ceil(width / 2 / 3.5 / 120),
ticks: true,
tickSize: 10,
labelLimit: 300
},
title: {
font: ZHFonts.black,
fontSize: 16,
offset: 15,
anchor: "start",
lineHeight: 5,
padding: 40,
subtitleFont: ZHFonts.regular,
subtitleFontSize: 14
},
header: {
labelOrient: "top",
labelPadding: 5,
lineHeight: 3,
labelFontSize: 13,
labelFont: ZHFonts.black,
labelColor: "black"
},
legend: {
orient: "top",
symbolSize: 200,
titleFont: ZHFonts.black,
titleFontSize: 14,
labelFontSize: 14,
labelFont: ZHFonts.regular,
labelColor: "black",
labelLimit: 300,
padding: 10,
columns: nCol,
title: null
},
text: {
font: ZHFonts.regular,
align: "center",
fill: "black",
fontSize: 12,
dx: 0
}
})
.render()