본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Accessibility features

원문 보기 위키 갱신

Accessibility features (접근성 기능)

@elastic/charts v70.0.1 기준, Elastic Charts는 모든 사용자를 위한 몇 가지 접근성 기능을 제공해요.

출처: 문서

본문

사용 가능한 a11y 관련 기능:

  • 차트 제목(Chart titles)
  • 차트 설명(Chart descriptions)
  • 표 형태의 차트 데이터(Chart data in tabular form)*
  • 텍스처 채우기(Texture fill)*
  • 의미론적 그룹화(Semantic groupings)*

*이 기능으로 혜택을 볼 수 있는 모든 차트 타입이 아직 구현하지는 않았어요.

Titles (제목)

ariaLabel과 ariaLabelledBy prop은 <Settings /> 컴포넌트를 통해 설정할 수 있어요.

ariaLabel은 시각적으로 숨겨질 문자열 라벨을 받는 반면, ariaLabelledBy prop은 앱의 다른 곳에 있는 접근 가능한 요소에 차트를 연결할 수 있어요.

<>
  <h1 id="randomHeadingId">Days of the week: weekdays vs weekends</h1>
  <Chart>
    <Settings
      ariaLabelledby="randomHeadingId"
    />
    <BarSeries {...props} />
  </Chart>
</>

ariaLabel을 사용한다면 ariaLabelHeadingLevel을 전달해 그 라벨의 제목(heading) 레벨을 설정할 수 있어요. h1부터 h6까지가 유효한 옵션이며(p가 기본값)이에요.

페이지에 여러 차트가 있지만 선택한 몇 개에 주의를 끌고 싶거나, 특정 차트가 페이지의 주 콘텐츠인 경우 제목 레벨을 설정하고 싶을 수 있어요.

<Chart>
  <Settings
    ariaLabel="Days of the week: weekdays vs weekends"
    ariaLabelHeadingLevel="h1"
  />
  <BarSeries {...props} />
</Chart>

Descriptions (설명)

ariaDescription과 ariaDescribedBy prop은 <Settings /> 컴포넌트를 통해 설정할 수 있어요. ariaDescription은 시각적으로 숨겨질 문자열 설명을 받는 반면, ariaDescribedBy prop은 앱의 다른 곳에 렌더링한 id를 받아요.

<Chart>
  <Settings
    ariaLabel="Days of the week: weekdays vs weekends"
    ariaDescription="Bar one is labelled weekdays and has a value of 5. Bar two is labelled weekends and has a value of 2."
  />
  <BarSeries {...props} />
</Chart>

ariaDescribedBy는 둘 다 지정된 경우 ariaDescription을 덮어써요.

ariaUseDefaultSummary는 기본값이 true인 불리언이에요. 기본 요약은 최소한이며 차트 유형만 보고해요. 일부 차트 유형은 더 많은 정보를 제공하지만, 현재는 Gauge와 Goal 차트만 그래요. 커스텀 설명을 전달한다면 이 prop을 비활성화할 수 있어요.

<>
  <h1 id="randomHeadingId">Days of the week: weekdays vs weekends</h1>
  <p id="randomDescId">Bar chart with two bars. Bar one is labelled weekdays and has a value of 5. Bar two is labelled weekends and has a value of 2.</p>
  <Chart>
    <Settings
      ariaLabelledby="randomHeadingId"
      ariaDescribedBy="randomDescId"
      ariaUseDefaultSummary={false}
    />
    <BarSeries {...props} />
  </Chart>
</>

Tables (테이블)

일부 차트 유형에는 시각적으로 숨겨진 데이터 테이블이 렌더링돼요. ariaTableCaption이 그 테이블에 커스텀 캡션을 설정해요. 테이블 캡션을 설명에 대한 보조로 간주하세요. 차트를 표 형식으로 변환할 때 생길 수 있는 공백을 메우는 데 사용하세요.

버전 64.1.0에서 데이터 테이블은 partition 차트에서만 사용할 수 있어요. Partition 차트에는 sunburst, treemap, icicle, flame, mosaic, waffle이 포함돼요.

제공된 예시의 경우, ariaTableCaption으로 전달한 캡션이 있는 시각적으로 숨겨진 데이터 테이블이 렌더링돼요.

<p>There is a great variety of reported favorite fruit</p>

<dl>
  <dt>Chart type:</dt>
  <dd>sunburst chart</dd>
</dl>

<table>
  <caption>
    After Clementine (22), individual results are not labelled as the segments become too small
  </caption>
  <thead>
    <tr>
      <th scope="col">Label</th>
      <th scope="col">Value</th>
      <th scope="col">Percentage</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>Apple</th>
      <td>100</td>
      <td>27%</td>
    </tr>
    {/* rows abbreviated */}
    <tr>
      <th>Durian</th>
      <td>1</td>
      <td>0%</td>
    </tr>
  </tbody>
</table>

Texture fill (텍스처 채우기)

TextureStyles 인터페이스로 차트에 텍스처 채우기를 설정할 수 있어요.

버전 64.1.0에서 텍스처 채우기는 XY 차트에서만 사용할 수 있어요. XY 차트에는 area, bar, histogram이 포함돼요.

Semantic groupings (의미론적 그룹화)

bandLabels prop을 사용해 색상 세그먼트에 의미를 추가할 수 있어요.

버전 64.1.0에서 의미론적 그룹화는 goal과 gauge 차트에서만 사용할 수 있어요.

제공된 예시의 경우, bandLabels prop에서 생성된 goal 설명 목록과 함께 시각적으로 숨겨진 내용이 렌더링돼요.

<p>Revenue 2020 YTD</p>
<p>(thousand USD</p>
<p>This goal chart has a target of 260.</p>
<dl>
  <dt>Chart type:</dt>
  <dd>horizontalBullet chart</dd>
  <dt>Minimum:</dt>
  <dd>0</dd>
  <dt>Maximum:</dt>
  <dd>300</dd>
  <dt>Target:</dt>
  <dd>260</dd>
  <dd>Value:</dd>
  <dt>280</dt>
</dl>
...
<dl class="echScreenReaderOnly echGoalDescription">
  <dt>0 - 100</dt>
  <dd>cold</dd>
  <dt>100 - 125</dt>
  <dd>brisk</dd>
  <dt>125 - 150</dt>
  <dd>warm</dd>
  <dt>150 - 250</dt>
  <dd>hot</dd>
</dl>

더 알아보기 (Learn more)