Skip to content

Donut

Info - How to setup Chart
import pandas as pd
from ipyvizzu import Chart, Data, Config, Style

df = pd.read_csv(
    "https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu_data_8.csv",
    dtype={"Year": str, "Timeseries": str},
)
data = Data()
data.add_df(df)

chart = Chart()
chart.animate(data)

This Vizzu animation consist of 2 steps (animates):

1st:

  • move the Dimension from X-axis to the Y-axis
  • add a new Dimension to the X-axis
  • remove the Measure from the label channel

2nd:

  • move the Measure from X to Y-axis
chart.animate(
    Config(
        {
            "channels": {
                "x": ["Country", "Value 2 (+)"],
                "y": {"range": {"min": "-200%"}},
                "color": "Country",
                "label": "Value 2 (+)",
            },
            "coordSystem": "polar",
        }
    )
)

chart.animate(
    Config(
        {
            "channels": {
                "x": ["Year", "Value 2 (+)"],
                "y": {"set": "Country", "range": {"min": "-30%"}},
                "label": None,
            }
        }
    )
)

chart.animate(
    Config(
        {
            "channels": {
                "x": "Year",
                "y": {
                    "set": ["Country", "Value 2 (+)"],
                    "range": {"min": "-30%"},
                },
            }
        }
    ),
    Style({"plot": {"marker": {"rectangleSpacing": "0.1em"}}}),
)

chart.feature("tooltip", True)