Leaderboard

This is the official documentation of the forestadmin-agent-django and forestadmin-agent-flask Python agents.

Leaderboard Charts display a list of records sorted by their value in descending order.

from forestadmin.datasource_toolkit.context.agent_context import AgentCustomizationContext
from forestadmin.datasource_toolkit.decorators.chart.result_builder import ResultBuilder
from forestadmin.datasource_toolkit.interfaces.chart import Chart

async def companies_live_chart_fn(
    context: AgentCustomizationContext, result_builder: ResultBuilder
) -> Chart:
    return result_builder.leaderboard({
        "Bonanza": 5835694,
        "TalkSpace": 4179218,
        "Tesco": 3959931,
        "BitPesa": 3856685,
        "Octiv": 3747458,
    })

agent.add_chart("companiesLive", companies_live_chart_fn)

Last updated