import * as React from 'react'; import { computed, makeObservable } from 'mobx'; import CBIOPORTAL_VICTORY_THEME from '../../theme/cBioPortalTheme'; export interface IGradientLegendProps { // TODO orientation: string; gradientId: string; title: string; x: number; y: number; width: number; height: number; min: number; max: number; fontSize?: number; fontFamily?: string; } export const TITLE_DX = -12; export const TITLE_DY = -5; export class GradientLegend extends React.Component { constructor(props: any) { super(props); makeObservable(this); } public static defaultProps: Partial = { fontSize: 11, fontFamily: CBIOPORTAL_VICTORY_THEME.legend.style.labels.fontFamily, }; public get rectX() { return this.props.x; } public get rectY() { return this.props.y - TITLE_DX; } @computed public get title() { return ( {this.props.title} ); } @computed public get labels() { const rectWidth = this.props.width; const rectHeight = this.props.height; return [ {this.props.max.toLocaleString()} , {this.props.min.toLocaleString()} , ]; } @computed public get gradientRect() { const rectWidth = this.props.width; const rectHeight = this.props.height; return ( ); } public render() { return ( {this.title} {this.gradientRect} {this.labels} ); } } export default GradientLegend;