Chart Data

Performance !!!

Bar and Column Charts

Line and Area Charts

Pie 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 to specify the axis titles.

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.LinearXAxisChartData>>" %>

<%@ 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.5.2.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]-->
    <script lang="javascript" type="text/javascript">
    </script>
</head>
<body>
    <div>
        <%= Html.JQChart()
                .Chart(Model)
                .ID("jqChart")
                .Width(500)
                .Height(300)
                .Title("Axis Titles")
                .Animation(TimeSpan.FromSeconds(1))
                .Axes(axis =>
                    {
                        axis.LinearAxis(Location.Bottom).Title(title => title.Text("Axis Title X").FillStyle("green"));
                        axis.LinearAxis(Location.Left).Title(title => title.Text("Axis Title Y").FillStyle("green"));
                    }
                )
                .Series(series =>
                    {
                        series.Line().Title("Series 1")
                                     .XValues(el => el.ValueX)
                                     .YValues(el => el.ValueY1);

                        series.Line().Title("Series 2")
                                     .XValues(el => el.ValueX)
                                     .YValues(el => el.ValueY2);
                    }
                )
                .Render()%>
    </div>
</body>
</html>

                                        
 
@model IEnumerable<SamplesBrowser.Models.LinearXAxisChartData>
@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.5.2.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]-->
    <script lang="javascript" type="text/javascript">
    </script>
</head>
<body>
    <div>
          @(Html.JQChart()
                .Chart(Model)
                .ID("jqChart")
                .Width(500)
                .Height(300)
                .Title("Axis Titles")
                .Animation(TimeSpan.FromSeconds(1))
                .Axes(axis =>
                    {
                        axis.LinearAxis(Location.Bottom).Title(title => title.Text("Axis Title X").FillStyle("green"));
                        axis.LinearAxis(Location.Left).Title(title => title.Text("Axis Title Y").FillStyle("green"));
                    }
                )
                .Series(series =>
                    {
                        series.Line().Title("Series 1")
                                     .XValues(el => el.ValueX)
                                     .YValues(el => el.ValueY1);

                        series.Line().Title("Series 2")
                                     .XValues(el => el.ValueX)
                                     .YValues(el => el.ValueY2);
                    }
                )
                .Render() 
          )
    </div>
</body>
</html>

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

namespace SamplesBrowser.Models
{
    public class LinearXAxisChartData
    {
        public LinearXAxisChartData(double valueX, double valueY1, double valueY2)
        {
            this.ValueX = valueX;
            this.ValueY1 = valueY1;
            this.ValueY2 = valueY2;
        }

        public static List<LinearXAxisChartData> GetHugeData()
        {
            var data = new List<LinearXAxisChartData>();

            Random rnd = new Random();
            int yValue1 = 50;
            int yValue2 = 200;

            for (int i = 0; i < 10000; i++)
            {
                yValue1 += (int)Math.Round(rnd.NextDouble() * 10 - 5);
                yValue2 += (int)Math.Round(rnd.NextDouble() * 10 - 5);

                data.Add(new LinearXAxisChartData(i, yValue1, yValue2));
            }

            return data;
        }

        public static List<LinearXAxisChartData> GetLineChartData()
        {
            var data = new List<LinearXAxisChartData>();

            data.Add(new LinearXAxisChartData(1, 62, 46));
            data.Add(new LinearXAxisChartData(2, 60, 40));
            data.Add(new LinearXAxisChartData(3, 68, 62));
            data.Add(new LinearXAxisChartData(4, 58, 65));
            data.Add(new LinearXAxisChartData(5, 52, 60));
            data.Add(new LinearXAxisChartData(6, 60, 36));
            data.Add(new LinearXAxisChartData(7, 48, 70));

            return data;
        }

        public static List<LinearXAxisChartData> GetAreaChartData()
        {
            var data = new List<LinearXAxisChartData>();

            data.Add(new LinearXAxisChartData(1, 56, 46));
            data.Add(new LinearXAxisChartData(2, -20, 40));
            data.Add(new LinearXAxisChartData(3, -32, 62));
            data.Add(new LinearXAxisChartData(4, 50, 65));
            data.Add(new LinearXAxisChartData(5, 40, 60));
            data.Add(new LinearXAxisChartData(6, 36, 36));
            data.Add(new LinearXAxisChartData(7, 70, 70));

            return data;
        }

        public double ValueX { get; set; }
        public double ValueY1 { get; set; }
        public double ValueY2 { 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 AxisTitles()
        {
            return View(LinearXAxisChartData.GetLineChartData());
        }

    }
}