Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend override_aes #1115

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Support dict in override_aes for legend
  • Loading branch information
MKoroteev-HORIS committed Jun 12, 2024
commit bf564c4da106f4c6503ea1e5bbc06fe7ee36ec29
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,19 @@ class LegendAssembler(
scaleMappers.getValue(aes)(it) as Any // Don't expect nulls.
}
val labels = scaleBreaks.labels
for ((label, aesValue) in labels.zip(aesValues)) {
aesValuesByLabel.getOrPut(label) { HashMap() }[aes] = aesValue
labels.zip(aesValues).forEachIndexed { index, (label, aesValue) ->
val labelMap = aesValuesByLabel.getOrPut(label) { HashMap() }
labelMap[aes] = aesValue

overrideAesValues.forEach { (aesToOverride, v) ->
aesValuesByLabel.getOrPut(label) { HashMap() }[aesToOverride] = v
val newAesValue = if (v is List<*>) {
v.getOrElse(index) { v.last() }
} else {
v
}
newAesValue?.let {
labelMap[aesToOverride] = it
}
}
}
}
Expand Down