h_price_line to current_price_line

This commit is contained in:
Giulio De Pasquale 2020-12-16 09:40:45 +00:00
parent dfdb2e46a9
commit 9ae8389f83

View File

@ -20,14 +20,14 @@ type PriceLine = {
type PlotState = { type PlotState = {
x: Array<number>, x: Array<number>,
y: Array<number>, y: Array<number>,
h_price_line: PriceLine, current_price_line: PriceLine,
} }
class RPlot extends Component<{}, PlotState> { class RPlot extends Component<{}, PlotState> {
state = { state = {
x: [], x: [],
y: [], y: [],
h_price_line: {x0: 0, x1: 0, y0: 0, y1: 0}, current_price_line: {x0: 0, x1: 0, y0: 0, y1: 0},
} }
constructor(props) { constructor(props) {
@ -42,7 +42,7 @@ class RPlot extends Component<{}, PlotState> {
this.setState({ this.setState({
x: data.ticks, x: data.ticks,
y: data.prices, y: data.prices,
h_price_line: { current_price_line: {
x0: 0, x0: 0,
y0: last_price, y0: last_price,
x1: last_tick, x1: last_tick,
@ -62,7 +62,7 @@ class RPlot extends Component<{}, PlotState> {
this.setState({ this.setState({
x: x, x: x,
y: y, y: y,
h_price_line: { current_price_line: {
x0: 0, x0: 0,
y0: data.price, y0: data.price,
x1: data.tick, x1: data.tick,
@ -95,10 +95,10 @@ class RPlot extends Component<{}, PlotState> {
shapes: [ shapes: [
{ {
type: 'line', type: 'line',
x0: this.state.h_price_line.x0, x0: this.state.current_price_line.x0,
y0: this.state.h_price_line.y0, y0: this.state.current_price_line.y0,
x1: this.state.h_price_line.x1, x1: this.state.current_price_line.x1,
y1: this.state.h_price_line.y1, y1: this.state.current_price_line.y1,
line: { line: {
color: 'rgb(50, 171, 96)', color: 'rgb(50, 171, 96)',
width: 2, width: 2,