ComponentOne
Web API Explorer ASP.NET Web API Explorer

MVCFlexChart

Bubble

Features

Settings

Export
Export Format :
Height :
Width :
Export Name :

Description

This sample demonstrates how to export a MVC bubble FlexChart to image file.
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);
        }
    }
}
@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)
}