Skip to content

Commit

Permalink
Merge pull request #44 from brown-ccv/fix-heat-variable
Browse files Browse the repository at this point in the history
fix: add variable label to heatmap
  • Loading branch information
mcmcgrath13 committed Oct 29, 2020
2 parents 36e20e5 + f7034e0 commit a5b2ea9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/d-chart-heatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export default {
type: String,
required: true,
},
variableLabel: {
type: String,
required: true,
},
x: {
type: String,
required: true,
Expand Down Expand Up @@ -74,7 +78,7 @@ export default {
],
legends: [
{
title: this.variable,
title: this.variableLabel,
fill: 'color',
type: 'gradient',
gradientLength: { signal: 'height' },
Expand All @@ -91,7 +95,7 @@ export default {
width: { scale: 'x', band: 1 },
height: { scale: 'y', band: 1 },
tooltip: {
signal: `{'${this.xLabel}': datum.${this.x}, '${this.yLabel}': datum.${this.y}, 'Count': datum.${this.variable}}`,
signal: `{'${this.xLabel}': datum.${this.x}, '${this.yLabel}': datum.${this.y}, '${this.variableLabel}': datum.${this.variable}}`,
},
},
update: {
Expand Down
1 change: 1 addition & 0 deletions src/stories/chart-container.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const ChartContainerTemplate = (args, { argTypes }) => ({
y="station"
y-label="Buoy ID"
variable="temp"
variable-label="Temp. (C)"
/>
</template>
</DChartContainer>
Expand Down
3 changes: 3 additions & 0 deletions src/stories/heatmap.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import DHeatMap from '../components/d-chart-heatmap.vue';
y="station"
y-label="Buoy ID"
:variable="variable"
variable-label="Temp. (C)"
:include-actions="true"
/>
```
Expand All @@ -58,6 +59,7 @@ export const Template = (args, { argTypes }) => ({
:y="y"
:y-label="yLabel"
:variable="variable"
:variable-label="variableLabel"
:include-actions="includeActions"
:spec-override="specOverride"
/>
Expand All @@ -69,6 +71,7 @@ export const Template = (args, { argTypes }) => ({
<Canvas>
<Story name="Heat Map" args={{
variable: 'temp',
variableLabel: 'Temp. (C)',
includeActions: true,
minWidth: 400,
height: 300,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/d-chart-heatmap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ResizeObserver from '../__mocks__/ResizeObserver'; // eslint-disable-line
let props = {
id: 'heatmap',
variable: 'temp',
variableLabel: 'Temp. (C)',
minWidth: 400,
height: 300,
x: 'month',
Expand Down

0 comments on commit a5b2ea9

Please sign in to comment.