DEV Community

superoverflow
superoverflow

Posted on

2

Visualising data

As a backend engineer, I always wanted to build graphs to show some data interactively. I look up a few libraries but they are not quite easy to use as a relatively new React dev. So I ask my si-fu @_denb again, he recommended me to look at visx/xychar. And yea, it was surprising neat!

Step 1: display a simple line chart
https://codesandbox.io/s/visx-xychart-00-qp99f

The main thing to display the data is just this piece of code. Simple enough!

      <XYChart height={300} 
        xScale={{ type: 'band' }} 
        yScale={{ type: 'linear' }}>
          <Axis orientation="bottom" />
          <Axis orientation="left" />
          <LineSeries data={data} dataKey="line" {...accessors} />
      </XYChart>
Enter fullscreen mode Exit fullscreen mode

Step Final: custom y axis, adding glyph and toolstips, etc

In the final code, I tried to represent a team match position. Since position 1 means the team is a top, I will need to reverse the y-axis. And to make it the graph interactive, I added some icons on the data points and tools tip

visx has other lower level libraries, but I found xychart is really battery included and simple to use :D

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay