pyxley.charts.datamaps package

Submodules

pyxley.charts.datamaps.datamaps module

class pyxley.charts.datamaps.datamaps.Datamap(chart_id, url, params, api_route)

Bases: pyxley.charts.charts.Chart

Pyxley Datamaps Chart component.

This is the base class for the PyxleyJS Datamaps wrapper.

Parameters:
  • url – name of endpoint to transmit data.
  • chart_id – html element id.
  • params – parameters chart will be initialized with.
  • route_func – function called by the endpoint
class pyxley.charts.datamaps.datamaps.DatamapUSA(url, chart_id, df, state_index, color_index, init_params={}, color_map={'gold': '#fc0', 'dark pink': '#e3489b', 'off-white': '#ffffdd', 'cobalt': '#56b3ff', 'pale yellow': '#ffff9d', 'teal': '#008080', 'light pink': '#ffd6d3', 'camel': '#c96', 'fuchsia': '#ff00ff', 'orange red': '#ff4500', 'black': '#000000', 'orange': '#ffc870', 'white': '#ffffff', 'brown': '#864', 'turquoise': '#40e0d0', 'soft orange': '#ffc63c', 'yellow': '#ffff00', 'olive': '#808000', 'silver': '#c0c0c0', 'gray': '#9c9c9c', 'grey': '#9c9c9c', 'light green': '#90ee90', 'antique silver': '#d7cdc4', 'burnt orange': '#cc5500', 'antique gold': '#fff4b0', 'navy': '#6c70ff', 'tan': '#d2b48c', 'light blue': '#add8e6', 'jewel tone purple': '#ae2cc6', 'pink': '#ffb6c1', 'purple': '#800080', 'burgundy': '#ff7272', 'defaultFills': 'black', 'other': '#111111', 'red': '#ff0000', 'blue': '#8084ff', 'mustard': '#ffe761', 'light purple': '#b0c4de', 'rose gold': '#ffba9d', 'dark purple': '#540061', 'dark grey': '#666666', 'teal green': '#a1dfc6', 'bronze': '#c95a0b', 'magenta': '#ff00ff', 'light grey': '#d3d3d3', 'coral': '#ff9e80', 'canary yellow': '#ffef00', 'green': '#83ff7f', 'beige': '#f5f5dc', 'dark green': '#006400'}, route_func=None)

Bases: pyxley.charts.datamaps.datamaps.Datamap

Wrapper for PyxleyJS Datamaps component.

By default, this class builds a simple endpoint function. This can be overriden by supplying a route_func. When a route_func has been supplied, only the url, init_params, and route_func will be used.

Parameters:
  • url – name of endpoint to transmit data.
  • chart_id – html element id.
  • df – dataframe containing states and colors.
  • state_index – column name of dataframe containing states.
  • color_index – column name of dataframe containing colors.
  • init_params – parameters chart will be initialized with.
  • color_map – dictionary of color labels and hex values.
  • route_func – function called by the endpoint. default is None
static to_json(df, state_index, color_index, fills)

Transforms dataframe to json response

Module contents