Financial Charts

14 Mar 202218 minutes to read

Financial charts are used to illustrate the movements in the price of a financial instrument over time. Chart supports the following financial series.

Hilo

Hilo Series illustrates the price movements in stock using the high and low values. To render a Hilo series, use series type as Hilo.

Hilo series requires 3 fields (x, high and low) to show the high and low price in the stock.

<ejs-chart id="container" width="60%">
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" xName="x" high="high" low="low"
                      type="@Syncfusion.EJ2.Charts.ChartSeriesType.Hilo">
            </e-series>
        </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<Data> chartData = new List<Data>
            {
            new Data{ x= "Jan", low= 87, high= 200 },
            new Data{ x= "Feb", low= 45, high= 135 },
            new Data{ x= "Mar", low= 19, high= 85 }, 
            new Data{ x= "Apr", low= 31, high= 108 },
            new Data{ x= "May", low= 27, high= 80 },
            new Data{ x= "June",low= 84, high= 130 },
            new Data{ x= "Jul", low= 77, high=150 }, 
            new Data{ x= "Aug", low= 54, high= 125 },
            new Data{ x= "Sep", low= 60, high= 155 },
            new Data{ x= "Oct", low= 60, high= 180 },
            new Data{ x= "Nov", low= 88, high= 180 },
            new Data{ x= "Dec", low= 84, high= 230 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class Data
        {
            public string x;
            public double y;
            public double high;
            public double low;
        }

High Low Open Close

HiloOpenClose series is used to represent the low, high, open and closing values over time. To render a HiloOpenClose series, use series type as HiloOpenClose.

HiloOpenClose series requires 5 fields (x, high, low, open and close) to show the high, low, open and close price values in the stock.

<ejs-chart id="container" width="60%">
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" xName="x" high="high" low="low"
               open="open" close="close" type="@Syncfusion.EJ2.Charts.ChartSeriesType.HiloOpenClose">
            </e-series>
        </e-series-collection>
    </ejs-chart>
public ActionResult Index()
        {
            List<Data> chartData = new List<Data>
            {
            new Data{ x= "Jan", open= 120, high= 160, low= 100, close= 140 },
            new Data{ x= "Feb", open= 150, high= 190, low= 130, close= 170 },
            new Data{ x= "Mar", open= 130, high= 170, low= 110, close= 150 },
            new Data{ x= "Apr", open= 160, high= 180, low= 120, close= 140 },
            new Data{ x= "May", open= 150, high= 170, low= 110, close= 130 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class Data
        {
            public string x;
            public double y;
            public double high;
            public double low;
            public double open;
            public double close;
        }

Customization of HiloOpenClose Series

In HiloOpenClose series, bullFillColor is used to fill the segment when the open value is greater than the close value and bearFillColor is used to fill the segment when the open value is less than the close value.

By default, bullFillColor is set as red and bearFillColor is set as green.

<ejs-chart id="container" width="60%">
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" xName="x" high="high" low="low"
               open="open" close="close" type="@Syncfusion.EJ2.Charts.ChartSeriesType.HiloOpenClose"
                bearFillColor="#e56590" bullFillColor="#f8b883">
            </e-series>
        </e-series-collection>
    </ejs-chart>
public ActionResult Index()
        {
            List<Data> chartData = new List<Data>
            {
            new Data{ x= "Jan", open= 120, high= 160, low= 100, close= 140 },
            new Data{ x= "Feb", open= 150, high= 190, low= 130, close= 170 },
            new Data{ x= "Mar", open= 130, high= 170, low= 110, close= 150 },
            new Data{ x= "Apr", open= 160, high= 180, low= 120, close= 140 },
            new Data{ x= "May", open= 150, high= 170, low= 110, close= 130 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class Data
        {
            public string x;
            public double y;
            public double high;
            public double low;
            public double open;
            public double close;
        }

Candle

Candle series are similar to Hilo Open Close series, are used to represent the low, high, open and closing price over time. To render a candle series, use series type as Candle.

<ejs-chart id="container" width="60%">
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" xName="x" high="high" low="low"
               open="open" close="close" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Candle">
            </e-series>
        </e-series-collection>
    </ejs-chart>
public ActionResult Index()
        {
            List<Data> chartData = new List<Data>
            {
            new Data{ x= "Jan", open= 120, high= 160, low= 100, close= 140 },
            new Data{ x= "Feb", open= 150, high= 190, low= 130, close= 170 },
            new Data{ x= "Mar", open= 130, high= 170, low= 110, close= 150 },
            new Data{ x= "Apr", open= 160, high= 180, low= 120, close= 140 },
            new Data{ x= "May", open= 150, high= 170, low= 110, close= 130 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class Data
        {
            public string x;
            public double y;
            public double high;
            public double low;
            public double open;
            public double close;
        }

Hollow Candles

Candle charts allow to visually compare the current price with previous price by customizing the appearance.

Candles are filled/left as hollow based on the following criteria.

States Description
Filled candle sticks are filled when the close value is lesser than the open value
Unfilled candle sticks are unfilled when the close value is greater than the open value

The color of the candle will be defined by comparing with previous values.

Bear color will be applied when the current closing value is greater than the previous closing value.
Bull color will be applied when the current closing value is less than the previous closing value.

By default, bullFillColor is set as red and bearFillColor is set as green.

Solid Candles

enableSolidCandles is used to enable/disable the solid candles. By default, it is set to be false. The fill color of the candle will be defined by its opening and closing values.

bearFillColor will be applied when the opening value is less than the closing value.
bullFillColor will be applied when the opening value is greater than closing value.

<ejs-chart id="container" width="60%">
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" xName="x" high="high" low="low"
                      open="open" close="close" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Candle"
                      bearFillColor="#e56590" bullFillColor="#f8b883" enableSolidCandles="true">
            </e-series>
        </e-series-collection>
    </ejs-chart>
public ActionResult Index()
        {
            List<Data> chartData = new List<Data>
            {
            new Data{ x= "Jan", open= 120, high= 160, low= 100, close= 140 },
            new Data{ x= "Feb", open= 150, high= 190, low= 130, close= 170 },
            new Data{ x= "Mar", open= 130, high= 170, low= 110, close= 150 },
            new Data{ x= "Apr", open= 160, high= 180, low= 120, close= 140 },
            new Data{ x= "May", open= 150, high= 170, low= 110, close= 130 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class Data
        {
            public string x;
            public double y;
            public double high;
            public double low;
            public double open;
            public double close;
        }

See Also