React Migration in Chart Component

This section explains how to migrate the Chart component from EJ2 React to React. It highlights the API differences where property names or usage patterns changed and shows how to enable those APIs in JSX.

Chart Properties

EJ2 ReactReactDescription

Props: focusBorderWidth, focusBorderColor, focusBorderMargin

<ChartComponent focusBorderWidth={1.5} focusBorderColor="#4C4C4C" focusBorderMargin={2}> </ChartComponent>

Props: focusOutline

<Chart focusOutline={{ width: 1.5, color: '#4C4C4C', offset: 2 }}> </Chart>

In EJ2 React, focus styling was controlled by three separate props. In React, these settings are consolidated into the focusOutline object, where you configure the width, color, and offset in a single prop.

Props: isTransposed

<ChartComponent isTransposed={true}> </ChartComponent>

Props: transposed

<Chart transposed={true}> </Chart>

The isTransposed flag in EJ2 React has been renamed to transposed in React. Set this prop to true to render the chart with the X and Y axes swapped.

Chart Area

EJ2 ReactReactDescription

API: chartArea={} (object exposed on root component)

<ChartComponent chartArea={{ background: '#F0F0F0', width: 600 }}> </ChartComponent>

API: <ChartArea />

<Chart> <ChartArea background="#F0F0F0" width={600} /> </Chart>

The chart area configuration moves from an inline object chartArea on the <ChartComponent> to a dedicated <ChartArea /> component. Property names (background, backgroundImage, border, margin, opacity, width) remain unchanged and can be directly set as props on <ChartArea />.

Title

EJ2 ReactReactDescription

Props: titleStyle={{ textAlignment: 'Center' }}

<ChartComponent titleStyle={{ textAlignment: 'Center' }}> </ChartComponent>

Props: align

<ChartTitle align="Center"> </ChartTitle>

Determines the alignment of the title within its container. • Available options: • Left: Aligns the title to the left. • Center: Aligns the title to the center. • Right: Aligns the title to the right.

Props: titleStyle={{ background: '#F4F4F4' }}

<ChartComponent titleStyle={{ background: '#F4F4F4' }}> </ChartComponent>

Props: background

<ChartTitle background="#F4F4F4"> </ChartTitle>

The background color of the chart title area. Accepts any valid CSS color value.

Props: titleStyle={{ border: { color: '#DDDDDD', width: 1 } }}

<ChartComponent titleStyle={{ border: { color: '#DDDDDD', width: 1 } }}> </ChartComponent>

Props: border

<ChartTitle border={{ color: '#DDDDDD', width: 1 }}> </ChartTitle>

Defines the border styling for the chart title area.

Props: titleStyle={{ color: '#333333' }}

<ChartComponent titleStyle={{ color: '#333333' }}> </ChartComponent>

Props: color

<ChartTitle color="#333333"> </ChartTitle>

Sets the color of the title. Accepts any valid CSS color string, including hexadecimal and RGBA formats.

Props: titleStyle={{ fontFamily: 'Arial' }}

<ChartComponent titleStyle={{ fontFamily: 'Arial' }}> </ChartComponent>

Props: fontFamily

<ChartTitle fontFamily="Arial"> </ChartTitle>

Specifies the font family used for the title (e.g., 'Arial', 'Verdana', 'sans-serif').

Props: titleStyle={{ size: '18px' }}

<ChartComponent titleStyle={{ size: '18px' }}> </ChartComponent>

Props: fontSize

<ChartTitle fontSize="18px"> </ChartTitle>

Sets the font size of the text in pixels.

Props: titleStyle={{ fontStyle: 'Italic' }}

<ChartComponent titleStyle={{ fontStyle: 'Italic' }}> </ChartComponent>

Props: fontStyle

<ChartTitle fontStyle="Italic"> </ChartTitle>

Specifies the font style of the title (e.g., 'Normal', 'Italic').

Props: titleStyle={{ fontWeight: '600' }}

<ChartComponent titleStyle={{ fontWeight: '600' }}> </ChartComponent>

Props: fontWeight

<ChartTitle fontWeight="600"> </ChartTitle>

Specifies the font weight (thickness) of the title (e.g., 'Normal', 'Bold', '400').

Props: titleStyle={{ opacity: 0.8 }}

<ChartComponent titleStyle={{ opacity: 0.8 }}> </ChartComponent>

Props: opacity

<ChartTitle opacity={0.8}> </ChartTitle>

Sets the opacity level of the title. A value of 1 means fully opaque, while 0 means fully transparent.

Props: titleStyle={{ position: 'Top' }}

<ChartComponent titleStyle={{ position: 'Top' }}> </ChartComponent>

Props: position

<ChartTitle position="Top"> </ChartTitle>

Determines the position of the chart title relative to the chart area. Available options: • Top: Displays the title above the chart. • Left: Displays the title to the left of the chart. • Bottom: Displays the title below the chart. • Right: Displays the title to the right of the chart. • Custom: Allows manual positioning using x and y coordinates.

Props: title="Sales Overview"

<ChartComponent title="Sales Overview"> </ChartComponent>

Props: text

<ChartTitle text="Sales Overview"> </ChartTitle>

Specifies the main title text of the chart. This text provides context or a label for the chart's data.

Props: titleStyle={{ textOverflow: 'Trim' }}

<ChartComponent titleStyle={{ textOverflow: 'Trim' }}> </ChartComponent>

Props: textOverflow

<ChartTitle textOverflow="Trim"> </ChartTitle>

Controls how the title behaves when it overflows its container. Available options: • Wrap: Wraps the text onto a new line. • Trim: Trims the overflowed text. • None: Displays the text even when it overflows.

Props: titleStyle={{ x: 50 }}

<ChartComponent titleStyle={{ x: 50 }}> </ChartComponent>

Props: x

<ChartTitle x={50}> </ChartTitle>

X-coordinate for positioning the chart title. Only applicable when position is set to Custom.

Props: titleStyle={{ y: 20 }}

