Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please in Python: 1. I use code: def create_bar_chart(data, title, x_name, y_name, hover_tool=None, width=1200, height=300): Creates a bar chart plot with the exact styling for
Please in Python:
1. I use code:
def create_bar_chart(data, title, x_name, y_name, hover_tool=None, width=1200, height=300): """Creates a bar chart plot with the exact styling for the centcom dashboard. Pass in data as a dictionary, desired plot title, name of x axis, y axis and the hover tool HTML. """ source = ColumnDataSource(data) xdr = FactorRange(factors=data[x_name]) ydr = Range1d(start=0,end=max(data[y_name])*1.5) tools = [] if hover_tool: tools = [hover_tool,] plot = figure(title=title, x_range=xdr, y_range=ydr, plot_width=width, plot_height=height, h_symmetry=False, v_symmetry=False, min_border=10, toolbar_location="above", tools=tools, responsive=True, outline_line_color="#666666") glyph = VBar(x=x_name, top=y_name, bottom=0, width=.8, fill_color="#6599ed") plot.add_glyph(source, glyph) xaxis = LinearAxis() yaxis = LinearAxis() plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker)) plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker)) plot.toolbar.logo = None plot.min_border_top = 0 plot.xgrid.grid_line_color = None plot.ygrid.grid_line_color = "#999999" plot.yaxis.axis_label = "Bugs found" plot.ygrid.grid_line_alpha = 0.1 plot.xaxis.axis_label = "Days after app deployment" plot.xaxis.major_label_orientation = 1 return plot
2. Convert cursor.execute(query_b).fetchall() on dict
From query_b I have tuples: score_b=(("a", 2.56),("b", 4.67),("c",6.56))
3. I need to add name =? (as dict) in this line:
plot = create_bar_chart(data=????, title="Wykres", x_name="name", y_name="score")
please add print screen from python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started