Internationalization

28 Feb 20222 minutes to read

Chart provide supports for internationalization for below chart elements.

  • Datalabel.
  • Axis label.
  • Tooltip.

For more information about number and date formatter you can refer internationalization.

Globalization

Globalization is the process of designing and developing an component that works in different cultures/locales. Internationalization library is used to globalize number, date, time values in Chart component using LabelFormat property in axis.

Numeric Format

In the below example axis, point and tooltip labels are globalized to EUR.

@Html.EJS().Chart("container").Series(series =>
   {
   series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column).
   Marker(ViewBag.Marker).
   XName("x").
   YName("yValue").
   DataSource(ViewBag.dataSource).
   Name("Gold").
   Width(2).Add();
   }).
   PrimaryXAxis(px => px.Interval(1).ValueType(Syncfusion.EJ2.Charts.ValueType.Category)).
   PrimaryYAxis(py => py.LabelFormat("n1")).
   Title("Olympic Medal Counts - RIO").Render()
public ActionResult Index()
        {
            List<InternalChartData> chartData = new List<InternalChartData>
            {
             new InternalChartData {x= 1900, y= 4,   y1= 2.6 },
             new InternalChartData{ x= 1920, y= 3.0, y1= 2.8 },
             new InternalChartData{ x= 1940, y= 3.8, y1= 2.6},
             new InternalChartData{ x= 1960, y= 3.4, y1= 3 },
             new InternalChartData{ x= 1980, y= 3.2, y1= 3.6 },
             new InternalChartData{ x= 2000, y= 3.9, y1= 3 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class InternalChartData
{
            public double x;
            public double y;
            public double y1;
        }