create_new_chart
create_new_chart
Functions
Name | Description |
---|---|
add_chart | This function adds a new chart to a page in a power BI dashboard report. |
add_chart
create_new_chart.add_chart(
dashboard_path,
page_id,
chart_id,
chart_type,
data_source,
chart_title,
x_axis_title,
y_axis_title,
x_axis_var,
y_axis_var,
y_axis_var_aggregation_type,
x_position,
y_position,
height,
width,=-1001,
tab_order=6000,
z_position )
This function adds a new chart to a page in a power BI dashboard report.
:param str dashboard_path: The path where the dashboard files are stored. (This is the top level directory containing the .pbip file and Report and SemanticModel folders). :param str page_id: The unique id for the page you want to add the background image to. If you used this package’s functions it will be in the format page1, page2, page3, page4, etc. If you manually created the page it will be a randomly generated UUID. To find a page’s page id, consult the report > definition> pages > page.json file and look in the page order list. :param str chart_id: Please choose a unique id to use to identify the chart. PBI defaults to using a UUID, but it’d probably be easier if you choose your own id.
:param str chart_type: The type of chart to build on the page. Known available types include: [“columnChart”,“barChart”, “clusteredBarChart”, ] :param str data_source: The name of the dataset you want to use to build the chart. This corresponds to the dataset_name field in the add data functions. You must have already loaded the data to the dashboard.
:param str chart_title: Give your chart an informative title!:D :param str x_axis_title: Text to display on the x axis :param str y_axis_title: Text to display on the y axis
:param str x_axis_var: Column name of a column from data_source that you want to use for the x axis of the chart :param str y_axis_var: Column name of a column from data_source that you want to use for the y axis of the chart :param str y_axis_var_aggregation_type: Type of aggregation method you want to use to summarize y axis variable. Available options include” [“Sum”, “Count”, “Average”]
:param int x_position: The x coordinate of where you want to put the chart on the page. Origin is page’s top left corner. :param int y_position: The y coordinate of where you want to put the chart on the page. Origin is page’s top left corner.
:param int height: Height of chart on the page :param int width: Width of chart on the page
:param int tab_order: The order which the screen reader reads different elements on the page. Defaults to -1001 for now. (I need to do more to figure out what the numbers correpond to. It should also be possible to create a function to automatically order this left to right top to bottom by looping through all the visuals on a page and comparing their x and y positions) :param int z_position: The z index for the visual. (Larger number means more to the front, smaller number means more to the back). Defaults to 6000