<ChartComponent titleStyle={{ y: 20 }}> </ChartComponent>

Props: y

<ChartTitle y={20}> </ChartTitle>

Y-coordinate for positioning the chart title.Only applicable when position is set to Custom.

Rows

EJ2 ReactReactDescription

API: rows: [{ border: { ... }, height: '50%' }] (array of row objects)

<ChartComponent rows={[ { border: { color: '#000', width: 1, dashArray: '5,5' }, height: '50%' } ]}> </ChartComponent>

API: <ChartRows> + <ChartRow />

<Chart> <ChartRows> <ChartRow border={{ color: '#000', width: 1, dashArray: '5,5' }} height="50%" /> </ChartRows> </Chart>

Rows configuration moves from an array of objects on the ChartComponent to dedicated components <ChartRows> and <ChartRow />. Property names (border, height) remain unchanged and can be directly set on <ChartRow />.

Columns

EJ2 ReactReactDescription

API: columns: [{ border: { ... }, width: '50%' }] (array of column objects)

<ChartComponent columns={[ { border: { color: '#000', width: 1, dashArray: '5,5' }, width: '50%' } ]}> </ChartComponent>

API: <ChartColumns> + <ChartColumn />

<Chart> <ChartColumns> <ChartColumn border={{ color: '#000', width: 1, dashArray: '5,5' }} width="50%" /> </ChartColumns> </Chart>

Columns configuration moves from an array of objects on the ChartComponent to dedicated components <ChartColumns> and <ChartColumn />. Property names (border, width) remain unchanged and can be directly set on <ChartColumn />.

Series

EJ2 ReactReactDescription

Props: colorName

<SeriesCollectionDirective> <SeriesDirective colorName='ColorField' /> </SeriesCollectionDirective>

Props: colorField

<ChartSeriesCollection> <ChartSeries colorField="ColorField" /> </ChartSeriesCollection>

Maps a data source field to assign individual colors to each point in the series.

Props: size

<SeriesCollectionDirective> <SeriesDirective size='BubbleSize' /> </SeriesCollectionDirective>

Props: sizeField

<ChartSeriesCollection> <ChartSeries sizeField="BubbleSize" /> </ChartSeriesCollection>

Specifies the name of the data field that contains the values used to determine the size (radius) of each bubble in a bubble chart.

Props: tooltipMappingName

<SeriesCollectionDirective> <SeriesDirective tooltipMappingName='TooltipContent' /> </SeriesCollectionDirective>

Props: tooltipField

<ChartSeriesCollection> <ChartSeries tooltipField="TooltipContent" /> </ChartSeriesCollection>

Maps a specific field from the data source to use as tooltip content. The mapped field's value is stored in the point's tooltip property and it can be accessed through tooltip format.

Props: xName

<SeriesCollectionDirective> <SeriesDirective xName='Category' /> </SeriesCollectionDirective>

Props: xField

<ChartSeriesCollection> <ChartSeries xField="Category" /> </ChartSeriesCollection>

Specifies the name of the field in the data source that maps values to the x-axis of the chart. This property is essential for identifying which data dimension should be plotted horizontally, such as categories, timestamps, or numerical values.

Props: yName

<SeriesCollectionDirective> <SeriesDirective yName='Sales' /> </SeriesCollectionDirective>

Props: yField

<ChartSeriesCollection> <ChartSeries yField="Sales" /> </ChartSeriesCollection>

Specifies the name of the field in the data source that provides the values to be plotted along the y-axis. This property is used to map vertical data points in the chart, such as numerical values or metrics.

Marker

EJ2 ReactReactDescription

Props: marker={{ isFilled: true }}

<SeriesCollectionDirective> <SeriesDirective marker={{ isFilled: true }} /> </SeriesCollectionDirective>

Component Props: filled on <ChartMarker />

<ChartSeriesCollection> <ChartSeries> <ChartMarker filled={true} /> </ChartSeries> </ChartSeriesCollection>

Determines whether the marker should be filled with the series color. When set to true, the marker is filled using the corresponding series color, enhancing visual distinction. When set to false, the marker will be rendered with no fill or default styling.

Props: marker={{ allowHighlight: true }}

<SeriesCollectionDirective> <SeriesDirective marker={{ allowHighlight: true }} /> </SeriesCollectionDirective>

Component Props: highlightable on <ChartMarker />

<ChartSeriesCollection> <ChartSeries> <ChartMarker highlightable={true} /> </ChartSeries> </ChartSeriesCollection>

When set to true, markers are visually emphasized on hover or selection, enhancing visibility and user feedback during data exploration.

Data Label

EJ2 ReactReactDescription

Props: dataLabel={{ rx: 4, ry: 4 }}

<SeriesCollectionDirective> <SeriesDirective dataLabel={{ rx: 4, ry: 4 }} /> </SeriesCollectionDirective>

Component Props: borderRadius on <ChartDataLabel />

<ChartSeriesCollection> <ChartSeries> <ChartDataLabel borderRadius={{ x: 4, y: 4 }} /> </ChartSeries> </ChartSeriesCollection>

Specifies the horizontal (x) and vertical (y) corner radius for the background of the data label. This controls how rounded the corners of the label background appear.

Props: dataLabel={{ labelIntersectAction: 'Hide' }}

<SeriesCollectionDirective> <SeriesDirective dataLabel={{ labelIntersectAction: 'Hide' }} /> </SeriesCollectionDirective>

Component Props: intersectMode on <ChartDataLabel />

<ChartSeriesCollection> <ChartSeries> <ChartDataLabel intersectMode="Hide" /> </ChartSeries> </ChartSeriesCollection>

Specifies how overlapping data labels are handled. Available options: • None - Labels are displayed without overlap. • Hide - Overlapping labels are hidden. • Trim - Truncates labels with ellipsis to avoid overlap. • Wrap - Wraps labels onto multiple lines when space is limited. • Rotate90 - Labels are rotated 90° to reduce overlap.

Props: dataLabel={{ name: 'Category' }}

