Hey everyone,
I am trying to plot a simple graph in a completely new app on Anvil. It renders the graph itself but not the bar charts. The axis is visible but the bars are missing.
What I’ve tried and what’s not working:
I have tried the most basic code for tests. In my previous app I could create graphs but for some reason now even the most basic graphs are not rendering. Probably I am missing something big time, so if you could help me would be great!
This is the code for the test app even this is not working.
from ._anvil_designer import Form1Template
from anvil import *
import plotly.graph_objects as go
class Form1(Form1Template):
def init(self, **properties):
self.init_components(**properties)
self.plot_test_graph()
def plot_test_graph(self):
categories = ["Category A", "Category B", "Category C"]
values = [10, 20, 30]
fig = go.Figure(
data=[
go.Bar(x=categories, y=values, name="Test Data", marker_color="blue")
],
layout=go.Layout(
title="Test Bar Chart",
xaxis_title="Categories",
yaxis_title="Values",
template="plotly_white"
)
)
self.plot_1.data = fig
I have the plot component in and it is named as “plot_1”
I dont get any error either.