)

Bubble Charts

Unlike most other chart types, Bubble Charts display three dimensions of data: X, Y, and size.

To create bubble charts with the FlexChart control, you must set the binding property to a comma-delimited list of property names. The first property will be bound to the Y value, and the second to the bubble size.

For example, the chart below shows sales along the X axis, expenses along the Y axis, and uses the number of downloads to determine the bubble size:

01,0002,0003,0004,0005,0006,0007,0008,0009,000Sales02,0004,000Expenses
1
2
3
4
5
6
7
8
9
10
11
12
13
using System.Web.Mvc;
 
namespace LearnMvcClient.Controllers
{
    public partial class C1FlexChartController : Controller
    {
        // GET: BubbleCharts
        public ActionResult BubbleCharts()
        {
            return View(Models.FlexChartData.GetSales3());
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@using LearnMvcClient.Models
@model IEnumerable<FlexChartData.Sale>
 
@{
    var tooltipContennt = "<b>{item.Country}</b>:<table class=\"chart-tip\">" +
        "<tr><td>Sales</td><td>{Sales:c0}</td></tr>" +
        "<tr><td>Expenses</td><td>{Expenses:c0}</td></tr>" +
        "<tr><td>Downloads</td><td>{Downloads:n0}</td></tr>" +
        "</table>";
})
 
<h1>
    @Html.Raw(Resources.C1FlexChart.BubbleCharts_Title)
</h1>
 
<p>
    @Html.Raw(Resources.C1FlexChart.BubbleCharts_Text1)
</p>
<p>
    @Html.Raw(Resources.C1FlexChart.BubbleCharts_Text2)
</p>
<p>
    @Html.Raw(Resources.C1FlexChart.BubbleCharts_Text3)
</p>
 
@(Html.C1().FlexChart<FlexChartData.Sale>().Id("theChart")
    .Bind("Sales", Model)
    .ChartType(C1.Web.Mvc.Chart.ChartType.Bubble)
    .Series(sb=>sb.Add().Binding("Expenses,Downloads"))
    .Legend(C1.Web.Mvc.Chart.Position.None)
    .AxisX(ab => ab.Title("Sales").Min(0))
    .AxisY(ab => ab.Title("Expenses").Min(0))
    .Tooltip(tb=>tb.Content(tooltipContennt))
)