Category / Section
What are the options to specify color in ejChart?
1 min read
In Essential Chart, you can specify the color as a string value representing color name or rgb value of the color or hexadecimal code of the color. The following code example explains how to specify color for the Chart.
CSHTML
@(Html.EJ().Chart("container") .Title(title=>title .Text("Chart Title") .Font(font=> font.Color("#458B00"))) .PrimaryXAxis(xAxis=> xAxis.Font(font=> font.Color("Red")) ) .CommonSeriesOptions(options=> options.Fill("rgb(0,0,255)")) )
The following screenshot displays the Chart with different colors for primary X axis labels, series interior and chart title. Here, color name is used to specify label color, rgb value is used to specify series interior color and hexadecimal code is used to specify chart title color.