High Low Chart in TypeScript Charts
Hilo
The Hilo series visualizes stock price movements by displaying the high and low values for each data point using vertical lines. Use it to show the price range of a stock over time without the open or close markers of a HiloOpenClose chart.
To render a Hilo series, configure the chart as follows:
-
Set the series type: Define the series
typeasHilo. Renders the data as a Hilo chart, showing the high and low prices for each period to visualize stock price ranges. -
Inject the required modules: Use
Chart.Inject(HiloSeries)to register the series type. If the x-axis usesvalueType:Category, also injectCategory. Without these modules, the chart cannot render Hilo data. -
Provide high and low values: The
Hiloseries requires two y-values for each data point. Specify both the high and low values; the high value represents the maximum price, and the low value represents the minimum price of the stock.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
//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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];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, high, and low properties.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
//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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Series customization
The following properties can be used to customize the Hilo series.
Fill
The fill property determines the color applied to the series.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
type: 'Hilo', fill: 'blue'
}
],
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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Gradient fill
The fill property accepts an SVG gradient reference, allowing you to apply a gradient color to the Hilo series. Define a <linearGradient> (or <radialGradient>) inside an SVG <defs> block in the page, and assign fill: 'url(#gradientId)' to the series. The chart then renders the segment with a color that transitions smoothly between the gradient stops.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
type: 'Hilo', fill: 'url(#gradient)'
}
],
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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
<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>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Opacity
The opacity property controls the transparency of the fill and affects how the series blends with background or overlapping series.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
type: 'Hilo', opacity: 0.5
}
],
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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Empty points
Data points with null or undefined values are considered empty. Empty data points are handled according to the configured mode.
Mode
Use the mode property to control how empty points are rendered. Available modes are Gap, Drop, Zero, and Average. The default mode is Gap.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high',
low: 'low',
type: 'Hilo',
emptyPointSettings: {
mode: 'Average'
}
}
],
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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ x: 'Jan', low: 87, high: 200 }, { x: 'Feb', low: 45, high: 135 },
{ x: 'Mar', low: 19, high: null }, { x: 'Apr', low: 31, high: 108 },
{ x: 'May', low: 27, high: 80 }, { x: 'Jun', low: 84, high: 130 },
{ x: 'Jul', low: 77, high: 150 }, { x: 'Aug', low: 54, high: undefined },
{ x: 'Sep', low: 60, high: 155 }, { x: 'Oct', low: 60, high: 180 },
{ x: 'Nov', low: 88, high: 180 }, { x: 'Dec', low: 84, high: 230 }
];Fill
Use the fill property to set the fill color for empty points.
import { Chart, HiloSeries, Category } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high',
low: 'low',
type: 'Hilo',
emptyPointSettings: {
mode: 'Average',
fill: 'red'
}
}
],
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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ x: 'Jan', low: 87, high: 200 }, { x: 'Feb', low: 45, high: 135 },
{ x: 'Mar', low: 19, high: null }, { x: 'Apr', low: 31, high: 108 },
{ x: 'May', low: 27, high: 80 }, { x: 'Jun', low: 84, high: 130 },
{ x: 'Jul', low: 77, high: 150 }, { x: 'Aug', low: 54, high: undefined },
{ x: 'Sep', low: 60, high: 155 }, { x: 'Oct', low: 60, high: 180 },
{ x: 'Nov', low: 88, high: 180 }, { x: 'Dec', low: 84, high: 230 }
];Events
Series render
The seriesRender event enables modification of series properties (for example, data, fill, or name) immediately before rendering. Use this event to adjust series appearance or to dynamically swap data sources.
import { Chart, HiloSeries, Category, ISeriesRenderEventArgs } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
//Series type as Hilo
type: 'Hilo'
}
],
title: 'Maximum and Minimum Rainfall',
seriesRender: (args: ISeriesRenderEventArgs) => {
args.fill = '#ff6347';
}
}, '#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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Point render
The pointRender event provides a hook to customize each data point (for example, marker shape, border, or fill) before it is drawn. Use this to apply per-point styling rules or conditional formatting.
import { Chart, HiloSeries, Category, IPointRenderEventArgs } from '@syncfusion/ej2-charts';
import { chartData } from './datasource.ts';
Chart.Inject(HiloSeries, Category);
let chart: Chart = new Chart({
primaryXAxis: {
valueType: 'Category',
title: 'Months'
},
primaryYAxis:
{
labelFormat: '{value}mm',
edgeLabelPlacement: 'Shift',
title: 'Rainfall'
},
series:[
{
dataSource: chartData,
xName: 'x', high: 'high', low: 'low',
//Series type as Hilo
type: 'Hilo'
}
],
title: 'Maximum and Minimum Rainfall',
pointRender: (args: IPointRenderEventArgs) => {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
}
}, '#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://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let chartData: Object[] = [
{ 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: 'Jun', low: 84, high: 130 },
{ x: 'Jul', 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 }
];Troubleshooting
The following list describes common issues you may encounter when working with the Hilo series and how to resolve them.
Chart does not render tick marks: Confirm the type property of the series is set to Hilo. Also ensure HiloSeries and Category are registered with Chart.Inject(HiloSeries, Category) before the chart is initialized, or import the modules directly from @syncfusion/ej2-charts using ES module syntax. The Category module is required because the x-axis uses valueType: 'Category'.
Field mappings produce empty high/low lines: Confirm the data item fields match the series xName, high, and low values. Mismatched field names silently produce empty points.
Gradient fill does not apply: Confirm the SVG <defs> block defines a gradient with a unique id, and that the series fill property uses the exact same id in url(#gradientId). Mismatched ids, missing <defs>, or invalid id values cause the chart to fall back to the default fill.
Empty-point mode produces no visible point: The default mode is Gap, which leaves a gap between segments. To render empty points, switch the mode to Zero or Average and (optionally) set a fill on emptyPointSettings.
Events fire but changes are not visible: The seriesRender and pointRender events let you modify the rendered series or point. Mutate the args object (for example, args.fill) inside the handler; setting properties on the series object directly is overwritten during rendering.