<SeriesCollectionDirective> <SeriesDirective dataLabel={{ name: 'Category' }} /> </SeriesCollectionDirective>

Component Props: labelField on <ChartDataLabel />

<ChartSeriesCollection> <ChartSeries> <ChartDataLabel labelField="Category" /> </ChartSeries> </ChartSeriesCollection>

Maps a specific field from the data source to use as the data label content. The mapped field's value is displayed as the label for each data point.

Props: dataLabel={{ angle: 45 }}

<SeriesCollectionDirective> <SeriesDirective dataLabel={{ angle: 45 }} /> </SeriesCollectionDirective>

Component Props: rotationAngle on <ChartDataLabel />

<ChartSeriesCollection> <ChartSeries> <ChartDataLabel rotationAngle={45} /> </ChartSeries> </ChartSeriesCollection>

Specifies the rotation angle (in degrees) for the data label. A positive value rotates the label clockwise, while a negative value rotates it counterclockwise. This property is only effective when enableRotation is set to true.

Props: dataLabel={{ alignment: 'Center' }}

<SeriesCollectionDirective> <SeriesDirective dataLabel={{ alignment: 'Center' }} /> </SeriesCollectionDirective>

Component Props: textAlign on <ChartDataLabel />

<ChartSeriesCollection> <ChartSeries> <ChartDataLabel textAlign="Center" /> </ChartSeries> </ChartSeriesCollection>

Sets the alignment of the data label relative to the data point. Available options: • Left - Left-aligned. • Center - Center-aligned. • Right - Right-aligned.

Axis

EJ2 ReactReactDescription

Props: primaryXAxis={{ isIndexed: true }}

<ChartComponent primaryXAxis={{ isIndexed: true }}> </ChartComponent>

Component Props: indexed on <ChartPrimaryXAxis />

<Chart> <ChartPrimaryXAxis indexed={true} /> </Chart>

When set to true, data points are rendered based on their index position rather than their actual x-axis values.

Props: primaryXAxis={{ isInversed: true }}

<ChartComponent primaryXAxis={{ isInversed: true }}> </ChartComponent>

Component Props: inverted on <ChartPrimaryXAxis />

<Chart> <ChartPrimaryXAxis inverted={true} /> </Chart>

When set to true, the axis is rendered in reverse order, displaying values from maximum to minimum.

Props: primaryXAxis={{ maximumLabels: 3 }}

<ChartComponent primaryXAxis={{ maximumLabels: 3 }}> </ChartComponent>

Component Props: maxLabelDensity on <ChartPrimaryXAxis />

<Chart> <ChartPrimaryXAxis maxLabelDensity={3} /> </Chart>

Specifies the maximum number of labels per 100 pixels of axis length.

Major Grid Lines

EJ2 ReactReactDescription

API: primaryXAxis={{ majorGridLines: { ... } }}

<ChartComponent primaryXAxis={{ majorGridLines: { color: '#E0E0E0', width: 1 } }}> </ChartComponent>

API: <ChartPrimaryXAxis> + <ChartMajorGridLines />

<Chart> <ChartPrimaryXAxis> <ChartMajorGridLines color="#E0E0E0" width={1} /> </ChartPrimaryXAxis> </Chart>

The major grid lines configuration moves from the inline majorGridLines object inside primaryXAxis to a dedicated <ChartMajorGridLines /> component nested under <ChartPrimaryXAxis />. Property names (color, dashArray, width) remain unchanged.

Major Tick Lines

EJ2 ReactReactDescription

API: primaryXAxis={{ majorTickLines: { ... } }}

<ChartComponent primaryXAxis={{ majorTickLines: { color: '#999999', height: 8, width: 1 } }}> </ChartComponent>

API: <ChartPrimaryXAxis> + <ChartMajorTickLines />

<Chart> <ChartPrimaryXAxis> <ChartMajorTickLines color="#999999" height={8} width={1} /> </ChartPrimaryXAxis> </Chart>

The major tick lines configuration moves from the inline majorTickLines object inside primaryXAxis to a dedicated <ChartMajorTickLines /> component nested under <ChartPrimaryXAxis />. Property names (color, height, width) remain unchanged.

Minor Grid Lines

EJ2 ReactReactDescription

API: primaryXAxis={{ minorGridLines: { ... } }}

<ChartComponent primaryXAxis={{ minorGridLines: { color: '#CCCCCC', width: 1 } }}> </ChartComponent>

API: <ChartPrimaryXAxis> + <ChartMinorGridLines />

<Chart> <ChartPrimaryXAxis> <ChartMinorGridLines color="#CCCCCC" width={1} dashArray="2,2" /> </ChartPrimaryXAxis> </Chart>

The minor grid lines configuration moves from the inline minorGridLines object inside primaryXAxis to a dedicated <ChartMinorGridLines /> component nested under <ChartPrimaryXAxis />. Property names (color, dashArray, width) remain unchanged.

Minor Tick Lines

EJ2 ReactReactDescription

API: primaryXAxis={{ minorTickLines: { ... } }}

<ChartComponent primaryXAxis={{ minorTickLines: { color: '#AAAAAA', height: 5, width: 1 } }}> </ChartComponent>

API: <ChartPrimaryXAxis> + <ChartMinorTickLines />

<Chart> <ChartPrimaryXAxis> <ChartMinorTickLines color="#AAAAAA" height={5} width={1} /> </ChartPrimaryXAxis> </Chart>

The minor tick lines configuration moves from the inline minorTickLines object inside primaryXAxis to a dedicated <ChartMinorTickLines /> component nested under <ChartPrimaryXAxis />. Property names (color, height, width) remain unchanged.

Axis Label

EJ2 ReactReactDescription

Props: primaryXAxis={{ labelStyle: { textAlignment: 'Center' } }}

<ChartComponent primaryXAxis={{ labelStyle: { textAlignment: 'Center' } }}> </ChartComponent>

Component Props: align on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel align="Center" /> </ChartPrimaryXAxis> </Chart>

