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

Plotly figure always generating with y = [0...n] #763

Open
lz039 opened this issue Jan 31, 2025 · 1 comment
Open

Plotly figure always generating with y = [0...n] #763

lz039 opened this issue Jan 31, 2025 · 1 comment

Comments

@lz039
Copy link

lz039 commented Jan 31, 2025

Hi folks,

the generated SQL and the table / df output is correct, but for plotly generation the y-axis is always only counting upwards:
for x = 0, y = 0,
for x = 1, y = 1
... and so on

Image

I use this default route

@app.route('/api/v0/generate_plotly_figure', methods=['GET'])
@requires_cache(['df', 'question', 'sql'])
def generate_plotly_figure(id: str, df, question, sql):
    try:
        code = vn.generate_plotly_code(question=question, sql=sql, df_metadata=f"Running df.dtypes gives:\n {df.dtypes}")
        fig = vn.get_plotly_figure(plotly_code=code, df=df, dark_mode=False)
        fig_json = fig.to_json()

        cache.set(id=id, field='fig_json', value=fig_json)

        return jsonify(
            {
                "type": "plotly_figure", 
                "id": id,
                "fig": fig_json,
            })
    except Exception as e:
        # Print the stack trace
        import traceback
        traceback.print_exc()

        return jsonify({"type": "error", "error": str(e)})

Can anyone help?

@lz039
Copy link
Author

lz039 commented Jan 31, 2025

Probably I need to update my code as to #733 the vanna-flask repo is outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant