ComponentOne
Web API Explorer ASP.NET Web API Explorer

Header and Footer

Header and Footer

Features

Settings

Export
Export Format :
Height :
Width :
Export Name :

Description

This sample demonstrates how to export a MVC FlexChart with header and footer 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 HeaderFooter()
        {
            ViewBag.Options = _flexChartModel;
            return View(new Fruit().Sales);
        }
    }
}
@model IEnumerable<FruitSale>
@{
    ViewBag.DemoSettings = true;
    ImageExportOptions optionsModel = ViewBag.Options;
}

@(Html.C1().FlexChart().Bind("Date", Model).Id(optionsModel.ControlId)
.ChartType(C1.Web.Mvc.Chart.ChartType.LineSymbols)
.Series(sers =>
{
    sers.Add("Sales").Binding("SalesInChina");
})
.Header(Resources.MVCFlexChart.HeaderFooter_Header).Footer(Resources.MVCFlexChart.HeaderFooter_Footer + DateTime.Now.Year).FooterStyle(hs => hs.Halign("right")))

@section Settings{
    @Html.Partial("_ImageExportOptions", optionsModel)
}

@section Description{
    @Html.Raw(Resources.MVCFlexChart.HeaderFooter_Text0)
}