Sets the alignment of the axis label relative to the tick mark. Available options: • Left - Aligns label to the left. • Center - Centers the label. • Right - Aligns label to the right.

Props: primaryXAxis={{ labelStyle: { size: 12 } }}

<ChartComponent primaryXAxis={{ labelStyle: { size: 12 } }}> </ChartComponent>

Component Props: fontSize on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel fontSize={12} /> </ChartPrimaryXAxis> </Chart>

Sets the font size of the text in pixels.

Props: primaryXAxis={{ labelFormat: '\${value}' }}

<ChartComponent primaryXAxis={{ labelFormat: '${value}' }}> </ChartComponent>

Component Props: format on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel format="${value}" /> </ChartPrimaryXAxis> </Chart>

Used to format the axis label. This property accepts global string formats such as C, n1, P, etc. It also accepts placeholders like {value}°C, where {value} represents the axis label (e.g., 20°C).

Props: primaryXAxis={{ labelIntersectAction: 'Rotate45' }}

<ChartComponent primaryXAxis={{ labelIntersectAction: 'Rotate45' }}> </ChartComponent>

Component Props: intersectAction on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel intersectAction="Rotate45" /> </ChartPrimaryXAxis> </Chart>

Defines how overlapping labels on the axis are handled. Available options: • None - No special action for overlapping. • Hide - Hides overlapping labels. • Trim - Trims labels to fit. • Rotation - Rotates labels. • MultipleRows - Places each label on its own row.

Props: primaryXAxis={{ labelPadding: 10 }}

<ChartComponent primaryXAxis={{ labelPadding: 10 }}> </ChartComponent>

Component Props: placement on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel placement="10px" /> </ChartPrimaryXAxis> </Chart>

Adjusts the vertical spacing between the axis labels and the axis line. A higher value increases the distance, ensuring better readability.

Props: primaryXAxis={{ labelPosition: 'Inside' }}

<ChartComponent primaryXAxis={{ labelPosition: 'Inside' }}> </ChartComponent>

Component Props: position on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel position="Inside" /> </ChartPrimaryXAxis> </Chart>

Determines the position of the labels relative to the axis line. Available options: • Inside - Positions labels inside the axis area. • Outside - Positions labels outside the axis area. • Auto - Automatically determines the best position based on available space.

Props: primaryXAxis={{ labelRotation: 45 }}

<ChartComponent primaryXAxis={{ labelRotation: 45 }}> </ChartComponent>

Component Props: rotationAngle on <ChartAxisLabel />

<Chart> <ChartPrimaryXAxis> <ChartAxisLabel rotationAngle={45} /> </ChartPrimaryXAxis> </Chart>

Specifies the angle in degrees to rotate the axis label text. A positive value rotates the label clockwise, and a negative value rotates it counterclockwise.

Axis Title

EJ2 ReactReactDescription

Props: primaryXAxis={{ titleStyle: { textAlignment: 'Center' } }}

<ChartComponent primaryXAxis={{ titleStyle: { textAlignment: 'Center' } }}> </ChartComponent>

Component Props: align on <ChartAxisTitle />

<Chart> <ChartPrimaryXAxis> <ChartAxisTitle align="Center" /> </ChartPrimaryXAxis> </Chart>

Sets the alignment of the axis title relative to the axis. Available options: • Left - Aligns title to the left. • Center - Centers the title. • Right - Aligns title to the right.

Props: primaryXAxis={{ titleStyle: { textOverflow: 'Trim' } }}

<ChartComponent primaryXAxis={{ titleStyle: { textOverflow: 'Trim' } }}> </ChartComponent>

Component Props: overflow on <ChartAxisTitle />

<Chart> <ChartPrimaryXAxis> <ChartAxisTitle overflow="Trim" /> </ChartPrimaryXAxis> </Chart>

Controls how the axis title behaves when it overflows its container. Available options: • Wrap: Wraps the text onto a new line. • Trim: Trims the overflowed text. • None: Displays the text even when it overflows.

Props: primaryXAxis={{ titlePadding: 10 }}

<ChartComponent primaryXAxis={{ titlePadding: 10 }}> </ChartComponent>

Component Props: padding on <ChartAxisTitle />

<Chart> <ChartPrimaryXAxis> <ChartAxisTitle padding={10} /> </ChartPrimaryXAxis> </Chart>

Specifies the padding between the axis title and the axis labels.

Props: primaryXAxis={{ titleRotation: 45 }}

<ChartComponent primaryXAxis={{ titleRotation: 45 }}> </ChartComponent>

Component Props: rotationAngle on <ChartAxisTitle />

<Chart> <ChartPrimaryXAxis> <ChartAxisTitle rotationAngle={45} /> </ChartPrimaryXAxis> </Chart>

Defines an angle for rotating the axis title. By default, the angle is calculated based on the position and orientation of the axis.

Props: primaryXAxis={{ title: 'X-Axis Title' }}

<ChartComponent primaryXAxis={{ title: 'X-Axis Title' }}> </ChartComponent>

Component Props: text on <ChartAxisTitle />

<Chart> <ChartPrimaryXAxis> <ChartAxisTitle text="X-Axis Title" /> </ChartPrimaryXAxis> </Chart>

Specifies the text content of the axis title.

Strip Lines

EJ2 ReactReactDescription

API: primaryXAxis={{ stripLines: [{ startFromAxis: true, start: 10, end: 20, size: 5, sizeType: 'Pixel' }] }}

<ChartComponent primaryXAxis={{ stripLines: [{ startFromAxis: true, start: 10, end: 20, size: 5, sizeType: 'Pixel' }] }}> </ChartComponent>

Component Props: Range on <ChartStripLine />

<Chart> <ChartPrimaryXAxis> <ChartStripLines> <ChartStripLine Range={{ shouldStartFromAxis: true, start: 10, end: 20, size: 5, sizeType: 'Pixel' }} /> </ChartStripLines> </ChartPrimaryXAxis> </Chart>

