High low Chart in EJ2 JavaScript control
28 Sep 20238 minutes to read
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
and inject HiloSeries
module using Chart.Inject(HiloSeries)
method.
Hilo series requires 3 fields (x, high and low) to show the high and low price in the stock.
var chartData = [
{ x: 'Jan', low: 87, high: 200 }, { x: 'Feb', low: 45, high: 135 },
{ x: 'Mar', low: 19, high: 85 }, { x: 'Apr', low: 31, high: 108 },
{ x: 'May', low: 27, high: 80 }, { x: 'June', low: 84, high: 130 },
{ x: 'July', low: 77, high: 150 }, { x: 'Aug', low: 54, high: 125 },
{ x: 'Sep', low: 60, high: 155 }, { x: 'Oct', low: 60, high: 180 },
{ x: 'Nov', low: 88, high: 180 }, { x: 'Dec', low: 84, high: 230 }
];
var chart = new ej.charts.Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall',
},
series:[
{
dataSource: chartData, width:2,
xName: 'x', high: 'high', low: 'low',
name: 'India',
//Series type as Hilo
type: 'Hilo'
}
],
title: 'Maximum and Minimum Rainfall'
}, '#element');
<!DOCTYPE html><html lang="en"><head>
<title>EJ2 Animation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Typescript UI Controls">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/23.2.4/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="element"></div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>
Series customization
The following properties can be used to customize the hilo
series.
var chartData = [
{ x: 'Jan', low: 87, high: 200 }, { x: 'Feb', low: 45, high: 135 },
{ x: 'Mar', low: 19, high: 85 }, { x: 'Apr', low: 31, high: 108 },
{ x: 'May', low: 27, high: 80 }, { x: 'June', low: 84, high: 130 },
{ x: 'July', low: 77, high: 150 }, { x: 'Aug', low: 54, high: 125 },
{ x: 'Sep', low: 60, high: 155 }, { x: 'Oct', low: 60, high: 180 },
{ x: 'Nov', low: 88, high: 180 }, { x: 'Dec', low: 84, high: 230 }
];
var chart = new ej.charts.Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall',
},
series:[
{
dataSource: chartData, width:2,
xName: 'x', high: 'high', low: 'low',
name: 'India', fill: 'blue',
//Series type as Hilo
type: 'Hilo'
}
],
title: 'Maximum and Minimum Rainfall'
}, '#element');
<!DOCTYPE html><html lang="en"><head>
<title>EJ2 Animation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Typescript UI Controls">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/23.2.4/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="element"></div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>