Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
LearningLad9
Contributor II
Contributor II

How to connect drop down menu to bar plot and line chart

Hello, experts. I am  a new user having trouble to connect  bar plot and line chart to drop down menu , searched various sites and answers in the community as well but it is not working for me . I created 4 variables for 4 drop down menu's but it is still not working , also is there some way I can combine all 4 drop downs in one box? Also I am having problem in the measure box of variable input , when I select the field it keeps changing(the field attribute in the second picture).Thanks 

LearningLad9_1-1716875426395.png

LearningLad9_3-1716875617337.png

 

LearningLad9_2-1716875558855.png

 

 

Labels (1)
3 Replies
diana658h
Contributor
Contributor


@LearningLad9floridablue wrote:

Hello, experts. I am  a new user having trouble to connect  bar plot and line chart to drop down menu , searched various sites and answers in the community as well but it is not working for me . I created 4 variables for 4 drop down menu's but it is still not working , also is there some way I can combine all 4 drop downs in one box? Also I am having problem in the measure box of variable input , when I select the field it keeps changing(the field attribute in the second picture).Thanks 

LearningLad9_1-1716875426395.png

LearningLad9_3-1716875617337.png

 

LearningLad9_2-1716875558855.png

 

 


Hello, @LearningLad9 

 

To connect a dropdown menu to a bar plot and line chart, you can use the updatemenu attribute in Plotly. This attribute allows you to update chart attributes dynamically based on the dropdown selection. Here’s a basic example of how to set it up:

import plotly.graph_objects as go

# Create figure
fig = go.Figure()

# Add traces for bar plot and line chart
fig.add_trace(go.Bar(x=[...], y=[...]))
fig.add_trace(go.Scatter(x=[...], y=[...]))

# Define dropdown options and their corresponding actions
dropdown_buttons = [
{'label': 'Bar Plot', 'method': 'update', 'args': [{'visible': [True, False]}]},
{'label': 'Line Chart', 'method': 'update', 'args': [{'visible': [False, True]}]}
]

# Add dropdown to the figure
fig.update_layout(
updatemenus=[
{'buttons': dropdown_buttons}
]
)

# Show plot
fig.show()

 

Replace [...] with your data. The visible array in args determines which traces are visible. For example, [True, False] makes only the bar plot visible, while [False, True] makes only the line chart visible.

 

I hope this information is helpful to you.

 

 

Best Regard,
diana658h

LearningLad9
Contributor II
Contributor II
Author

hi, thank you for helping out , one question tho , how will I link plotly to qlik then?

 

 

LearningLad9
Contributor II
Contributor II
Author

also is there any other way to do this?