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

Update Graph.tsx #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface IProps {
* Perspective library adds load to HTMLElement prototype.
* This interface acts as a wrapper for Typescript compiler.
*/
interface PerspectiveViewerElement {
interface PerspectiveViewerElement extends HTMLElement {
load: (table: Table) => void,
}

Expand All @@ -32,7 +32,7 @@ class Graph extends Component<IProps, {}> {

componentDidMount() {
// Get element to attach the table from the DOM.
const elem: PerspectiveViewerElement = document.getElementsByTagName('perspective-viewer')[0] as unknown as PerspectiveViewerElement;
const elem = document.getElementsByTagName('perspective-viewer')[0] as unknown as PerspectiveViewerElement;

const schema = {
stock: 'string',
Expand All @@ -49,7 +49,13 @@ class Graph extends Component<IProps, {}> {

// Add more Perspective configurations here.
elem.load(this.table);
element.setAttribute('view','y_line');
element.setAttribute('column-pivots','["stock"]');
element.setAttribute('row-pivots','["timestamp"]');
element.setAttribute('columns','["top_ask_price"]');
element.setAttribute('aggregates',{"stock":"distinct count","top_ask_price":"avg","top_bid_price":"avg","timestamp":"distinct count"}');
}

}

componentDidUpdate() {
Expand Down