Specifies the range and dimensions of the strip line on the axis. This object defines where the strip line begins, its width or height, and how its size is calculated, forming the core of the highlighted region.

Props: primaryXAxis={{ stripLines: [{ isRepeat: true, repeatUntil: 100, repeatEvery: 10 }] }}

<ChartComponent primaryXAxis={{ stripLines: [{ isRepeat: true, repeatUntil: 100, repeatEvery: 10 }] }}> </ChartComponent>

Component Props: repeat on <ChartStripLine />

<Chart> <ChartPrimaryXAxis> <ChartStripLines> <ChartStripLine repeat={{ enable: true, until: 100, every: 10 }} /> </ChartStripLines> </ChartPrimaryXAxis> </Chart>

Configures repeating strip lines that recur at a regular interval. This is useful for highlighting patterns, such as weekends on a date-time axis or alternating bands for every 'n' units on a numeric axis.

Props: primaryXAxis={{ stripLines: [{ isSegmented: true, segmentStart: 0, segmentEnd: 50, segmentAxisName: 'primaryYAxis' }] }}

<ChartComponent primaryXAxis={{ stripLines: [{ isSegmented: true, segmentStart: 0, segmentEnd: 50, segmentAxisName: 'primaryYAxis' }] }}> </ChartComponent>

Component Props: segment on <ChartStripLine />

<Chart> <ChartPrimaryXAxis> <ChartStripLines> <ChartStripLine segment={{ enable: true, start: 0, end: 50, axisName: 'primaryYAxis' }} /> </ChartStripLines> </ChartPrimaryXAxis> </Chart>

Configures a segmented strip line that is rendered only within the specified range of another axis. This enables the creation of conditional highlights that are visible only when a data point falls within a specific range on two different axes.

Props: primaryXAxis={{ stripLines: [{ color: '#FF0000', opacity: 0.5, dashArray: '5,5', imageUrl: 'bg.png', border: { color: '#000', width: 2 }, zIndex: 'Over' }] }}

<ChartComponent primaryXAxis={{ stripLines: [{ color: '#FF0000', opacity: 0.5, dashArray: '5,5', imageUrl: 'bg.png', border: { color: '#000', width: 2 }, zIndex: 'Over' }] }}> </ChartComponent>

Component Props: Style on <ChartStripLine />

<Chart> <ChartPrimaryXAxis> <ChartStripLines> <ChartStripLine Style={{ color: '#FF0000', opacity: 0.5, dashArray: '5,5', imageUrl: 'bg.png', border: { color: '#000', width: 2 }, zIndex: 'Over' }} /> </ChartStripLines> </ChartPrimaryXAxis> </Chart>

Customizes the visual appearance of the strip line, including its background and border. You can set properties like color, opacity, background images, and dash patterns to make the strip line stand out or blend in with the chart's design.

Props: primaryXAxis={{ stripLines: [{ text: 'Annotation', textStyle: { fontFamily: 'Arial', fontStyle: 'Italic', fontWeight: 'Bold', opacity: 0.8, color: '#000' }, rotation: 45, verticalAlignment: 'Bottom', horizontalAlignment: 'Center' }] }}

<ChartComponent primaryXAxis={{ stripLines: [{ text: 'Annotation', textStyle: { fontFamily: 'Arial', fontStyle: 'Italic', fontWeight: 'Bold', opacity: 0.8, color: '#000' }, rotation: 45, verticalAlignment: 'Bottom', horizontalAlignment: 'Center' }] }}> </ChartComponent>

Component Props: text on <ChartStripLine />

<Chart> <ChartPrimaryXAxis> <ChartStripLines> <ChartStripLine text={{ content: 'Annotation', style: { color: '#000', fontFamily: 'Arial', fontSize: '12px', fontStyle: 'Italic', fontWeight: 'Bold', opacity: 0.8 }, rotation: 45, hAlign: 'Center', vAlign: 'Bottom' }} /> </ChartStripLines> </ChartPrimaryXAxis> </Chart>

Configures the text displayed within the strip line. This allows you to add descriptive labels or annotations directly on the highlighted range, with options to control text content, styling, rotation, and alignment.

Axes

EJ2 ReactReactDescription

API: axes: [{}] (array of axis objects)

<ChartComponent axes={[]}> </ChartComponent>

API: <ChartAxes> + <ChartAxis />

<Chart> <ChartAxes> <ChartAxis> <ChartAxisTitle /> </ChartAxis> </ChartAxes> </Chart>

Axes configuration moves from an array of objects on the ChartComponent to dedicated components <ChartAxes> and <ChartAxis>. Sub-components like <ChartAxisLabel /> and <ChartAxisTitle /> can be nested under <ChartAxis /> for detailed styling.

Legend

EJ2 ReactReactDescription

API: legendSettings={} (object)

<ChartComponent legendSettings={{ alignment: 'Near', isInversed: true, title: 'Legend Title', titleStyle: { textAlignment: 'Center', textOverflow: 'Ellipsis', size: 14 } }}> </ChartComponent>

API: <ChartLegend />

<Chart> <ChartLegend align="Near" inversed={true} title="Legend Title" titleAlign="Center" titleOverflow="Ellipsis" fontSize={14} /> </Chart>

The legend configuration moves from an inline legendSettings object on the ChartComponent to a dedicated <ChartLegend /> component. Changed property names include alignmentalign, isInversedinversed, titleStyle.textAlignmenttitleAlign, titleStyle.textOverflowtitleOverflow, and titleStyle.sizefontSize. Other properties like background, border, etc., keep the same names.

Props: legendSettings={{ alignment: 'Near' }}

<ChartComponent legendSettings={{ alignment: 'Near' }}> </ChartComponent>

Props: align on <ChartLegend />

<Chart> <ChartLegend align="Near" /> </Chart>

Specifies the horizontal alignment of the legend items. Available options: • Near - Aligns items to the left. • Center - Centers the items. • Far - Aligns items to the right.

Props: legendSettings={{ isInversed: true }}

