Skip to content

Getting the plot data to create an interactive chart based on the X,Y co ordinates #1785

@Akash-Kumar-Sen

Description

@Akash-Kumar-Sen
  • Right now the ChartResponse only provides the static image as response.get_base64_image()
  • This also has the last executed code as the following:
import pandas as pd
import matplotlib.pyplot as plt
sql_query = """
SELECT year, segment_profit
FROM table_7434d141_aeb4_4ed1_a716_7ecf8283b9dd
"""
df = execute_sql_query(sql_query)
plt.figure(figsize=(10, 6))
plt.bar(df['year'], df['segment_profit'], color='skyblue')
plt.xlabel('Year')
plt.ylabel('Segment Profit')
plt.title('Segment Profit by Year')
plt.xticks(df['year'])
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
plot_filename = 'exports/charts/temp_chart.png'
plt.savefig(plot_filename)
result = {'type': 'plot', 'value': plot_filename}
  • Is there a way that we can preserve this plt object? Or at least get the co ordinates and labels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions