Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recharts allow_decimals does not work as described #3581

Open
mgrady3 opened this issue Jun 27, 2024 · 0 comments
Open

Recharts allow_decimals does not work as described #3581

mgrady3 opened this issue Jun 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mgrady3
Copy link

mgrady3 commented Jun 27, 2024

Describe the bug
The documentation for Recharts XAxis allow_decimals parameter says:

Allow the ticks of XAxis to be decimals or not.

Naively I would expect that when set to False, then values for tick-marks shown on the X-Axis are not shown with full decimal representation and instead are truncated to integers in some manner, however, this is not the case.

To Reproduce
Minimal example:

"""Welcome to Reflex! This file outlines the steps to create a basic app."""

import numpy as np

import reflex as rx
from rxconfig import config


x = np.linspace(-20, 20, num=500)
y = x**2
data = []
for xd, yd in zip(x, y):
    data.append({"x": xd, "y": yd})


def index() -> rx.Component:
    return rx.recharts.line_chart(
        rx.recharts.line(
            data_key="y",
            stroke="#8884d8"
        ),
        rx.recharts.x_axis(data_key="x", allow_decimals=False),
        rx.recharts.y_axis(),
        data=data,
    )

app = rx.App()
app.add_page(index)

Expected behavior
I expect that the data shown on the XAxis will not display the full decimal and rather be truncated in some way to integers

Screenshots
Here is the plot shown when using allow_decimals=False. Note, the X-Axis is rather busy and hard to read due to the extended decimal data being shown.

badplot

Specifics (please complete the following information):

  • Python Version: 3.10.12
  • Reflex Version: 0.55
  • OS: Kubuntu 22.04
  • Browser (Optional): Chrome (latest for this Kubuntu release)
@mgrady3 mgrady3 added the bug Something isn't working label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant