Comments (1)
Looks like the current implementation aligns with the documentation. By default, the type property of XAxis is considered category
, rather than a numeric
value. Consequently, the graph was interpreting the data as a string. Specifying the type as number resolves this issue, and the graph behaves as expected.
"""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
# Generate x values from -20 to 20 with 500 points
x = np.linspace(-20, 20, num=500)
# Compute the y values as the square of x
y = x**2
# Prepare the data in the required format
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, type_="number"),
rx.recharts.y_axis(),
data=data,
)
# Create and configure the app
app = rx.App()
app.add_page(index)
![image](https://private-user-images.githubusercontent.com/53006261/347912645-f842070a-639a-4d40-b954-134490bfa3a0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEyMTQxMzksIm5iZiI6MTcyMTIxMzgzOSwicGF0aCI6Ii81MzAwNjI2MS8zNDc5MTI2NDUtZjg0MjA3MGEtNjM5YS00ZDQwLWI5NTQtMTM0NDkwYmZhM2EwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE3VDEwNTcxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAzY2E0YzJmNWFhNWFhMDY4ODZmNjAzMWEwOTQ2OTA5MTIxOWFhNzQxNWJjM2YzYWNlNWE2ZGNmM2U0NWE0ZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.oAUaIsfGqx481SieHH0bbOGinhSRaJTtzcCs6c2nQMg)
I hope this clarifies the situation and helps with your implementation.
from reflex.
Related Issues (20)
- How to use it in air-gapped environment? HOT 1
- Set Up GitHub Actions for Easy Deployment to Reflex Own Deployment Service. HOT 4
- radial bar customization
- Help wrapping react component : primereact/treetable
- Authorization System HOT 4
- Multiple rx._x.asset issues
- Error al iniciar el reflex HOT 1
- Add support for adding custom fonts to SunEditor component HOT 1
- rx.dialog.close do not trigger on button with variable color scheme HOT 2
- ResourceWarning: unclosed file HOT 2
- DeprecationWarning: connections() is deprecated and will be removed; use net_connections() instead
- [REF-3266] AttributeError: 'ModelPrivateAttr' object has no attribute 'update' HOT 1
- pkg_resources is deprecated as an API
- How to deploy reflex app without source code HOT 2
- Transform mouse into a cursor by default when hovering over a reflex button HOT 2
- `rx.input(value=State.nested.var)` is not updated when `nested` is set to a new object containing the same content. HOT 3
- DebounceInput not allowed in rx.form.control()
- [REF-3296] Paste handler should paste in only the file object and not the path
- How can we run reflex app programatically in python code? HOT 4
- Okta Authentication Integration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reflex.