I am trying to build a simple dashboard using 2 bar charts. It ought to be easy, but I am finding the documentation is not designed for beginners.
I have created a simple CSV file with State, City, and Sales columns. All I want to do is display a Sales by State chart and a Sales by City chart underneath it. the interaction I am trying to build is to hover over a State bar, and have the City chart only show cities in that State. Sounds simple.
I can get the two charts up easily enough as independent charts. I cannot get the interactivity to work.
I have tried following and understanding the Interactive tutorial, but one of the samples is too simple. It does not have a chart working with another chart. The other sample is too complex. It uses time series and a very complex set of code to handle x and y components and values. I can follow what that example is doing, but when I try to adapt it to bar charts and a much simpler set of data (i.e State, city, Amount), I cannot get it to work. By work, I mean when I try adding the callback, the code fails entirely. when I take the callback and “def update” out, the charts are displayed properly, just with no interactivity.
I have tried to use the examples in the Dash documentation for Bar Charts. I have tried using the examples in Plotly documentation. My biggest challenge seems to be that most of these examples use data that is input manually into the code. I am trying to use a CSV file, which I can do for two independent charts. I just cannot figure out how to construct the callback when a CSV file is involved.
I think the problem is akin to attending a poetry class to learn how to write iambic pentameter or haiku, but the teacher gives you a dictionary and nothing else. The words are all in the dictionary, but the dictionary does not show how to put them together to form either type of poetry.
Does anybody have a suggestion other than work through the documentation?
Sorry to vent. I think Dash and Plotly offer a lot. If I can learn how to use them, I plan on offering them in a university-level course on visualizations. At the present pace of things, I won’t be proficient enough in Dash Plotly to teach it until the next century. Any thoughts or help would be greatly appreciated.