<ChartComponent legendSettings={{ isInversed: true }}> </ChartComponent>

Props: inversed on <ChartLegend />

<Chart> <ChartLegend inversed={true} /> </Chart>

When enabled, reverses the order of elements within each legend item. Places text before the shape/symbol instead of the default shape-then-text order.

Props: legendSettings={{ titleStyle: { textAlignment: 'Center' } }}

<ChartComponent legendSettings={{ titleStyle: { textAlignment: 'Center' } }}> </ChartComponent>

Props: titleAlign on <ChartLegend />

<Chart> <ChartLegend titleAlign="Center" /> </Chart>

Sets the alignment of the legend title relative to the legend area. Available options: • Left - Aligns title to the left. • Center - Centers the title. • Right - Aligns title to the right.

Props: legendSettings={{ titleStyle: { textOverflow: 'Ellipsis' } }}

<ChartComponent legendSettings={{ titleStyle: { textOverflow: 'Ellipsis' } }}> </ChartComponent>

Props: titleOverflow on <ChartLegend />

<Chart> <ChartLegend titleOverflow="Ellipsis" /> </Chart>

Controls how the legend title behaves when it overflows its container. Available options: • Wrap: Wraps the text onto a new line. • Ellipsis: Trims the overflowed text and adds ellipsis. • None: Displays the text even when it overflows.

Props: legendSettings={{ titleStyle: { size: 14 } }}

<ChartComponent legendSettings={{ titleStyle: { size: 14 } }}> </ChartComponent>

Props: fontSize on <ChartLegend />

<Chart> <ChartLegend fontSize={14} /> </Chart>

Sets the font size of the legend title in pixels.

Tooltip

EJ2 ReactReactDescription

API: tooltip={} (object)

<ChartComponent tooltip={{ enable: true, shared: true, header: 'Sales', enableMarker: true }}> </ChartComponent>

API: <ChartTooltip />

<Chart> <ChartTooltip enable={true} shared={true} headerText="Sales" showMarker={true} /> </Chart>

The tooltip configuration moves from an inline tooltip object on the ChartComponent to a dedicated <ChartTooltip /> component. Changed property names include headerheaderText, enableMarkershowMarker. Other properties like border, fill, opacity, etc., keep the same names.

Props: tooltip={{ header: 'Sales Data' }}

<ChartComponent tooltip={{ header: 'Sales Data' }}> </ChartComponent>

Props: headerText on <ChartTooltip />

<Chart> <ChartTooltip headerText="Sales Data" /> </Chart>

Customizes the header text displayed at the top of the tooltip. By default, displays the series name.

Props: tooltip={{ enableMarker: true }}

<ChartComponent tooltip={{ enableMarker: true }}> </ChartComponent>

Props: showMarker on <ChartTooltip />

<Chart> <ChartTooltip showMarker={true} /> </Chart>

When set to true, displays colored markers within the tooltip to indicate the corresponding series for each data point.

Props: tooltip={{ textStyle: { size: 14 } }}

<ChartComponent tooltip={{ textStyle: { size: 14, color: '#000' } }}> </ChartComponent>

Props: fontSize on <ChartTooltip />

<Chart> <ChartTooltip fontSize={14} textStyle={{ color: '#000' }} /> </Chart>

Sets the font size of the tooltip text in pixels.

Zoom Settings

EJ2 ReactReactDescription

API: zoomSettings={} (object)

<ChartComponent zoomSettings={{ mode: 'XY', enablePan: true, showToolbar: true, toolbarItems: ['Zoom', 'ZoomIn', 'Pan'] }}> </ChartComponent>

API: <ChartZoomSettings />

<Chart> <ChartZoomSettings mode="XY" pan={true} toolbar={{ visible: true, items: ['ZoomIn', 'ZoomOut', 'Pan'] }} /> </Chart>

The zoom settings have moved from the inline zoomSettings object on the ChartComponent to a dedicated <ChartZoomSettings /> component. Some property names have changed: enablePanpan, showToolbartoolbar.visible, and toolbarItemstoolbar.items. Other properties, such as mode, remain the same. Note that mode determines which axes are affected (X, Y, or XY).

Props: zoomSettings={{ enablePan: true }}

<ChartComponent zoomSettings={{ enablePan: true }}> </ChartComponent>

Props: pan on <ChartZoomSettings />

<Chart> <ChartZoomSettings pan={true} /> </Chart>

Enables chart panning without requiring toolbar interaction. When enabled, users can pan a zoomed chart directly by clicking and dragging.

Props: zoomSettings={{ showToolbar: true, toolbarItems: ['ZoomIn', 'ZoomOut', 'Pan'] }}

<ChartComponent zoomSettings={{ showToolbar: true, toolbarItems: ['ZoomIn', 'ZoomOut', 'Pan'] }}> </ChartComponent>

Props: toolbar object on <ChartZoomSettings />

<Chart> <ChartZoomSettings toolbar={{ visible: true, items: ['ZoomIn', 'ZoomOut', 'Pan'] }} /> </Chart>

Provides configuration settings for the zoom toolbar displayed on the chart. Lets you control its visibility, toolbar items, and position within the chart area. Toolbar items like 'ZoomIn', 'ZoomOut', 'Pan', 'Reset' match the available options.

Props: zoomSettings={{ enableMouseWheelZooming: true }}

<ChartComponent zoomSettings={{ enableMouseWheelZooming: true }}> </ChartComponent>

Props: mouseWheelZoom on <ChartZoomSettings />

<Chart> <ChartZoomSettings mouseWheelZoom={true} /> </Chart>

Enables chart zooming using the mouse wheel for desktop users. Scroll up to zoom in and scroll down to zoom out.

Props: zoomSettings={{ enablePinchZooming: true }}

<ChartComponent zoomSettings={{ enablePinchZooming: true }}> </ChartComponent>

Props: pinchZoom on <ChartZoomSettings />

<Chart> <ChartZoomSettings pinchZoom={true} /> </Chart>

