Search results

Working with Data

Chart can visualise data bound from local or remote data.

Local Data

You can bind a simple JSON data to the chart using dataSource property in series.

razor
local-data.cs
@Html.EJS().StockChart("container").Title("AAPL Stock Price")
                                                                        .Series(sr =>
                                                                        {
                                                                            sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Candle).DataSource("data").Add();
                                                                        })
    <script src="~/financial-data.js"></script>                                                                   .Render())
    <script>
        var data = window.chartData;
    </script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
    public partial class StockChartController : Controller
    {
        public IActionResult Default()
        {
            return View();
        }
    }
}

See Also