question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Misalignment on YAxis and overlapping labels on XAxis

See original GitHub issue

What is the problem?

The YAxis misaligns with the chart grid randomly on dynamic data update The XAxis gets its labels overlapping radomly on dynamic data update

When does it happen?

When the chart first loads, YAxis is aligned and the labels of XAxis are not overlapping. But after changing the “from” and “to” selectors, the data updates and:

  • sometimes the YAxis gets misaligned with chart grid
  • sometimes the XAxis displays more labels that are overlapping

Updating data again fixes the issue with a bit of luck

Leads

For me it seems that it’s a rendering issue because of its randomness

Any though to get rid of those bugs ?

What platform?

  • iOS
  • [8.1] Android

React Native version: ^0.50.3

Code to reproduce

<View style={styles.chartWrapper}>
          <View style={{width: 50, flexDirection: 'column'}}>
            <YAxis
              data={data}
              yAccessor={({ item }) => item.value }
              style={{flex: 1}}
              svg={{
                  fill: 'grey',
                  fontSize: 10,
              }}
              min={0}
              contentInset={{ top: 30, bottom: 10 }}
              formatLabel={ value => `${value}` }
            />
            <View style={{flex: 0.1}}/>  
          </View>
          <View style={{flex: 1, flexDirection: 'column'}}>
            <AreaChart
                style={{flex: 1}}
                data={data}
                yAccessor={({ item }) => item.value }
                xAccessor={({ item }) => new Date(item.receivedAt) }
                contentInset={{ top: 30, bottom: 10, right: 15, left: 5 }}
                svg={{
                    fill: 'url(#gradient)'
                }}
                showGrid={true}
                gridMin={0}
                extras={[Gradient, Line(COLORS[mode][0])]}
                xScale={d3Scale.scaleTime}
            />
            <XAxis
                style={{ flex: 0.1 }}
                data={data}
                formatLabel={ (value) => new Date(value).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}
                contentInset={{ left: 5, right: 15 }}
                xAccessor={({ item }) => new Date(item.receivedAt)}
                svg={{
                  fontSize: 10,
                }}
                min={0}
                numberOfTicks={6}
                scale={d3Scale.scaleTime}
            />
          </View>
        </View>

Layout using flexboxes

I’m using flexbox for my layout, this is a drawing of how my components are positioned:

layout_chart

Overlapping screenshot

x_axis_overlap

Misalign screenshot

y_axis_missalign

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
animaonlinecommented, Sep 3, 2018

Should be reopened, as this is easily reproducible

2reactions
JesperLeklandcommented, Jun 3, 2018

Sorry for the slow reply, I’ve had to prioritise other issues. I can’t for the love of me recreate this problem. If you can, create a minimal reproduction example in a new issue and I’d happily take a look. Closing this for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why has my X Axis labels moved to the right and all ...
It looks like the marks are overlapping on the axis. This is not an expected behaviour, but there are some logical reasons why...
Read more >
Stagger Axis Labels to Prevent Overlapping - Peltier Tech
You can overrule the labels' orientation: on the Home tab of the ribbon, on the alignment tab, click the dropdown to select any...
Read more >
problem with x-axis labels after overlapping 2 box plots
I have the following code to compare two sets of box plots and there seems to be two misaligned x-axis labels after doing...
Read more >
Highcharts XRange Data and Label misalignment
I'm trying to implement a timeline widget using Highcharts xrange chartType. The basic structure is YAxis Categories : Agent ...
Read more >
Overlapping Bar Chart X-Axis Labels - Ignition Early Access
Shown above is a screenshot of an XY Chart I've created in Perspective. The X-Axis labels overlap quite badly and there's no way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found