Having trouble getting help?
Contact Support
Contact Support
Empty Points
24 Feb 20228 minutes to read
The data points those uses the null
or undefined
as value are considered as empty points. The empty data points are ignored and not plotted in the chart. You can customize those points, using the EmptyPointSettings
property in series. The default mode of the empty point is Gap
. Other supported modes are Average
and Zero
.
@Html.EJS().AccumulationChart("container").Series(series =>
{
series.DataSource(ViewBag.dataSource)
.XName("xValue")
.YName("yValue")
.Name("Profit")
.Type(Syncfusion.EJ2.Charts.AccumulationType.Pie)
.DataLabel(ViewBag.datalabel)
.EmptyPointSettings(ViewBag.emptypoint).Add();
})
.EnableSmartLabels(true)
.Title("Annual Product-Wise Profit Analysis")
.LegendSettings(ls => ls.Visible(false))
.Load("load").Render()
public ActionResult Index()
{
List<EmptyPointsChartData> chartData = new List<EmptyPointsChartData>
{
new EmptyPointsChartData { xValue = "Rice", yValue = 80 },
new EmptyPointsChartData { xValue = "Wheat", yValue = null },
new EmptyPointsChartData { xValue = "Oil", yValue = 70 },
new EmptyPointsChartData { xValue = "Corn", yValue = 60 },
new EmptyPointsChartData { xValue = "Gram", yValue = null },
new EmptyPointsChartData { xValue = "Milk", yValue = 70 },
new EmptyPointsChartData { xValue = "Peas", yValue = 80 },
new EmptyPointsChartData { xValue = "Fruit", yValue = 60 },
new EmptyPointsChartData { xValue = "Butter",yValue = null },
};
ViewBag.dataSource = chartData;
return View();
}
public class EmptyPointsChartData
{
public string xValue;
public Nullable<double> yValue;
}
Customization
Specific color for an empty point can be set by using the Fill
property in EmptyPointSettings
and the
border for an empty point can be set by using the Border
property.
@Html.EJS().AccumulationChart("container").Series(series =>
{
series.DataSource(ViewBag.dataSource)
.XName("xValue")
.YName("yValue")
.Name("Profit")
.Type(Syncfusion.EJ2.Charts.AccumulationType.Pie)
.DataLabel(ViewBag.datalabel)
.EmptyPointSettings(ViewBag.emptypoint).Add();
})
.EnableSmartLabels(true)
.Title("Annual Product-Wise Profit Analysis")
.LegendSettings(ls => ls.Visible(false))
.Load("load").Render()
public ActionResult Index()
{
List<EmptyPointsChartData> chartData = new List<EmptyPointsChartData>
{
new EmptyPointsChartData { xValue = "Rice", yValue = 80 },
new EmptyPointsChartData { xValue = "Wheat", yValue = null },
new EmptyPointsChartData { xValue = "Oil", yValue = 70 },
new EmptyPointsChartData { xValue = "Corn", yValue = 60 },
new EmptyPointsChartData { xValue = "Gram", yValue = null },
new EmptyPointsChartData { xValue = "Milk", yValue = 70 },
new EmptyPointsChartData { xValue = "Peas", yValue = 80 },
new EmptyPointsChartData { xValue = "Fruit", yValue = 60 },
new EmptyPointsChartData { xValue = "Butter",yValue = null },
};
ViewBag.dataSource = chartData;
return View();
}
public class EmptyPointsChartData
{
public string xValue;
public Nullable<double> yValue;
}