from pyecharts.charts import Bar sales_data = {'Product A': 10000, 'Product B': 20000, 'Product C': 15000} bar = Bar() bar.add_xaxis(list(sales_data.keys())) bar.add_yaxis('Sales', list(sales_data.values())) bar.render()
from pyecharts.charts import Bar department_revenue = {'Sales': 50000, 'Marketing': 25000, 'Operations': 35000} bar = Bar() bar.add_yaxis('Departments', list(department_revenue.keys())) bar.add_xaxis(list(department_revenue.values())) bar.render()In this example, we create a dictionary called department_revenue that contains the revenue data for each department. We then create a new Bar object and add the y-axis data (the department names) and x-axis data (the revenue numbers) using the `add_yaxis()` and `add_xaxis()` methods. Finally, we call the `render()` method to create the chart.