Column Chart in ASP.NET CORE Charts Component

8 Oct 202424 minutes to read

Column

To render a column series in your chart, you need to follow a few steps to configure it correctly. Here’s a concise guide on how to do this:

  • Set the series type: Define the series type as Column in your chart configuration. This indicates that the data should be represented as a column chart, which is ideal for visualizing for comparing different categories of data or tracking changes over time.
<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Binding data with series

You can bind data to the chart using the dataSource property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName and yName properties.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Series customization

The following properties can be used to customize the column series.

Fill

The fill property determines the color applied to the series.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" fill="blue">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

The fill property can be used to apply a gradient color to the column series. By configuring this property with gradient values, you can create a visually appealing effect in which the color transitions smoothly from one shade to another.

<svg style="width:1px; height:1px">
    <defs>
        <linearGradient id="gradient">
            <stop offset="0%" style="stop-color:blue;stop-opacity:5" />
            <stop offset="50%" style="stop-color:violet;stop-opacity:5" />
        </linearGradient>
    </defs>
</svg>

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" fill="url(#gradient)">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Opacity

The opacity property specifies the transparency level of the fill. Adjusting this property allows you to control how opaque or transparent the fill color of the series appears.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" opacity="0.5">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Dash array

The dashArray property determines the pattern of dashes and gaps in the series.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" dashArray="5,5"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            <e-series-border width="2" Color="#FFA500"></e-series-border>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            ChartBorder border = new ChartBorder();
            border.Width = 2;
            border.Color = "#FFA500";
            ViewBag.border = border;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Border

Use the border property to customize the width and color of the series border.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            <e-series-border width="2" Color="#FFA500"></e-series-border>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            ChartBorder border = new ChartBorder();
            border.Width = 2;
            border.Color = "#FFA500";
            ViewBag.border = border;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Column space and width

Column space

Use the columnSpacing property in the series to adjust the space between columns.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" columnSpacing="0.5"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Column width

Use the columnWidth property in the series to adjust the width of the columns.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" columnWidth="0.75"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Column width in pixel

Use the columnWidthInPixel property in the series to define the exact width of the columns in pixels. This property ensures that each column maintains the specified width, providing a uniform appearance throughout the chart.

<ejs-chart id="container" width="60%">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" columnWidthInPixel="10"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<AxisLabelData> chartData = new List<AxisLabelData>
            {
                new AxisLabelData { x= "South Korea", y= 39.4 },
                new AxisLabelData { x= "India", y= 61.3 }, 
                new AxisLabelData { x= "Pakistan", y= 20.4 },
                new AxisLabelData { x= "Germany", y= 65.1 }, 
                new AxisLabelData { x= "Australia", y= 15.8 },
                new AxisLabelData { x= "Italy", y= 29.2 },
                new AxisLabelData { x= "United Kingdom", y= 44.6 },
                new AxisLabelData { x= "Saudi Arabia", y= 9.7 },
                new AxisLabelData { x= "Russia", y= 40.8 },
                new AxisLabelData { x= "Mexico", y= 31 },
                new AxisLabelData { x= "Brazil", y= 75.9 },
                new AxisLabelData { x= "China", y= 51.4 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class AxisLabelData
        {
            public string x;
            public double y;
        }

Grouped column

Use the groupName property to group the data points in column type charts. Data points with the same group name will be grouped together in the chart, making it easy to compare different sets of data.

<ejs-chart id="container" title="Olympics Medal Tally">
    <e-chart-tooltipsettings enable="true">
    </e-chart-tooltipsettings>
    <e-chart-primaryxaxis valueType="Category" interval=1>
        <e-majorgridlines width="0"></e-majorgridlines>
    </e-chart-primaryxaxis>
    <e-chart-primaryyaxis>
        <e-majorgridlines width="0"></e-majorgridlines>
        <e-majorticklines width="0"></e-majorticklines>
        <e-linestyle width="0"></e-linestyle>
        <e-labelstyle color="transparent"></e-labelstyle>
    </e-chart-primaryyaxis>
    <e-chart-chartarea>
        <e-chartarea-border width="0"></e-chartarea-border>
    </e-chart-chartarea>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='USA_Total' name='USA Total' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="USA" columnWidth=0.7 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font color="#ffffff" fontWeight="600"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='USA_Gold' name='USA Gold' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="USA" columnWidth=0.5 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font fontWeight="600" color="#ffffff"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='UK_Total' name='UK Total' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="UK" columnWidth=0.7 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font color="#ffffff" fontWeight="600"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='UK_Gold' name='UK Gold' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="UK" columnWidth=0.5 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font fontWeight="600" color="#ffffff"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='China_Total' name='China Total' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="China" columnWidth=0.7 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font color="#ffffff" fontWeight="600"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
        <e-series dataSource="ViewBag.dataSource" xName='Year' yName='China_Gold' name='China Gold' width=2
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" groupName="China" columnWidth=0.5 columnSpacing=0.1>
            <e-series-marker>
                <e-series-datalabel visible="true" position="Top">
                    <e-font fontWeight="600" color="#ffffff"></e-font>
                </e-series-datalabel>
            </e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnData> chartData = new List<ColumnData>
            {
                new ColumnData { Year = "2012", USA_Total = 104, USA_Gold = 46, UK_Total = 65, UK_Gold = 29, China_Total = 91, China_Gold = 38},
                new ColumnData { Year = "2016", USA_Total = 121, USA_Gold = 46, UK_Total = 67, UK_Gold = 27, China_Total = 70, China_Gold = 26},
                new ColumnData { Year = "2020", USA_Total = 113, USA_Gold = 39, UK_Total = 65, UK_Gold = 22, China_Total = 88, China_Gold = 38},
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class ColumnData
        {
            public string Year;
            public double USA_Total;
            public double USA_Gold;
            public double UK_Total;
            public double UK_Gold;
            public double China_Total;
            public double China_Gold;
        }

Cylindrical column chart

To render a cylindrical column chart, set the columnFacet property to Cylinder in the chart series. This property transforms the regular columns into cylindrical shapes, enhancing the visual representation of the data.

<ejs-chart id="container" title="Olympic Gold Medal Counts - RIO">
    <e-chart-primaryxaxis valueType="@Syncfusion.EJ2.Charts.ValueType.Category" interval="1"></e-chart-primaryxaxis>
    <e-chart-primaryyaxis title="Medal Count" minimum="0" maximum="80" interval="10">
    </e-chart-primaryyaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="country" yName="gold" tooltipMappingName="tooltipMappingName"
            columnFacet="@Syncfusion.EJ2.Charts.ShapeType.Cylinder"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
        </e-series>
    </e-series-collection>
    <e-chart-tooltipsettings enable="true" header="<b>${point.tooltip}</b>" format="Gold Medal: <b>${point.y}</b>">
    </e-chart-tooltipsettings>
</ejs-chart>
public ActionResult Index()
{
    List<CylindricalChartData> chartData = new List<CylindricalChartData>
    {
        new CylindricalChartData { country= "USA",       gold= 50, tooltipMappingName= "USA"       },
        new CylindricalChartData { country= "Japan",     gold= 70, tooltipMappingName= "Japan"     }, 
        new CylindricalChartData { country= "Australia", gold= 60, tooltipMappingName= "Australia" },
        new CylindricalChartData { country= "France",    gold= 50, tooltipMappingName= "France"    }, 
        new CylindricalChartData { country= "Italy",     gold= 40, tooltipMappingName= "Italy"     },
        new CylindricalChartData { country= "Sweden",    gold= 55, tooltipMappingName= "Sweden"    }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class CylindricalChartData
{
    public string country;
    public double gold;
    public string tooltipMappingName;
}

Empty points

Data points with null or undefined values are considered empty. Empty data points are ignored and not plotted on the chart.

Mode

Use the mode property to define how empty or missing data points are handled in the series. The default mode for empty points is Gap.

<ejs-chart id="container" title="Olympic Medals" width="60%">
    <e-chart-primaryxaxis valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="month" yName="sales"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            <e-series-emptypointsettings mode="Syncfusion.EJ2.Charts.EmptyPointMode.Zero"></e-series-emptypointsettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
{
    List<AxisLabelData> chartData = new List<AxisLabelData>
        {
            new AxisLabelData { month = "Jan", sales = 35 },
            new AxisLabelData { month = "Feb", sales = 28 },
            new AxisLabelData { month = "Mar", sales = 34 },
            new AxisLabelData { month = "Apr", sales = null },
            new AxisLabelData { month = "May", sales = 40 },
            new AxisLabelData { month = "Jun", sales = 32 },
            new AxisLabelData { month = "Jul", sales = 35 },
            new AxisLabelData { month = "Aug" },
            new AxisLabelData { month = "Sep", sales = 38 },
            new AxisLabelData { month = "Oct", sales = 30 },
            new AxisLabelData { month = "Nov", sales = 25 },
            new AxisLabelData { month = "Dec", sales = 32 },
        };
        ViewBag.dataSource = chartData;
        ChartEmptyPointSettings chartEmptyPointSettings = new ChartEmptyPointSettings();
        chartEmptyPointSettings.Mode = EmptyPointMode.Zero;
        ViewBag.emptyPoint = chartEmptyPointSettings;
        return View();
}


public class AxisLabelData
{
    public string month;
    public double? sales;
}

Fill

Use the fill property to customize the fill color of empty points in the series.

<ejs-chart id="container" title="Olympic Medals" width="60%">
    <e-chart-primaryxaxis valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="month" yName="sales"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            <e-series-marker visible="true" width="7" height="7" isFilled="true"></e-series-marker>
            <e-series-emptypointsettings fill="red" mode="@Syncfusion.EJ2.Charts.EmptyPointMode.Zero"></e-series-emptypointsettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
{
    List<AxisLabelData> chartData = new List<AxisLabelData>
        {
            new AxisLabelData { month = "Jan", sales = 35 },
            new AxisLabelData { month = "Feb", sales = 28 },
            new AxisLabelData { month = "Mar", sales = 34 },
            new AxisLabelData { month = "Apr", sales = null },
            new AxisLabelData { month = "May", sales = 40 },
            new AxisLabelData { month = "Jun", sales = 32 },
            new AxisLabelData { month = "Jul", sales = 35 },
            new AxisLabelData { month = "Aug" },
            new AxisLabelData { month = "Sep", sales = 38 },
            new AxisLabelData { month = "Oct", sales = 30 },
            new AxisLabelData { month = "Nov", sales = 25 },
            new AxisLabelData { month = "Dec", sales = 32 },
        };
        ViewBag.dataSource = chartData;
        ChartEmptyPointSettings chartEmptyPointSettings = new ChartEmptyPointSettings();
        chartEmptyPointSettings.Mode = EmptyPointMode.Zero;
        chartEmptyPointSettings.Fill = "red";
        ViewBag.emptyPoint = chartEmptyPointSettings;
        ChartMarkerSettings marker = new ChartMarkerSettings();
        marker.Visible = true;
        marker.Width = 7;
        marker.Height = 7;
        marker.IsFilled = true;
        ViewBag.marker = marker;
        return View();
}


public class AxisLabelData
{
    public string month;
    public double? sales;
}

Border

Use the border property to customize the width and color of the border for empty points.

<ejs-chart id="container" title="Olympic Medals" width="60%">
    <e-chart-primaryxaxis valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="month" yName="sales"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            <e-series-marker visible="true" width="7" height="7" isFilled="true"></e-series-marker>
            <e-series-emptypointsettings fill="red" mode="@Syncfusion.EJ2.Charts.EmptyPointMode.Zero">
                <e-emptypointsettings-border width="2" color="green"></e-emptypointsettings-border>
            </e-series-emptypointsettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
{
    List<AxisLabelData> chartData = new List<AxisLabelData>
        {
            new AxisLabelData { month = "Jan", sales = 35 },
            new AxisLabelData { month = "Feb", sales = 28 },
            new AxisLabelData { month = "Mar", sales = 34 },
            new AxisLabelData { month = "Apr", sales = null },
            new AxisLabelData { month = "May", sales = 40 },
            new AxisLabelData { month = "Jun", sales = 32 },
            new AxisLabelData { month = "Jul", sales = 35 },
            new AxisLabelData { month = "Aug" },
            new AxisLabelData { month = "Sep", sales = 38 },
            new AxisLabelData { month = "Oct", sales = 30 },
            new AxisLabelData { month = "Nov", sales = 25 },
            new AxisLabelData { month = "Dec", sales = 32 },
        };
        ViewBag.dataSource = chartData;
        ChartEmptyPointSettings chartEmptyPointSettings = new ChartEmptyPointSettings();
        chartEmptyPointSettings.Mode = EmptyPointMode.Zero;
        chartEmptyPointSettings.Fill = "red";
        chartEmptyPointSettings.Border.Width = 2;
        chartEmptyPointSettings.Border.Color = "green";
        ViewBag.emptyPoint = chartEmptyPointSettings;
        ChartMarkerSettings marker = new ChartMarkerSettings();
        marker.Visible = true;
        marker.Width = 7;
        marker.Height = 7;
        marker.IsFilled = true;
        ViewBag.marker = marker;
        return View();
}


public class AxisLabelData
{
    public string month;
    public double? sales;
}

Events

Series render

The seriesRender event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.

<ejs-chart id="container" title="Olympic Medals" seriesRender="changeColor" width="60%">
    <e-chart-primaryxaxis valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="month" yName="sales"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" width="2">
        </e-series>
    </e-series-collection>
</ejs-chart>

<script>
    function changeColor(args) {
        args.fill = '#ff6347';
    }
</script>
public ActionResult Index()
{
    List<AxisLabelData> chartData = new List<AxisLabelData>
    {
        new AxisLabelData { month = "Jan", sales = 35 },
        new AxisLabelData { month = "Feb", sales = 28 },
        new AxisLabelData { month = "Mar", sales = 34 },
        new AxisLabelData { month = "Apr", sales = 30 },
        new AxisLabelData { month = "May", sales = 40 },
        new AxisLabelData { month = "Jun", sales = 32 },
        new AxisLabelData { month = "Jul", sales = 35 },
        new AxisLabelData { month = "Aug", sales = 43 },
        new AxisLabelData { month = "Sep", sales = 38 },
        new AxisLabelData { month = "Oct", sales = 30 },
        new AxisLabelData { month = "Nov", sales = 25 },
        new AxisLabelData { month = "Dec", sales = 32 },
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class AxisLabelData
{
    public string month;
    public double? sales;
}

Point render

The pointRender event allows you to customize each data point before it is rendered on the chart.

<ejs-chart id="container" title="Olympic Medals" pointRender="changeColor" width="60%">
    <e-chart-primaryxaxis valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="month" yName="sales"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column" width="2">
            <e-series-marker visible="true" width="7" height="7" isFilled="true"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>

<script>
    function changeColor(args) {
        if (args.point.index % 2 !== 0) {
            args.fill = '#ff6347';
        }
        else {
            args.fill = '#009cb8';
        }
    }
</script>
public ActionResult Index()
{
    List<AxisLabelData> chartData = new List<AxisLabelData>
    {
        new AxisLabelData { month = "Jan", sales = 35 },
        new AxisLabelData { month = "Feb", sales = 28 },
        new AxisLabelData { month = "Mar", sales = 34 },
        new AxisLabelData { month = "Apr", sales = 30 },
        new AxisLabelData { month = "May", sales = 40 },
        new AxisLabelData { month = "Jun", sales = 32 },
        new AxisLabelData { month = "Jul", sales = 35 },
        new AxisLabelData { month = "Aug", sales = 43 },
        new AxisLabelData { month = "Sep", sales = 38 },
        new AxisLabelData { month = "Oct", sales = 30 },
        new AxisLabelData { month = "Nov", sales = 25 },
        new AxisLabelData { month = "Dec", sales = 32 },
    };
    ViewBag.dataSource = chartData;
    ChartMarkerSettings chartMarkerSettings = new ChartMarkerSettings();
    chartMarkerSettings.Visible = true;
    chartMarkerSettings.IsFilled = true;
    chartMarkerSettings.Height = 7;
    chartMarkerSettings.Width = 7;
    ViewBag.marker = chartMarkerSettings;
    return View();
}
public class AxisLabelData
{
    public string month;
    public double? sales;
}

See also