Enables zooming with pinch gestures on touch-enabled devices. Users can pinch in to zoom in and pinch out to zoom out.

Props: zoomSettings={{ enableSelectionZooming: true }}

<ChartComponent zoomSettings={{ enableSelectionZooming: true }}> </ChartComponent>

Props: selectionZoom on <ChartZoomSettings />

<Chart> <ChartZoomSettings selectionZoom={true} /> </Chart>

Enables zooming by selecting a rectangular region within the chart area. Users can click and drag to define the region they want to zoom into.

Stack Labels

EJ2 ReactReactDescription

Props: stackLabels={{ font: { textAlignment: 'Center' } }}

<ChartComponent stackLabels={{ font: { textAlignment: 'Center' } }}> </ChartComponent>

Component Props: align on <ChartStackLabels />

<Chart> <ChartStackLabels align="Center" /> </Chart>

Sets the alignment of the stack label text within its container. Available options: • Left - Aligns text to the left. • Center - Centers the text. • Right - Aligns text to the right.

Props: stackLabels={{ rx: 4, ry: 4 }}

<ChartComponent stackLabels={{ rx: 4, ry: 4 }}> </ChartComponent>

Component Props: borderRadius on <ChartStackLabels />

<Chart> <ChartStackLabels borderRadius={{ x: 4, y: 4 }} /> </Chart>

Defines the border radius configuration for the stack label background. Controls the curvature of corners for both horizontal and vertical axes.

Props: stackLabels={{ font: { size: '14px' } }}

<ChartComponent stackLabels={{ font: { size: '14px', color: '#000' } }}> </ChartComponent>

Component Props: fontSize on <ChartStackLabels />

<Chart> <ChartStackLabels fontSize="14px" font={{ color: '#000' }} /> </Chart>

Sets the font size of the stack label text.

Props: stackLabels={{ angle: 45 }}

<ChartComponent stackLabels={{ angle: 45 }}> </ChartComponent>

Component Props: rotationAngle on <ChartStackLabels />

<Chart> <ChartStackLabels rotationAngle={45} /> </Chart>

Specifies the rotation angle of the stack labels in degrees.

Events

This section outlines how event handlers in the Chart component are mapped when migrating from EJ2 React to React. It highlights the differences in naming conventions and usage.

EJ2 ReactReactDescription

Event: axisLabelClick

<ChartComponent axisLabelClick={handleAxisLabelClick}> </ChartComponent>

Event: onAxisLabelClick

<Chart onAxisLabelClick={handleAxisLabelClick}> </Chart>
Triggered after an axis label is clicked.

Event: chartMouseClick

<ChartComponent chartMouseClick={handleClick}> </ChartComponent>

Event: onClick

<Chart onClick={handleClick}> </Chart>
Triggered when the chart is clicked.

Event: legendClick

<ChartComponent legendClick={handleLegendClick}> </ChartComponent>

Event: onLegendClick

<Chart onLegendClick={handleLegendClick}> </Chart>
Triggered after a legend item is clicked.

Event: chartMouseLeave

<ChartComponent chartMouseLeave={handleMouseLeave}> </ChartComponent>

Event: onMouseLeave

<Chart onMouseLeave={handleMouseLeave}> </Chart>
Triggered when the mouse leaves the chart.

Event: chartMouseMove

<ChartComponent chartMouseMove={handleMouseMove}> </ChartComponent>

Event: onMouseMove

<Chart onMouseMove={handleMouseMove}> </Chart>
Triggered when the mouse moves over the chart.

Event: pointClick

<ChartComponent pointClick={handlePointClick}> </ChartComponent>

Event: onPointClick

<Chart onPointClick={handlePointClick}> </Chart>
Triggered when a data point in the chart is clicked.

Event: resized

<ChartComponent resized={handleResize}> </ChartComponent>

Event: onResize

<Chart onResize={handleResize}> </Chart>
Triggered after the chart is resized.

Event: zoomComplete

<ChartComponent zoomComplete={handleZoomEnd}> </ChartComponent>

Event: onZoomEnd

<Chart onZoomEnd={handleZoomEnd}> </Chart>
Triggered when a zooming operation ends.

Event: onZooming

<ChartComponent onZooming={handleZoomStart}> </ChartComponent>

Event: onZoomStart

<Chart onZoomStart={handleZoomStart}> </Chart>
Triggered after a zoom selection operation is completed.

Crosshair

EJ2 ReactReactDescription

Prop: enable

<ChartComponent crosshair={{ enable: true }} />

Component: <ChartCrosshair />
Prop: enable

<Chart> <ChartCrosshair enable={true} /> </Chart>

Enables or disables the crosshair line. When set to true, the crosshair line is visible.

Prop: color, width, dashArray

<ChartComponent crosshair={{ color: '#FF0000', width: 2, dashArray: '5,5' }} />

Prop: lineStyle

<Chart> <ChartCrosshair lineStyle={{ color: '#FF0000', width: 2, dashArray: '5,5' }} /> </Chart>

Specifies the visual style of the crosshair line. You can customize the line's color, width, and dash pattern using the dashArray property.

Crosshair Tooltip

EJ2 ReactReactDescription

Prop: crosshairTooltip

<ChartComponent primaryXAxis={{ crosshairTooltip: { enable: true } }} />

Component: <ChartCrosshairTooltip />

<Chart> <ChartPrimaryXAxis> <ChartCrosshairTooltip enable={true} /> </ChartPrimaryXAxis> </Chart>

When set to true, a tooltip will be displayed at the axis intersection point when the crosshair is active.

Annotation

EJ2 ReactReactDescription

Prop: content

<ChartComponent> <AnnotationsDirective> <AnnotationDirective content="<div id='ann1'>Sales Target</div>" /> </AnnotationsDirective> </ChartComponent>

Prop: content

<Chart> <ChartAnnotationCollection> <ChartAnnotation content="<div id='ann1'>Sales Target</div>" /> </ChartAnnotationCollection> </Chart>

