import GridWidget, {GridProps} from "./GridWidget"; import {AppStore, getAppState} from "../StateStore"; import UIComponent from "./UIComponent"; import * as JSX from "../JSXFactory"; import Timeseries from "../Timeseries"; class LegendWidget extends UIComponent { private skeleton: GridWidget; private display: HTMLSpanElement = document.createElement("span"); private bodyRef: HTMLElement; constructor(gridProps: GridProps) { super(); this.display = ; this.skeleton = new GridWidget({ ...gridProps, title: "Legend:", className: "legend-widget", body: this.display, }); AppStore().subscribeStoreVal("highlightedTimeseries", () => this.updateDisplay()); this.updateDisplay(); } private updateDisplay() { this.bodyRef.replaceWith(); } private MainBody = () => { this.bodyRef =
; return this.bodyRef; } private TimeseriesList = () => { const highlightedTimeseries = getAppState().highlightedTimeseries; return ; } private TimeseriesLegendEntry = ({timeseries, highlighted}: {timeseries: Timeseries, highlighted: boolean}) => { const option = new Option(); option.style.color = timeseries.getColour(); return
  • AppStore().setHighlightedTimeseries(timeseries.getName())} onmouseout={() => AppStore().setHighlightedTimeseries(null)}> {timeseries.getName()}
  • ; } current() { return this.skeleton.current(); } } export default LegendWidget;