High Low Open Close Chart in React Chart
20 Aug 202624 minutes to read
High Low Open Close
The Hilo Open Close series is used to represent the low, high, open, and closing prices over time. It is commonly used in financial charts to visualize stock price movements.
To render a Hilo Open Close series in your chart, follow these steps:
-
Set the series type: Define the series
typeasHiloOpenClosein your chart configuration. This displays the high, low, open, and close values for each data point. -
Inject the HiloOpenCloseSeries module: Import
HiloOpenCloseSeriesfrom@syncfusion/ej2-react-chartsand add it to<Inject services={...} />so the Hilo Open Close functionality is available. The sample below also injectsTooltip,Category,Crosshair, andZoom. -
Provide high, low, open, and close values: The
HiloOpenCloseseries requires five fields (x,high,low,open, andclose) in each data record.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { Browser } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const border = { border: { width: 0 } };
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} chartArea={border} width={Browser.isDevice ? '100%' : '80%'} title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, LegendSettingsModel,
Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries }
from '@syncfusion/ej2-react-charts';
import { Browser } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const border = { border: { width: 0 } };
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
chartArea={border}
width={Browser.isDevice ? '100%' : '80%'}
title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];Binding data with series
You can bind data to the chart using the dataSource property on the SeriesDirective. The dataSource accepts either a plain JSON array or a Syncfusion DataManager instance for remote endpoints.
Each data record must contain a category field plus the four price fields. Map them to the series using xName, high, low, open, and close.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { Browser } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const border = { border: { width: 0 } };
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} chartArea={border} width={Browser.isDevice ? '100%' : '80%'} title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, LegendSettingsModel,
Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries }
from '@syncfusion/ej2-react-charts';
import { Browser } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const border = { border: { width: 0 } };
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
chartArea={border}
width={Browser.isDevice ? '100%' : '80%'}
title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];Series customization
In the Hilo Open Close series, the bullFillColor property is used to fill the segment when the open value is greater than the close value, while the bearFillColor property is used to fill the segment when the open value is less than the close value. These properties accept any valid CSS color string and can be set directly on the SeriesDirective, for example:
<SeriesDirective bearFillColor="#e56590" bullFillColor="#f8b883" />
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, LegendSettingsModel,
Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries }
from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: 170, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];Empty points
A Hilo Open Close data point is considered empty when any of its open, high, low, or close values is null, undefined, or NaN. By default (Gap mode) the empty point is skipped and leaves a gap on the chart; the mode and fill properties of emptyPointSettings let you override this behavior.
Mode
Use the mode property to control handling of empty points. Available modes are Gap (leave a break, the default), Drop (ignores the empty point during rendering), Zero (plot as zero), and Average (plot as the average of neighboring points). The following sample uses Average mode.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const emptyPoint = { mode: 'Average' };
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883' emptyPointSettings={emptyPoint}>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,LegendSettingsModel,
Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, HiloOpenCloseSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const emptyPoint: object = { mode: 'Average' };
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883' emptyPointSettings={emptyPoint}>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];Fill
Use the fill property to set the fill color for empty points. The following sample renders the empty point in blue.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const emptyPoint = { mode: 'Average', fill: 'blue' };
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883' emptyPointSettings={emptyPoint}>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,LegendSettingsModel,
Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, HiloOpenCloseSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const emptyPoint: object = { mode: 'Average', fill: 'blue' };
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
title='Financial Analysis'>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close' bearFillColor='#e56590' bullFillColor='#f8b883' emptyPointSettings={emptyPoint}>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];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. For Hilo Open Close, the event handler can also override bullFillColor and bearFillColor per render via args.series.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const seriesRender = (args) => {
args.series.bearFillColor = '#ff6347';
args.series.bullFillColor = '#009cb8';
};
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} title='Financial Analysis' seriesRender={seriesRender}>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]}/>
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,LegendSettingsModel,
Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, HiloOpenCloseSeries, ISeriesRenderEventArgs}
from'@syncfusion/ej2-react-charts';
import { EmitType } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const seriesRender: EmitType<ISeriesRenderEventArgs> = (args: ISeriesRenderEventArgs): void => {
args.series.bearFillColor = '#ff6347';
args.series.bullFillColor = '#009cb8';
};
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
title='Financial Analysis'
seriesRender={seriesRender}>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];Point render
The pointRender event provides a hook to customize each data point (for example, border or fill) before it is drawn. Use this to apply per-point styling rules or conditional formatting.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Category, Tooltip, Zoom, Crosshair, HiloOpenCloseSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
const primaryxAxis = { title: 'Date', valueType: 'Category' };
const primaryyAxis = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style = { textAlign: "center" };
const legendSettings = { visible: false };
const pointRender = (args) => {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
};
return <ChartComponent id='charts' style={style} primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} legendSettings={legendSettings} title='Financial Analysis' pointRender={pointRender}>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low' high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));import * as React from "react";
import * as ReactDOM from "react-dom";
import {
AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, LegendSettingsModel,
Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, HiloOpenCloseSeries, IPointRenderEventArgs
}
from '@syncfusion/ej2-react-charts';
import { EmitType } from '@syncfusion/ej2-base';
import { chartData } from './datasource';
function App() {
const primaryxAxis: AxisModel = { title: 'Date', valueType: 'Category' };
const primaryyAxis: AxisModel = { title: 'Price in Dollar', minimum: 100, maximum: 200, interval: 20 };
const style: any = { textAlign: "center" };
const legendSettings: LegendSettingsModel = { visible: false };
const pointRender: EmitType<IPointRenderEventArgs> = (args: IPointRenderEventArgs): void => {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
};
return <ChartComponent id='charts' style={style}
primaryXAxis={primaryxAxis}
primaryYAxis={primaryyAxis}
legendSettings={legendSettings}
title='Financial Analysis'
pointRender={pointRender}>
<Inject services={[HiloOpenCloseSeries, Tooltip, Category, Crosshair, Zoom]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={chartData} xName='x' yName='low' name='SHIRPUR-G' type='HiloOpenClose' low='low'
high='high' open='open' close='close'>
</SeriesDirective>
</SeriesCollectionDirective>
</ChartComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));export let chartData = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];export let chartData: Object[] = [
{ x: 'Jan', open: 120, high: 160, low: 100, close: 140 },
{ x: 'Feb', open: 150, high: 190, low: 130, close: 170 },
{ x: 'Mar', open: 130, high: null, low: 110, close: 150 },
{ x: 'Apr', open: 160, high: 180, low: 120, close: 140 },
{ x: 'May', open: 150, high: 170, low: 110, close: 130 }
];