-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<li | ||
v-if="hasMetrics" | ||
:class="'clickable legend_end legend_item legend_item_' + position" | ||
@click="onRecolorClicked" | ||
> | ||
<span> | ||
<b-icon-palette /> | ||
<span class="m-2"> | ||
Metriken eindeutig einfärben | ||
</span> | ||
</span> | ||
</li> | ||
</template> | ||
|
||
<script> | ||
import distinctColors from 'distinct-colors' | ||
export default { | ||
props: { | ||
position: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
computed: { | ||
hasMetrics () { | ||
return this.$store.getters['metrics/length']() > 0 | ||
} | ||
}, | ||
methods: { | ||
onRecolorClicked () { | ||
const palette = distinctColors({ count: this.$store.getters['metrics/length'](), lightMin: 25, lightMax: 75 }).values() | ||
for (const metric of this.$store.getters['metrics/getAll']()) { | ||
const color = palette.next().value.css() | ||
this.$store.dispatch('metrics/updateColor', { metricKey: metric.key, color: color }) | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
d72d4c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs more 🦓.