Content of the annotation. Accepts HTML string, plain text, or DOM element ID.

Prop: coordinateUnits

<ChartComponent> <AnnotationsDirective> <AnnotationDirective content="Q1" coordinateUnits="Point" /> </AnnotationsDirective> </ChartComponent>

Prop: coordinateUnit

<Chart> <ChartAnnotationCollection> <ChartAnnotation content="Q1" coordinateUnit="Point" /> </ChartAnnotationCollection> </Chart>

Defines whether position values are axis-based ('Point') or pixel-based ('Pixel').

Prop: horizontalAlignment

<ChartComponent> <AnnotationsDirective> <AnnotationDirective content="Marker" horizontalAlignment="Center" /> </AnnotationsDirective> </ChartComponent>

Prop: hAlign

<Chart> <ChartAnnotationCollection> <ChartAnnotation content="Marker" hAlign="Center" /> </ChartAnnotationCollection> </Chart>

Horizontal alignment relative to the X-position. Available options: Right aligns the annotation to the right of its anchor or target, Center centers the annotation horizontally on its anchor or target, and Left aligns the annotation to the left of its anchor or target.

Prop: verticalAlignment

<ChartComponent> <AnnotationsDirective> <AnnotationDirective content="Marker" verticalAlignment="Bottom" /> </AnnotationsDirective> </ChartComponent>

Prop: vAlign

<Chart> <ChartAnnotationCollection> <ChartAnnotation content="Marker" vAlign="Bottom" /> </ChartAnnotationCollection> </Chart>

Vertical alignment relative to the Y-position. Available options: Top aligns the annotation above its anchor or target, Center vertically centers the annotation on its anchor or target, and Bottom aligns the annotation below its anchor or target.

Error Bar

EJ2 ReactReactDescription

Prop: visible

<SeriesCollectionDirective> <SeriesDirective errorBar={{ visible: true }} /> </SeriesCollectionDirective>

Prop: visible

<ChartSeriesCollection> <ChartSeries> <ChartErrorBar visible={true} /> </ChartSeries> </ChartSeriesCollection>

If set to true, the error bar for the data will be rendered.

Prop: errorBarColorMapping

<SeriesCollectionDirective> <SeriesDirective errorBar={{ errorBarColorMapping: 'ErrorColor' }} /> </SeriesCollectionDirective>

Prop: errorBarColorField

<ChartSeriesCollection> <ChartSeries> <ChartErrorBar errorBarColorField="ErrorColor" /> </ChartSeries> </ChartSeriesCollection>

Defines the color for the error bar, which is mapped to the data source mapping name.

CrossAxis

EJ2 ReactReactDescription

Prop: crossesAt

<ChartComponent primaryXAxis={{ crossesAt: 10 }} />

Prop: crossAt.value

<Chart> <ChartPrimaryXAxis crossAt={{ value: 10 }} /> </Chart>

Defines the value at which the axis line intersects with another axis. This can be a numeric value, date, or category name, depending on the axis type.

Prop: crossesInAxis

<ChartComponent primaryXAxis={{ crossesInAxis: 'primaryYAxis' }} />

Prop: crossAt.axis

<Chart> <ChartPrimaryXAxis crossAt={{ axis: 'primaryYAxis' }} /> </Chart>

Specifies the name of the target axis that the current axis line should intersect.

Prop: placeNextToAxisLine

<ChartComponent primaryXAxis={{ placeNextToAxisLine: true }} />

Prop: crossAt.allowOverlap

<Chart> <ChartPrimaryXAxis crossAt={{ allowOverlap: true }} /> </Chart>

Indicates whether the axis line is allowed to overlap axis elements such as labels and titles. When set to true, the axis line may cross over these elements.

Selection

EJ2 ReactReactDescription

Prop: selectionMode

<ChartComponent selectionMode="Point" />

Prop: mode

<Chart> <ChartSelection mode="Point" /> </Chart>

Specifies how data points or series can be selected or highlighted. Available options: 'None' disables selection, 'Series' selects the entire series, 'Point' selects individual data points, 'Cluster' selects a group of related data points.

Prop: allowMultiSelection

<ChartComponent allowMultiSelection={true} />

Prop: allowMultiSelection

<Chart> <ChartSelection allowMultiSelection={true} /> </Chart>

Enables selection of multiple data points, series, or clusters. Note that the selectionMode must be set to 'Point', 'Series', or 'Cluster' for multi-selection to be enabled.

Prop: selectedDataIndexes

<ChartComponent selectedDataIndexes={[ { series: 0, point: 2 } ]} />

Prop: selectedDataIndexes

<Chart> <ChartSelection selectedDataIndexes={[{ series: 0, point: 2 }]} /> </Chart>

Defines the indexes of points to be selected when the chart is initially rendered. Note that selectionMode or highlightMode must be set to 'Point', 'Series', or 'Cluster' for this feature to work.

Prop: selectionPattern

<ChartComponent selectionPattern="DiagonalForward" />

Prop: pattern

<Chart> <ChartSelection pattern="DiagonalForward" /> </Chart>

Specifies the visual pattern applied to selected data points or series.

Highlight

EJ2 ReactReactDescription

Prop: highlightMode

<ChartComponent highlightMode="Point" />

Prop: mode

<Chart> <ChartHighlight mode="Point" /> </Chart>

Specifies how data points or series can be highlighted. Available options: 'None' disables highlighting, 'Series' highlights the entire series, 'Point' highlights individual data points, 'Cluster' highlights a group of related data points.

Prop: highlightColor

<ChartComponent highlightColor="#FFAA00" />

Prop: fill

<Chart> <ChartHighlight fill="#FFAA00" /> </Chart>

Specifies the color used to highlight a data point when hovered.

Prop: highlightPattern

<ChartComponent highlightPattern="DiagonalForward" />

Prop: pattern

<Chart> <ChartHighlight pattern="DiagonalForward" /> </Chart>

Defines the visual pattern applied to highlighted data points or series.