Skip to content

io.display.chart

Represents a display.chart component. Currently, Forge supports 6 types of charts: bar | line | area | pie | radar | radial

Usage

ts
await io.display.chart("Chart Title", {
  type: "bar",
  data: [
    { name: "OpenAI", monthly: 186, ytd: 405 },
    { name: "Meta", monthly: 305, ytd: 780 },
    { name: "Apple", monthly: 237, ytd: 566 },
    { name: "Amazon", monthly: 73, ytd: 190 },
    { name: "Netflix", monthly: 209, ytd: 258 },
    { name: "Google", monthly: 214, ytd: 140 },
  ],
  dataKeys: ["monthly", "ytd"],
  dataLabelKey: "name",
  showLegend: true,
  showTooltip: true,
}),
python
await display.chart(
    "Chart Title",
    type="bar",
    data=[
        { "name" : "OpenAI", "monthly" : 186, "ytd" : 405 },
        { "name" : "Meta", "monthly" : 305, "ytd" : 780 },
        { "name" : "Apple", "monthly" : 237, "ytd" : 566 },
        { "name" : "Amazon", "monthly" : 73, "ytd" : 190 },
        { "name" : "Netflix", "monthly" : 209, "ytd" : 258 },
        { "name" : "Google", "monthly": 214, "ytd" : 140 },
    ],
    data_keys=["monthly", "ytd"],
    data_label_key="name",
    show_legend=True,
    show_tooltip=True,
)

example of Forge app with display.chart component