Search results

Localization in ASP.NET Core Sparkline control

14 Apr 2021 / 1 minute to read

The sparkline control supports localization. The default culture for localization is en-US. You can change the culture using the setCulture method.

Tooltip format

Sparkline tooltip supports localization. The following code sample shows tooltip text with currency format based on culture.

tagHelper
tooltip.cs
Copied to clipboard
@using Syncfusion.EJ2;
<div class="spark" align="center">
    <ejs-sparkline id="sparkline" loaded="loaded" height="200px" width="350px" type="@SparklineType.Area"  dataSource="ViewBag.sparkData">
	<e-sparkline-containerarea>
     <e-sparkline-containerarea-border color='#033e96' width="2"></e-sparkline-containerarea-border>
      </e-sparkline-containerarea>
            <e-sparkline-border color= '#033e96'' width="2"></e-sparkline-border>
			<e-sparkline-padding left="20" right="20" bottom="20" top="20"></e-sparkline-padding>
			<e-sparkline-tooltipsettings visible="true"></e-sparkline-tooltipsettings>
    </ejs-sparkline>
</div>
<style>
    .spark {
        border: 1px solid rgb(209, 209, 209);
        border-radius: 2px;
        width: 100%;
        height: 100%;
    }
</style>
<script>
    function loaded(args)
    { 
        window.sparkline = args.sparkline;
        args.sparkline.loaded = null;
        args.sparkline.refresh();
    }
</script>
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            ViewBag.sparkData = new int[] { 30000, 60000, 40000, 10000, 30000, 20000, 50000 };
            return View();
        }
    }
}