I am trying to use call back to update charts using radio buttons
I am using a url to reach this page and i want to return html as the result
In this case chart is plotted properly first time ,but when i click on radio button nothing happens ,and no error on console as well
I am running main.py and calling CMPAlertBreakdownApp().getAlertBrekDownDonut() from there
Can you help?
import dash_core_components as dashComponent
import plotly.graph_objs as donut
import dash_html_components as html
from applications.cmp.dashapp.CMPAlertBreakDownHelper import CMPAlertBreakDownHelper
import dash
import json
from textwrap import dedent as d
from dash.dependencies import Input, Output
class CMPAlertBreakdownApp:
def init(self):
print(âIn the init Methodâ)
app = dash.Dash(âAlertBreakDownChartâ)
def getAlertBrekDownDonut(self):
params=[]
print(âIn getAlertBrekDownDonut Methodâ)
app = dash.Dash(âAlertBreakDownChartâ)
app.css.append_css({
âexternal_urlâ: âhttps://codepen.io/chriddyp/pen/dZVMbK.cssâ
})
df = CMPAlertBreakDownHelper.getAlertDetail( params)
donutdata= donut.Pie(values=df[âALERT_COUNTâ], labels=df[âNAMEâ], hole=0.4)
layout = {
âtitleâ: âAlert Breakdownâ
}
app.layout= html.Div([
dashComponent.RadioItems(
id=âradio-itemsâ,
options=[
{âlabelâ: âOneâ, âvalueâ: âfirstâ},
{âlabelâ: âTwoâ, âvalueâ: âsecondâ},
{âlabelâ: âThreeâ, âvalueâ: âthirdâ},
],
value="",
labelStyle={âdisplayâ: âinline-blockâ}
),
dashComponent.Graph(
id=âalertDonutâ,
figure={
âdataâ: [donutdata],
âlayoutâ: layout
}
)
])
return app.layout;
@app.callback(Output(âalertDonutâ, âfigureâ), [Input(âradio-itemsâ, âvalueâ)])
def updateChart(value):
print(" value ")
print(value )
return self.getAlertBrekDownDonut(self)