add_shape_map
add_shape_map(
dashboard_path,
page_id,
map_id,
data_source,
shape_file_path,
map_title,
location_var,
color_var,
color_palette,
height,
width,
x_position,
y_position,=True,
add_legend=None,
static_bin_breaks=None,
percentile_bin_breaks=None,
filtering_var=6000,
z_position=-1001,
tab_order )
Add a map to a page
: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 map 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 map_id: Please choose a unique id to use to identify the map. PBI defaults to using a UUID, but it’d probably be easier if you choose your own id.
:param str data_source: The name of the dataset you want to use to build the map. This corresponds to the dataset_name field in the add data functions. You must have already loaded the data to the dashboard. :param str shape_file_path: A path to a shapefile that you want to use to build the map. This shape file will be added to the registered resources.
:param str map_title: The title you want to put above the map. :param str location_var: The name of the column in data_source that you want to use for the location variable on the map :param str color_var: The name of the column in data_source that you want to use for the color variable on the map :param str filtering_var: Optional. The name of a column in data source that you want to use to filter the color variable on the map. This must be supplied if providing percentile_bin_breaks. If you want to use percentiles without filtering (ie on static data), you should calculate the percentiles yourself and pass them to static_bin_breaks. Do not provide both static_bin_breaks and a filtering_var.
:param list static_bin_breaks: This should be a list of numbers that you want to use to create bins in your data. There should be one more entry in the list than the number of bins you want and therefore the number of colors passed to the color_palette argument. The function will create bins between the first and second number, second and third, third and fourth, etc. A filtering_var cannot be provided if static_bin_breaks is provided. Use percentile bin breaks instead. :param list color_palatte: A list of hex codes to use to color your data. There should be one fewer than the number of entries in static_bin_breaks :param bool add_legend: True or False, would you like to add the default legend? (By default legend, I mean this function’s default, not the Power BI default) :param list static_bin_breaks: This should be a list of numbers that you want to use to create bins in your data. There should be one more entry in the list than the number of bins you want and therefore the number of colors passed to the color_palette argument. The function will create bins between the first and second number, second and third, third and fourth, etc. :param list percentile_bin_breaks: This should be a list of percentiles between 0 and 1 that you want to us to create bins in your data. If provided, a filtering_var must also be provided. This will create power BI measures that dynamically update when the data is filtered by things such as slicers. There should be one more entry in the list than the number of bins you want and therefore the number of colors passed to the color_palette argument. Here’s an example use case: to create 5 equal sized bins pass this list: [0,0.2,0.4,0.6,0.8,1]
:param int height: Height of map on the page :param int width: Width of map on the page
:param int x_position: The x coordinate of where you want to put the map on the page. Origin is page’s top left corner. :param int y_position: The y coordinate of where you want to put the map on the page. Origin is page’s top left corner. :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 :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)
This function creates a new cloropleth map on a page.