Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Hint on react-viz goes out of range

I am using Hint from React-Vis but even though I pass on my Hint the value that it should plot again, it goes way out of scope. How can I make sure this is on top of the vertical bar height?

Code Link here.

or full code here :

export default class Example extends React.Component {
  state = {
    hintValue: ""
  };

  _onNearestX = (value) => {
    this.setState({ hintValue: value });
  };

  render() {
    return (
      <div>
        <XYPlot width={300} height={300} stackBy="y" xType="ordinal">
          <VerticalGridLines />
          <HorizontalGridLines />
          <XAxis />
          <YAxis />
          <VerticalBarSeries
            cluster="Q2"
            color="red"
            data={[
              { x: 1, y: 5 },
              { x: 2, y: 15 }
            ]}
            onNearestXY={this._onNearestX}
          />
          <VerticalBarSeries
            cluster="Q2"
            color="grey"
            data={[
              { x: 1, y: 2 },
              { x: 2, y: 11 }
            ]}
            onNearestXY={this._onNearestX}
          />
          <VerticalBarSeries
            cluster="Q1"
            color="green"
            data={[
              { x: 1, y: 8 },
              { x: 2, y: 16 }
            ]}
            onNearestXY={this._onNearestX}
          />
          <VerticalBarSeries
            cluster="Q1"
            color="lightgreen"
            data={[
              { x: 1, y: 3 },
              { x: 2, y: 12 }
            ]}
            onNearestXY={this._onNearestX}
          />
          <VerticalBarSeries
            cluster="Q1"
            color="yellow"
            data={[
              { x: 1, y: 1 },
              { x: 2, y: 1 }
            ]}
            onValueClick={(datapoint, event) => {
              console.log(datapoint, event); // Some SVG element
            }}
            onNearestXY={this._onNearestX}
          />
          {this.state.hintValue !== "" && (
            <Hint value={this.state.hintValue}>
              <div className="hint">
                <p>X: {this.state.hintValue.x}</p>
                <p>Y: {this.state.hintValue.y}</p>
              </div>
            </Hint>
          )}
        </XYPlot>
      </div>
    );
  }
}

const rootElement = document.querySelector("#root");
if (rootElement) {
  render(<Example />, rootElement);
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!