-
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.
Merge pull request #40 from brown-ccv/feat-charts
Port Dashboard and Charting components from Buoy Viewer
- Loading branch information
Showing
32 changed files
with
1,882 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
node: true, | ||
}, | ||
extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'], | ||
parserOptions: { | ||
parser: 'babel-eslint' | ||
parser: 'babel-eslint', | ||
}, | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'**/__tests__/*.{j,t}s?(x)', | ||
'**/tests/unit/**/*.spec.{j,t}s?(x)' | ||
'**/tests/unit/**/*.spec.{j,t}s?(x)', | ||
], | ||
env: { | ||
jest: true | ||
} | ||
} | ||
] | ||
jest: true, | ||
}, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
singleQuote: true, | ||
semi: true | ||
semi: true, | ||
}; |
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,13 @@ | ||
<template> | ||
<main> | ||
<nav class="dashboard-nav"> | ||
<slot name="nav"></slot> | ||
</nav> | ||
<header class="dashboard-header"> | ||
<slot name="header"></slot> | ||
</header> | ||
<section class="dashboard-section"> | ||
<slot name="section"></slot> | ||
</section> | ||
</main> | ||
</template> |
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,27 @@ | ||
<template> | ||
<div class="chart-container" :class="['is-' + width]"> | ||
<header class="chart-header"> | ||
<h2 class="title"><slot name="title"></slot></h2> | ||
<h3 class="description"><slot name="description"></slot></h3> | ||
</header> | ||
<section class="chart"> | ||
<slot name="chart"></slot> | ||
</section> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
width: { | ||
type: String, | ||
default: 'full', | ||
validator: function (value) { | ||
return ( | ||
['full', 'one-third', 'half', 'two-thirds'].indexOf(value) !== -1 | ||
); | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> |
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,107 @@ | ||
<script> | ||
import vegaBaseMixin from '@/mixins/vega-base-mixin.js'; | ||
export default { | ||
mixins: [vegaBaseMixin], | ||
props: { | ||
variable: { | ||
type: String, | ||
required: true, | ||
}, | ||
x: { | ||
type: String, | ||
required: true, | ||
}, | ||
xLabel: { | ||
type: String, | ||
required: true, | ||
}, | ||
y: { | ||
type: String, | ||
required: true, | ||
}, | ||
yLabel: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
baseSpec() { | ||
return { | ||
$schema: 'https://vega.github.io/schema/vega/v5.json', | ||
height: this.height, | ||
data: { | ||
name: 'data', | ||
values: this.dataset, | ||
}, | ||
scales: [ | ||
{ | ||
name: 'x', | ||
type: 'band', | ||
domain: { data: 'data', field: this.x }, | ||
range: 'width', | ||
}, | ||
{ | ||
name: 'y', | ||
type: 'band', | ||
domain: { data: 'data', field: this.y }, | ||
range: 'height', | ||
}, | ||
{ | ||
name: 'color', | ||
type: 'linear', | ||
range: { scheme: 'tealblues' }, | ||
domain: { data: 'data', field: this.variable }, | ||
reverse: false, | ||
zero: false, | ||
nice: true, | ||
}, | ||
], | ||
axes: [ | ||
{ | ||
orient: 'bottom', | ||
scale: 'x', | ||
domain: false, | ||
title: this.xLabel, | ||
labelOverlap: 'parity', | ||
}, | ||
{ | ||
orient: 'left', | ||
scale: 'y', | ||
domain: false, | ||
title: this.yLabel, | ||
}, | ||
], | ||
legends: [ | ||
{ | ||
title: this.variable, | ||
fill: 'color', | ||
type: 'gradient', | ||
gradientLength: { signal: 'height' }, | ||
}, | ||
], | ||
marks: [ | ||
{ | ||
type: 'rect', | ||
from: { data: 'data' }, | ||
encode: { | ||
enter: { | ||
x: { scale: 'x', field: this.x }, | ||
y: { scale: 'y', field: this.y }, | ||
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}}`, | ||
}, | ||
}, | ||
update: { | ||
fill: { scale: 'color', field: this.variable }, | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.