Files
docx/docs/usage/chart-bubble.md
T

6.5 KiB

Bubble Charts

A bubble chart is a scatter chart whose points are bubbles of different sizes, so it shows three numbers for each point: where it is across, where it is up, and how big it is.

Charts shows how to import ChartRun and add a chart to a document.

A Bubble Chart

new ChartRun({
    type: "bubble",
    title: "Markets",
    series: [
        {
            name: "Europe",
            points: [
                { x: 12, y: 4.5, size: 740 },
                { x: 18, y: 3.1, size: 330 },
            ],
        },
        { name: "Asia", points: [{ x: 24, y: 6.8, size: 1400 }] },
    ],
    xAxis: { title: "Market share (%)" },
    yAxis: { title: "Growth (%)" },
});
  • Like a scatter chart, a bubble chart has no categories. Each series has points, and each point has an x, a y and a size.
  • Sizes are compared with each other: the biggest bubble is drawn at Office's largest size, and the others in proportion. They can't be negative.
  • Bubbles are drawn in their series' colour, a quarter see-through, so bubbles behind them show.

Bubble Sizes

  • bubbleScale makes every bubble bigger or smaller, as a percentage of Office's size, from 0 to 300. The default is 100.
  • sizeRepresents says whether a point's size is the bubble's area ("area", the default) or its width ("width"). By area, a bubble of size 4 looks twice as wide as one of size 1; by width, four times as wide.
bubbleScale: 60,
sizeRepresents: "width",

Labels

A bubble's label can show its size, as well as what any label shows:

dataLabels: { bubbleSize: true },

See Chart Data Labels.

Options

Property Type Notes Description
type "bubble" Required
series BubbleChartSeries[] Required { name, points, color?, dataLabels?, pointLabels?, trendlines?, xErrorBars?, yErrorBars? }, where a point is { x, y, size }. See Chart Data Labels and Chart Trendlines and Error Bars
bubbleScale number Optional The bubbles' size, as a percentage of Office's, from 0 to 300. Default 100
sizeRepresents "area" | "width" Optional Whether a size is a bubble's area or width. Default "area"
xAxis ChartValueAxis Optional The horizontal axis. See Chart Axes
yAxis ChartValueAxis Optional The vertical axis. See Chart Axes
dataLabels BubbleChartDataLabels Optional { value?, category?, seriesName?, bubbleSize?, ... }. See Chart Data Labels
title string | ChartTitle Optional See Chart Titles and Legends
legend false | ChartLegend Optional See Chart Titles and Legends
transformation { width, height } Optional See Chart Size and Position
floating IFloating Optional See Chart Size and Position
altText DocPropertiesOptions Optional See Chart Size and Position

Chart Fonts and Fills shows the options every chart has for its text, background and border.