election_day.utils.d3_renderer ============================== .. py:module:: election_day.utils.d3_renderer Classes ------- .. autoapisummary:: election_day.utils.d3_renderer.D3Renderer Module Contents --------------- .. py:class:: D3Renderer(app: onegov.election_day.app.ElectionDayApp) Provides access to the d3-renderer (github.com/seantis/d3-renderer). .. py:attribute:: app .. py:attribute:: renderer .. py:attribute:: supported_charts .. py:attribute:: scripts :type: dict[str, list[str]] .. py:method:: translate(text: translationstring.TranslationString, locale: str | None) -> str Translates the given string. .. py:method:: get_chart(chart: str, fmt: Literal['pdf'], data: onegov.core.types.JSON_ro, width: int = 1000, params: dict[str, Any] | None = None) -> IO[bytes] get_chart(chart: str, fmt: Literal['svg'], data: onegov.core.types.JSON_ro, width: int = 1000, params: dict[str, Any] | None = None) -> IO[str] get_chart(chart: str, fmt: Literal['pdf', 'svg'], data: onegov.core.types.JSON_ro, width: int = 1000, params: dict[str, Any] | None = None) -> IO[str] | IO[bytes] Returns the requested chart from the d3-render service as a PNG/PDF/SVG. .. py:method:: get_map(map: str, fmt: Literal['pdf'], data: onegov.core.types.JSON_ro, year: int, width: int = 1000, params: dict[str, Any] | None = None) -> IO[bytes] get_map(map: str, fmt: Literal['svg'], data: onegov.core.types.JSON_ro, year: int, width: int = 1000, params: dict[str, Any] | None = None) -> IO[str] get_map(map: str, fmt: Literal['svg', 'pdf'], data: onegov.core.types.JSON_ro, year: int, width: int = 1000, params: dict[str, Any] | None = None) -> IO[str] | IO[bytes] Returns the request chart from the d3-render service as a PNG/PDF/SVG. .. py:method:: get_list_groups_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_list_groups_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_list_groups_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_list_groups_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_lists_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_lists_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_lists_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_lists_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_candidates_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_candidates_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_candidates_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_candidates_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_connections_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_connections_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_connections_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_connections_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_seat_allocation_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_seat_allocation_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_seat_allocation_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_seat_allocation_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_party_strengths_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_party_strengths_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_party_strengths_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_party_strengths_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_lists_panachage_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_lists_panachage_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_lists_panachage_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_lists_panachage_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_parties_panachage_chart(item: object, fmt: Literal['pdf'], return_data: Literal[False] = False) -> IO[bytes] | None get_parties_panachage_chart(item: object, fmt: Literal['svg'], return_data: Literal[False] = False) -> IO[str] | None get_parties_panachage_chart(item: object, fmt: Literal['pdf'], return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_parties_panachage_chart(item: object, fmt: Literal['svg'], return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_entities_map(item: object, fmt: Literal['pdf'], locale: str, return_data: Literal[False] = False) -> IO[bytes] | None get_entities_map(item: object, fmt: Literal['svg'], locale: str, return_data: Literal[False] = False) -> IO[str] | None get_entities_map(item: object, fmt: Literal['pdf'], locale: str, return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_entities_map(item: object, fmt: Literal['svg'], locale: str, return_data: Literal[True]) -> tuple[IO[str] | None, Any | None] .. py:method:: get_districts_map(item: object, fmt: Literal['pdf'], locale: str, return_data: Literal[False] = False) -> IO[bytes] | None get_districts_map(item: object, fmt: Literal['svg'], locale: str, return_data: Literal[False] = False) -> IO[str] | None get_districts_map(item: object, fmt: Literal['pdf'], locale: str, return_data: Literal[True]) -> tuple[IO[bytes] | None, Any | None] get_districts_map(item: object, fmt: Literal['svg'], locale: str, return_data: Literal[True]) -> tuple[IO[str] | None, Any | None]