Chart Data

Performance !!!

Bar and Column Charts

Line and Area Charts

Pie and Funnel Charts

Scatter and Bubble Charts

Radar and Polar Charts

Financial Charts

Gantt Charts

Combinational Charts

Dynamic Charts

Working with Chart Axes

Chart Features

Customizing Chart

Client-Side Events


This sample demonstrates how a chart palette can be specified.

For detailed implementation, please take a look at the Aspx, Razor and Controller code tabs.
 
<%@ Page  Language="C#"  Inherits="System.Web.Mvc.ViewPage<IEnumerable<SamplesBrowser.Models.FourSeriesChartData>>" %>

<%@ Import Namespace="JQChart.Web.Mvc" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>    
    <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqChart.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqRangeSlider.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/themes/le-frog/jquery-ui-1.8.20.css" />
    <script src="<%: Url.Content("~/Scripts/jquery-1.11.1.min.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery.mousewheel.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery.jqChart.min.js") %>" type="text/javascript"></script>    
    <script src="<%: Url.Content("~/Scripts/jquery.jqRangeSlider.min.js") %>" type="text/javascript"></script>
    <!--[if IE]><script lang="javascript" type="text/javascript" src="<%: Url.Content("~/Scripts/excanvas.js") %>"></script><![endif]-->
</head>
<body>
    <div>
        <%= Html.JQChart()
                .Chart(Model)
                .ID("jqChart")
                .Width(500)
                .Height(300)
                .Title("Custom Colors")
                .Legend(legend => legend.Location(LegendLocation.Bottom))
                .PaletteColors(el => el.PaletteColorsType(PaletteColorsType.CustomColors)
                                       .CustomColors(new string[] { "#A0522D", "#D2691E", "#8B0000", "#CD853F" }))
                .Animation(TimeSpan.FromSeconds(1))
                .Axes(axis =>
                    {
                        axis.CategoryAxis(Location.Bottom).Categories(el => el.Label);
                    }
                )
                .Series(series =>
                    {
                        series.Column().Title("Series 1")
                                       .YValues(el => el.Value1);

                        series.Column().Title("Series 2")
                                       .YValues(el => el.Value2);

                        series.Column().Title("Series 3")
                                       .YValues(el => el.Value3);

                        series.Column().Title("Series 4")
                                       .YValues(el => el.Value4);
                    }
                )
                .Render()%>
    </div>
</body>
</html>

                                        
 
@model IEnumerable<SamplesBrowser.Models.FourSeriesChartData>
@using JQChart.Web.Mvc

<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>    
    <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqChart.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqRangeSlider.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/themes/le-frog/jquery-ui-1.8.20.css" />
    <script src="@Url.Content("~/Scripts/jquery-1.11.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.mousewheel.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqChart.min.js")" type="text/javascript"></script>    
    <script src="@Url.Content("~/Scripts/jquery.jqRangeSlider.min.js")" type="text/javascript"></script>
    <!--[if IE]><script lang="javascript" type="text/javascript" src="@Url.Content("~/Scripts/excanvas.js")"></script><![endif]-->
</head>
<body>
    <div>
          @(Html.JQChart()
                .Chart(Model)
                .ID("jqChart")
                .Width(500)
                .Height(300)
                .Title("Custom Colors")
                .Legend(legend => legend.Location(LegendLocation.Bottom))
                .PaletteColors(el => el.PaletteColorsType(PaletteColorsType.CustomColors)
                                       .CustomColors(new string[] { "#A0522D", "#D2691E", "#8B0000", "#CD853F" }))
                .Animation(TimeSpan.FromSeconds(1))
                .Axes(axis =>
                    {
                        axis.CategoryAxis(Location.Bottom).Categories(el => el.Label);
                    }
                )
                .Series(series =>
                    {
                        series.Column().Title("Series 1")
                                       .YValues(el => el.Value1);

                        series.Column().Title("Series 2")
                                       .YValues(el => el.Value2);

                        series.Column().Title("Series 3")
                                       .YValues(el => el.Value3);

                        series.Column().Title("Series 4")
                                       .YValues(el => el.Value4);
                    }
                )
                .Render() 
          )
    </div>
</body>
</html>

                                        
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SamplesBrowser.Models
{
    public class FourSeriesChartData
    {
        public static List<FourSeriesChartData> GetData()
        {
            var data = new List<FourSeriesChartData>();

            data.Add(new FourSeriesChartData("A", 62, 56, 60, 68));
            data.Add(new FourSeriesChartData("B", 70, 50, 55, 30));
            data.Add(new FourSeriesChartData("C", 68, 62, 42, 56));
            data.Add(new FourSeriesChartData("D", 58, 65, 68, 40));

            return data;
        }

        public FourSeriesChartData(string label, double value1, double value2, double value3, double value4)
        {
            this.Label = label;

            this.Value1 = value1;
            this.Value2 = value2;
            this.Value3 = value3;
            this.Value4 = value4;
        }

        public string Label { get; set; }

        public double Value1 { get; set; }
        public double Value2 { get; set; }
        public double Value3 { get; set; }
        public double Value4 { get; set; }
    }
}
                                        
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SamplesBrowser.Models;

namespace SamplesBrowser.Controllers
{
    public class ChartController : Controller
    {

        public ActionResult Palettes()
        {
            return View(FourSeriesChartData.GetData());
        }

    }
}