-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
21b217f
commit c3eea79
Showing
19 changed files
with
60,920 additions
and
1,112 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,18 @@ | ||
const ScrollToTop = { | ||
mounted() { | ||
const scrollToTopBtn = this.el; | ||
if (!scrollToTopBtn) { | ||
console.warn('ScrollToTop element not found.'); | ||
return; | ||
} | ||
|
||
scrollToTopBtn.addEventListener('click', () => { | ||
window.scrollTo({ | ||
top: 0, | ||
behavior: 'smooth' | ||
}); | ||
}); | ||
} | ||
}; | ||
|
||
export default ScrollToTop; |
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,41 @@ | ||
import vegaEmbed from "vega-embed"; | ||
|
||
/** | ||
* A hook used to render graphics according to the given | ||
* Vega-Lite specification. | ||
* | ||
* The hook expects a `vega_lite:<id>:init` event with `{ spec }` payload, | ||
* where `spec` is the graphic definition as an object. | ||
* | ||
* Configuration: | ||
* | ||
* * `data-id` - plot id | ||
*/ | ||
|
||
const VegaLite = { | ||
mounted() { | ||
this.id = this.el.getAttribute("data-id"); | ||
this.viewPromise = null; | ||
|
||
const container = document.createElement("div"); | ||
this.el.appendChild(container); | ||
|
||
this.handleEvent(`vega_lite:${this.id}:init`, ({ spec }) => { | ||
this.viewPromise = vegaEmbed(container, spec, {}) | ||
.then((result) => result.view) | ||
.catch((error) => { | ||
console.error( | ||
`Failed to render the given Vega-Lite specification, got the following error:\n\n ${error.message}\n\nMake sure to check for typos.` | ||
); | ||
}); | ||
}); | ||
}, | ||
|
||
destroyed() { | ||
if (this.viewPromise) { | ||
this.viewPromise.then((view) => view.finalize()); | ||
} | ||
}, | ||
}; | ||
|
||
export default VegaLite; |
Oops, something went wrong.