ComponentOne
Web API Explorer ASP.NET Web API Explorer

MVCFlexChart

Bubble

This sample demonstrates how to export a MVC bubble FlexChart to image file.

Features

0246810121416182022242628102030405060708090

Settings

Export
Export Format : Height :
Width :
Export Name :

Description

This sample demonstrates how to export a MVC bubble FlexChart to image file.
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApiExplorer.Models;
 
namespace WebApiExplorer.Controllers
{
    public partial class MVCFlexChartController : Controller
    {
        public ActionResult Bubble()
        {
            ViewBag.Options = _flexChartModel;
            List<Dot> bubbles = new List<Dot>();
            var rand = new Random(0);
            for (int i = 0; i < 30; i++)
            {
                double x = i;
                double y = rand.Next(1, 10);
                double size = rand.Next(1, 10);
                bubbles.Add(new Dot { X = x, Y = y * 10, Size = size * 100 });
            }
            return View(bubbles);
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@model IEnumerable<Dot>
@{
    ViewBag.DemoSettings = true;
    ImageExportOptions optionsModel = ViewBag.Options;
}
 
@(Html.C1().FlexChart().Id(optionsModel.ControlId).Height(300).ChartType(C1.Web.Mvc.Chart.ChartType.Bubble).Bind("X", Model).Series(sers =>
    {
        sers.Add().Binding("Y,Size");
    }))
 
@section Settings{
    @Html.Partial("_ImageExportOptions", optionsModel)
}
 
@section Description{
    @Html.Raw(Resources.MVCFlexChart.Bubble_Text0)
}