@@ -48,12 +48,13 @@ import {
4848import { computeSeriesGeometriesSelector } from '../../state/selectors/compute_series_geometries' ;
4949import { getAxesStylesSelector } from '../../state/selectors/get_axis_styles' ;
5050import { getHighlightedSeriesSelector } from '../../state/selectors/get_highlighted_series' ;
51+ import { getSeriesTypes } from '../../state/selectors/get_series_types' ;
5152import { getAnnotationSpecsSelector , getAxisSpecsSelector } from '../../state/selectors/get_specs' ;
5253import { isChartEmptySelector } from '../../state/selectors/is_chart_empty' ;
5354import { Geometries , Transform } from '../../state/utils/types' ;
5455import { LinesGrid } from '../../utils/grid_lines' ;
5556import { IndexedGeometryMap } from '../../utils/indexed_geometry_map' ;
56- import { AxisSpec , AnnotationSpec } from '../../utils/specs' ;
57+ import { AxisSpec , AnnotationSpec , SeriesType } from '../../utils/specs' ;
5758import { renderXYChartCanvas2d } from './renderers' ;
5859
5960/** @internal */
@@ -76,6 +77,7 @@ export interface ReactiveChartStateProps {
7677 annotationDimensions : Map < AnnotationId , AnnotationDimensions > ;
7778 annotationSpecs : AnnotationSpec [ ] ;
7879 panelGeoms : PanelGeoms ;
80+ seriesTypes : Set < SeriesType > ;
7981}
8082
8183interface ReactiveChartDispatchProps {
@@ -152,27 +154,37 @@ class XYChartComponent extends React.Component<XYChartProps> {
152154 initialized,
153155 isChartEmpty,
154156 chartContainerDimensions : { width, height } ,
157+ seriesTypes,
155158 } = this . props ;
156159
157160 if ( ! initialized || isChartEmpty ) {
158161 this . ctx = null ;
159162 return null ;
160163 }
161164
165+ const chartSeriesTypes =
166+ seriesTypes . size > 1 ? `Mixed chart: ${ [ ...seriesTypes ] . join ( ' and ' ) } chart` : `${ [ ...seriesTypes ] } chart` ;
167+
162168 return (
163- < canvas
164- ref = { forwardStageRef }
165- className = "echCanvasRenderer"
166- width = { width * this . devicePixelRatio }
167- height = { height * this . devicePixelRatio }
168- style = { {
169- width,
170- height,
171- } }
172- aria-label = "Chart"
173- // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
174- role = "img"
175- />
169+ < figure >
170+ < canvas
171+ ref = { forwardStageRef }
172+ className = "echCanvasRenderer"
173+ width = { width * this . devicePixelRatio }
174+ height = { height * this . devicePixelRatio }
175+ style = { {
176+ width,
177+ height,
178+ } }
179+ // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
180+ role = "presentation"
181+ >
182+ < dl className = "echScreen-reader" >
183+ < dt > Chart type</ dt >
184+ < dd > { chartSeriesTypes } </ dd >
185+ </ dl >
186+ </ canvas >
187+ </ figure >
176188 ) ;
177189 }
178190}
@@ -224,6 +236,7 @@ const DEFAULT_PROPS: ReactiveChartStateProps = {
224236 annotationDimensions : new Map ( ) ,
225237 annotationSpecs : [ ] ,
226238 panelGeoms : [ ] ,
239+ seriesTypes : new Set ( ) ,
227240} ;
228241
229242const mapStateToProps = ( state : GlobalChartState ) : ReactiveChartStateProps => {
@@ -252,6 +265,7 @@ const mapStateToProps = (state: GlobalChartState): ReactiveChartStateProps => {
252265 annotationDimensions : computeAnnotationDimensionsSelector ( state ) ,
253266 annotationSpecs : getAnnotationSpecsSelector ( state ) ,
254267 panelGeoms : computePanelsSelectors ( state ) ,
268+ seriesTypes : getSeriesTypes ( state ) ,
255269 } ;
256270} ;
257271
0 commit comments