St.line_chart incorrectly labels y-axis ticks when zooming in

I make a simple st.line_chart() from a pandas data frame:

Picture1

A user notified me that when zooming in on this chart, the y-axis tick labels often get re-labelled incorrectly. For example, zooming in on the figure above results in all 0’s and 5’s on the y-axis tick labels:

Picture2

Running a few tests on different line charts in the same app but with different data, it seems like this can happen in any line chart depending on the range of data and how far you zoom in. This occurs in both the production app and my local build.

Thoughts on how to fix? Thank you.

Hi @copey507 -

My guess here is not that the labels themselves are incorrect, but that you have two things going on here:

  1. The chart is being truncated at the Y-axis on the left side, AND
  2. Zooming in on a single number integer chart eventually converts to float axis

So what I think you’re seeing with the alternating 5, 0 pattern is actually 0, 0.5, 1.0, 1.5. If you make your browser screen wider or the chart smaller, that’s the first thing I would test. If that’s what is happening, unfortunately that is the axis behavior in the underlying Altair/vega-lite library.

Best,
Randy

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.