सुलभता पैटर्न · डेटा प्रदर्शन
सुलभ लाइन चार्ट
प्लॉट दिनों पर चलने वाला एक स्लाइडर है: ऐरो कुंजियाँ क्रॉसहेयर को चलाती हैं, तारीख़ उसका मान है, और रुकते ही उस दिन की संख्याएँ एक विनम्र घोषणा में सुनाई देती हैं। दो शृंखलाएँ ठोस और डैश वाली रेखा के साथ-साथ लेजेंड से भी अलग पहचानी जाती हैं, सबसे ज़्यादा और सबसे कम वाले दिन चार्ट पर लिखे हैं, और जिस तालिका से यह बना है वह एक बटन दूर है।
- डब्ल्यूसीएजी मानदंड
- 7
- कीबोर्ड नियम
- 6
- जाँच का तरीक़ा
- axe, कीबोर्ड और इंस्पेक्टर
लाइव डेमो
आज़माएँ
इसे माउस, कीबोर्ड या स्क्रीन रीडर से इस्तेमाल करें। साथ का इंस्पेक्टर दिखाता है कि आपके इस्तेमाल के दौरान ब्राउज़र सहायक तकनीक को क्या बताता है: फ़ोकस, स्थिति में बदलाव और घोषणाएँ।
रोज़ाना विज़िटर, सितंबर 2026
महीने भर में 7 दिन का औसत 38% बढ़ा, और 24 सितंबर को विज़िटर 2,640 के शिखर पर पहुँचे।
- रोज़ाना विज़िटर
- 7 दिन का औसत, डैश वाली रेखा
ऐरो कुंजियाँ एक दिन आगे-पीछे करती हैं, Page Up और Page Down एक हफ़्ता।
{visitors} विज़िटर, 7 दिन का औसत {average}डेटा तालिका दिखाएँ
| तारीख़ | विज़िटर | 7 दिन का औसत |
|---|---|---|
| मंगल 1 सित॰ | 1,610 | 1,430 |
| बुध 2 सित॰ | 1,630 | 1,440 |
| गुरु 3 सित॰ | 1,620 | 1,470 |
| शुक्र 4 सित॰ | 1,650 | 1,490 |
| शनि 5 सित॰ | 1,350 | 1,500 |
| सबसे कम | 1,300 | 1,520 |
| सोम 7 सित॰ | 1,600 | 1,540 |
| मंगल 8 सित॰ | 1,680 | 1,550 |
| बुध 9 सित॰ | 1,740 | 1,560 |
| गुरु 10 सित॰ | 1,760 | 1,580 |
| शुक्र 11 सित॰ | 1,680 | 1,590 |
| शनि 12 सित॰ | 1,450 | 1,600 |
| रवि 13 सित॰ | 1,350 | 1,610 |
| सोम 14 सित॰ | 1,800 | 1,640 |
| मंगल 15 सित॰ | 1,860 | 1,660 |
| बुध 16 सित॰ | 1,770 | 1,670 |
| गुरु 17 सित॰ | 1,850 | 1,680 |
| शुक्र 18 सित॰ | 1,930 | 1,720 |
| शनि 19 सित॰ | 1,540 | 1,730 |
| रवि 20 सित॰ | 1,460 | 1,740 |
| सोम 21 सित॰ | 1,870 | 1,750 |
| मंगल 22 सित॰ | 1,990 | 1,770 |
| बुध 23 सित॰ | 2,010 | 1,810 |
| सबसे ज़्यादा | 2,640 | 1,920 |
| शुक्र 25 सित॰ | 1,950 | 1,920 |
| शनि 26 सित॰ | 1,660 | 1,940 |
| रवि 27 सित॰ | 1,510 | 1,950 |
| सोम 28 सित॰ | 1,920 | 1,950 |
| मंगल 29 सित॰ | 2,010 | 1,960 |
| बुध 30 सित॰ | 2,120 | 1,970 |
1 से 6 सितंबर के 7 दिन के औसत में अगस्त के आख़िरी दिन भी शामिल हैं।
जावास्क्रिप्ट के बिना डेमो उतना ही काम करता है जितना उसका एचटीएमएल; इंस्पेक्टर के लिए जावास्क्रिप्ट चाहिए।
कीबोर्ड
जिन कुंजियों पर यह काम करता है
हर क्रिया पॉइंटर के बिना काम करती है।
| कुंजी | यह क्या करती है |
|---|---|
| Tab | चार्ट पर ले जाता है और क्रॉसहेयर उसी दिन पर दिखाता है जिस पर वह पिछली बार था; अगला Tab तालिका वाले बटन पर ले जाता है। |
| Arrow RightयाArrow Left | क्रॉसहेयर को अगले या पिछले दिन पर ले जाता है; Arrow Up और Arrow Down भी यही करते हैं। |
| Page UpयाPage Down | एक हफ़्ता आगे या पीछे ले जाता है, क्योंकि Page Up स्लाइडर का मान बढ़ाता है। |
| HomeयाEnd | 1 या 30 सितंबर पर ले जाता है। |
| Escape | फ़ोकस हिलाए बिना क्रॉसहेयर और टूलटिप छिपा देता है; अगली कुंजी उन्हें वापस ले आती है। |
| EnterयाSpace | डेटा तालिका दिखाएँ पर, तालिका खोलता या बंद करता है। |
स्क्रीन रीडर
यह क्या घोषित करता है
मार्कअप की भूमिकाओं, नामों और स्थितियों से लिखा गया।
| कब | अपेक्षित घोषणा |
|---|---|
| Tab चार्ट पर पहुँचता है | रोज़ाना विज़िटर, सितंबर 2026, स्लाइडर, मंगलवार, 1 सितंबर। ऐरो कुंजियाँ एक दिन आगे-पीछे करती हैं, Page Up और Page Down एक हफ़्ता। |
| Arrow Right दबाया जाता है | बुधवार, 2 सितंबर |
| कुंजियाँ एक पल के लिए रुकती हैं | 1,630 विज़िटर, 7 दिन का औसत 1,440 |
| End दबाया जाता है, फिर Page Down | बुधवार, 23 सितंबर… 2,010 विज़िटर, 7 दिन का औसत 1,810 |
| क्रॉसहेयर 24 सितंबर पर पहुँचता है | गुरुवार, 24 सितंबर… 2,640 विज़िटर, 7 दिन का औसत 1,920। महीने में सबसे ज़्यादा |
ये अपेक्षित घोषणाएँ हैं, रिकॉर्डिंग नहीं। स्क्रीन रीडर और ब्राउज़र के हिसाब से शब्द और क्रम बदलते हैं।
कोड
कोड कॉपी करें
वही फ़ाइलें जिन पर यह डेमो चलता है। स्टाइल एक प्रीफ़िक्स के साथ परोसी जाती हैं जो इस साइट की अपनी स्टाइल को डेमो से दूर रखता है; आप जो कॉपी करते हैं वह मूल है।
<figure class="ap-line-chart" data-ap-line-chart data-max="3000" data-step="500" data-region="IN" aria-labelledby="line-chart-name">
<h3 class="ap-line-chart__name" id="line-chart-name">Daily visitors, September 2026</h3>
<p class="ap-line-chart__takeaway" id="line-chart-takeaway">The 7-day average rose 38% over the month, and visitors peaked at 2,640 on 24 September.</p>
<ul class="ap-line-chart__legend">
<li><svg class="ap-line-chart__key" viewBox="0 0 24 12" aria-hidden="true" focusable="false"><path d="M2 6h20"/></svg>Daily visitors</li>
<li><svg class="ap-line-chart__key ap-line-chart__key--avg" viewBox="0 0 24 12" aria-hidden="true" focusable="false"><path d="M2 6h20"/></svg>7-day average, dashed</li>
</ul>
<div class="ap-line-chart__chart" data-ap-chart>
<svg class="ap-line-chart__svg" aria-hidden="true" focusable="false">
<g data-ap-grid></g>
<path class="ap-line-chart__area" data-ap-area/>
<path class="ap-line-chart__line ap-line-chart__line--avg" data-ap-avg/>
<path class="ap-line-chart__line" data-ap-daily/>
<g data-ap-notes></g>
<line class="ap-line-chart__cross" data-ap-cross/>
<rect class="ap-line-chart__dot ap-line-chart__dot--avg" width="9" height="9" rx="1.5" data-ap-dot-avg/>
<circle class="ap-line-chart__dot" r="5" data-ap-dot/>
</svg>
<div class="ap-line-chart__plot" role="slider" tabindex="0" aria-labelledby="line-chart-name" aria-describedby="line-chart-keys" aria-valuemin="1" aria-valuemax="30" aria-valuenow="1" aria-valuetext="Tuesday, 1 September" data-ap-plot>
<span class="ap-line-chart__mark" data-ap-high><span>Highest</span> <strong data-ap-num></strong></span>
<span class="ap-line-chart__mark ap-line-chart__mark--low" data-ap-low><span>Lowest</span> <strong data-ap-num></strong></span>
<span class="ap-line-chart__tip" data-ap-tip>
<span class="ap-line-chart__when" data-ap-when></span>
<span class="ap-line-chart__row"><svg class="ap-line-chart__key" viewBox="0 0 24 12" aria-hidden="true" focusable="false"><path d="M2 6h20"/></svg><strong data-ap-daily-value></strong> <span>visitors</span></span>
<span class="ap-line-chart__row"><svg class="ap-line-chart__key ap-line-chart__key--avg" viewBox="0 0 24 12" aria-hidden="true" focusable="false"><path d="M2 6h20"/></svg><strong data-ap-avg-value></strong> <span>7-day average</span></span>
<span class="ap-line-chart__flag" data-ap-flag="high" hidden>Highest of the month</span>
<span class="ap-line-chart__flag" data-ap-flag="low" hidden>Lowest of the month</span>
</span>
</div>
<div class="ap-line-chart__x" aria-hidden="true">
<span data-day="1">1 Sept</span>
<span data-day="8">8 Sept</span>
<span data-day="15">15 Sept</span>
<span data-day="22">22 Sept</span>
<span data-day="29">29 Sept</span>
</div>
</div>
<p class="ap-line-chart__keys" id="line-chart-keys">Arrow keys move a day, Page Up and Page Down a week.</p>
<p class="ap-line-chart__sr" aria-live="polite" data-ap-live></p>
<span class="ap-line-chart__sr" data-ap-say hidden>{visitors} visitors, 7-day average {average}</span>
<details class="ap-line-chart__data">
<summary class="ap-btn ap-btn--ghost ap-line-chart__toggle">
<svg class="ap-btn__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><path d="M3.5 9.5h17M3.5 14.5h17M9.5 9.5v10"/></svg>
<span data-ap-label>Show data table</span>
</summary>
<div class="ap-line-chart__scroll" tabindex="0" role="region" aria-labelledby="line-chart-caption">
<table class="ap-line-chart__table" data-ap-table>
<caption id="line-chart-caption">Daily visitors, 1 to 30 September 2026</caption>
<thead>
<tr><th scope="col">Date</th><th scope="col">Visitors</th><th scope="col">7-day average</th></tr>
</thead>
<tbody>
<tr data-date="2026-09-01"><th scope="row"><time datetime="2026-09-01">Tue 1 Sept</time></th><td>1,610</td><td>1,430</td></tr>
<tr data-date="2026-09-02"><th scope="row"><time datetime="2026-09-02">Wed 2 Sept</time></th><td>1,630</td><td>1,440</td></tr>
<tr data-date="2026-09-03"><th scope="row"><time datetime="2026-09-03">Thu 3 Sept</time></th><td>1,620</td><td>1,470</td></tr>
<tr data-date="2026-09-04"><th scope="row"><time datetime="2026-09-04">Fri 4 Sept</time></th><td>1,650</td><td>1,490</td></tr>
<tr data-date="2026-09-05"><th scope="row"><time datetime="2026-09-05">Sat 5 Sept</time></th><td>1,350</td><td>1,500</td></tr>
<tr data-date="2026-09-06"><th scope="row"><time datetime="2026-09-06">Sun 6 Sept</time> <span class="ap-line-chart__tag">Lowest</span></th><td>1,300</td><td>1,520</td></tr>
<tr data-date="2026-09-07"><th scope="row"><time datetime="2026-09-07">Mon 7 Sept</time></th><td>1,600</td><td>1,540</td></tr>
<tr data-date="2026-09-08"><th scope="row"><time datetime="2026-09-08">Tue 8 Sept</time></th><td>1,680</td><td>1,550</td></tr>
<tr data-date="2026-09-09"><th scope="row"><time datetime="2026-09-09">Wed 9 Sept</time></th><td>1,740</td><td>1,560</td></tr>
<tr data-date="2026-09-10"><th scope="row"><time datetime="2026-09-10">Thu 10 Sept</time></th><td>1,760</td><td>1,580</td></tr>
<tr data-date="2026-09-11"><th scope="row"><time datetime="2026-09-11">Fri 11 Sept</time></th><td>1,680</td><td>1,590</td></tr>
<tr data-date="2026-09-12"><th scope="row"><time datetime="2026-09-12">Sat 12 Sept</time></th><td>1,450</td><td>1,600</td></tr>
<tr data-date="2026-09-13"><th scope="row"><time datetime="2026-09-13">Sun 13 Sept</time></th><td>1,350</td><td>1,610</td></tr>
<tr data-date="2026-09-14"><th scope="row"><time datetime="2026-09-14">Mon 14 Sept</time></th><td>1,800</td><td>1,640</td></tr>
<tr data-date="2026-09-15"><th scope="row"><time datetime="2026-09-15">Tue 15 Sept</time></th><td>1,860</td><td>1,660</td></tr>
<tr data-date="2026-09-16"><th scope="row"><time datetime="2026-09-16">Wed 16 Sept</time></th><td>1,770</td><td>1,670</td></tr>
<tr data-date="2026-09-17"><th scope="row"><time datetime="2026-09-17">Thu 17 Sept</time></th><td>1,850</td><td>1,680</td></tr>
<tr data-date="2026-09-18"><th scope="row"><time datetime="2026-09-18">Fri 18 Sept</time></th><td>1,930</td><td>1,720</td></tr>
<tr data-date="2026-09-19"><th scope="row"><time datetime="2026-09-19">Sat 19 Sept</time></th><td>1,540</td><td>1,730</td></tr>
<tr data-date="2026-09-20"><th scope="row"><time datetime="2026-09-20">Sun 20 Sept</time></th><td>1,460</td><td>1,740</td></tr>
<tr data-date="2026-09-21"><th scope="row"><time datetime="2026-09-21">Mon 21 Sept</time></th><td>1,870</td><td>1,750</td></tr>
<tr data-date="2026-09-22"><th scope="row"><time datetime="2026-09-22">Tue 22 Sept</time></th><td>1,990</td><td>1,770</td></tr>
<tr data-date="2026-09-23"><th scope="row"><time datetime="2026-09-23">Wed 23 Sept</time></th><td>2,010</td><td>1,810</td></tr>
<tr data-date="2026-09-24"><th scope="row"><time datetime="2026-09-24">Thu 24 Sept</time> <span class="ap-line-chart__tag">Highest</span></th><td>2,640</td><td>1,920</td></tr>
<tr data-date="2026-09-25"><th scope="row"><time datetime="2026-09-25">Fri 25 Sept</time></th><td>1,950</td><td>1,920</td></tr>
<tr data-date="2026-09-26"><th scope="row"><time datetime="2026-09-26">Sat 26 Sept</time></th><td>1,660</td><td>1,940</td></tr>
<tr data-date="2026-09-27"><th scope="row"><time datetime="2026-09-27">Sun 27 Sept</time></th><td>1,510</td><td>1,950</td></tr>
<tr data-date="2026-09-28"><th scope="row"><time datetime="2026-09-28">Mon 28 Sept</time></th><td>1,920</td><td>1,950</td></tr>
<tr data-date="2026-09-29"><th scope="row"><time datetime="2026-09-29">Tue 29 Sept</time></th><td>2,010</td><td>1,960</td></tr>
<tr data-date="2026-09-30"><th scope="row"><time datetime="2026-09-30">Wed 30 Sept</time></th><td>2,120</td><td>1,970</td></tr>
</tbody>
</table>
</div>
<p class="ap-line-chart__foot">The 7-day average for 1 to 6 September includes the last days of August.</p>
</details>
</figure>
/* Shared primitives: buttons and form fields used across the patterns.
Uses the --ap-* design tokens. */
.ap-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 40px;
padding: 0 16px;
border: 1px solid var(--ap-border-strong);
border-radius: var(--ap-radius-sm);
background: var(--ap-surface);
color: var(--ap-text);
font: inherit;
font-weight: 600;
line-height: 1.2;
text-decoration: none;
white-space: nowrap;
cursor: pointer;
transition: background-color var(--ap-duration) var(--ap-ease), border-color var(--ap-duration) var(--ap-ease), box-shadow var(--ap-duration) var(--ap-ease);
}
.ap-btn:hover {
background: var(--ap-surface-2);
}
.ap-btn:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 2px;
}
.ap-btn:disabled,
.ap-btn[aria-disabled="true"] {
opacity: .55;
cursor: not-allowed;
}
.ap-btn--primary {
border-color: var(--ap-accent);
background: var(--ap-accent);
color: var(--ap-on-accent);
box-shadow: var(--ap-shadow-sm);
}
.ap-btn--primary:hover {
border-color: var(--ap-accent-hover);
background: var(--ap-accent-hover);
}
.ap-btn--danger {
border-color: var(--ap-danger);
background: var(--ap-danger);
color: var(--ap-surface);
}
.ap-btn--danger:hover {
filter: brightness(1.08);
}
.ap-btn--ghost {
border-color: transparent;
background: transparent;
}
.ap-btn--ghost:hover {
background: var(--ap-surface-2);
}
.ap-btn__icon {
width: 18px;
height: 18px;
flex-shrink: 0;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.ap-field {
display: grid;
gap: 6px;
}
.ap-label {
color: var(--ap-text);
font-weight: 600;
font-size: .9375rem;
}
.ap-hint {
margin: 0;
color: var(--ap-text-3);
font-size: .875rem;
line-height: 1.45;
}
.ap-error {
display: flex;
align-items: flex-start;
gap: 6px;
margin: 0;
color: var(--ap-danger);
font-size: .875rem;
font-weight: 600;
line-height: 1.45;
}
.ap-input {
width: 100%;
min-height: 44px;
padding: 10px 12px;
border: 1px solid var(--ap-border-strong);
border-radius: var(--ap-radius-sm);
background: var(--ap-surface);
color: var(--ap-text);
font: inherit;
line-height: 1.4;
transition: border-color var(--ap-duration) var(--ap-ease), box-shadow var(--ap-duration) var(--ap-ease);
}
.ap-input::placeholder {
color: var(--ap-text-3);
}
.ap-input:hover {
border-color: var(--ap-text-2);
}
.ap-input:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 1px;
border-color: var(--ap-focus);
}
.ap-input[aria-invalid="true"] {
border-color: var(--ap-danger);
box-shadow: inset 4px 0 0 var(--ap-danger);
}
textarea.ap-input {
resize: vertical;
min-height: 88px;
}
@media (prefers-reduced-motion: reduce) {
.ap-btn,
.ap-input { transition: none; }
}
/* Line chart. Uses the --ap-* design tokens and the shared primitives. */
.ap-line-chart {
container-type: inline-size;
width: min(100%, 680px);
margin: 0 auto;
padding: 22px 24px 18px;
border: 1px solid var(--ap-border);
border-radius: var(--ap-radius-lg);
background: var(--ap-surface);
box-shadow: var(--ap-shadow-md);
color: var(--ap-text);
}
.ap-line-chart__name {
margin: 0;
color: var(--ap-text);
font-size: 1.0625rem;
font-weight: 650;
line-height: 1.35;
}
.ap-line-chart__takeaway {
max-width: 58ch;
margin: 4px 0 0;
color: var(--ap-text-2);
font-size: .9375rem;
line-height: 1.5;
}
/* Line keys, not boxes: each mirrors its line, solid or dashed. */
.ap-line-chart__legend {
display: flex;
flex-wrap: wrap;
gap: 6px 20px;
margin: 14px 0 0;
padding: 0;
list-style: none;
color: var(--ap-text-2);
font-size: .8125rem;
font-weight: 500;
}
.ap-line-chart__legend li {
display: inline-flex;
align-items: center;
gap: 8px;
}
.ap-line-chart__key {
width: 24px;
height: 12px;
flex-shrink: 0;
fill: none;
stroke: var(--ap-accent);
stroke-width: 2.5;
stroke-linecap: round;
}
.ap-line-chart__key--avg {
stroke: var(--ap-text-3);
stroke-dasharray: 5 4;
stroke-linecap: butt;
}
/* The chart box. The script reads these lengths to lay out the SVG. */
.ap-line-chart__chart {
--lc-gutter: 46px;
--lc-head: 26px;
--lc-axis: 30px;
position: relative;
height: 290px;
margin-top: 12px;
}
.ap-line-chart__svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
font-family: var(--ap-font);
}
.ap-line-chart__grid-line {
stroke: var(--ap-border);
stroke-width: 1;
shape-rendering: crispEdges;
}
.ap-line-chart__base-line {
stroke: var(--ap-border-strong);
}
.ap-line-chart__tick-label {
fill: var(--ap-text-3);
font-size: 12px;
font-variant-numeric: tabular-nums;
text-anchor: end;
}
.ap-line-chart__area {
fill: var(--ap-accent);
fill-opacity: .08;
}
.ap-line-chart__line {
fill: none;
stroke: var(--ap-accent);
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.ap-line-chart__line--avg {
stroke: var(--ap-text-3);
stroke-dasharray: 6 5;
stroke-linecap: butt;
}
.ap-line-chart__ring {
fill: var(--ap-surface);
stroke: var(--ap-accent);
stroke-width: 2;
}
/* The crosshair and its two markers: a circle on the daily line, a square on the average. */
.ap-line-chart__cross,
.ap-line-chart__dot {
visibility: hidden;
}
.ap-line-chart__chart.is-on .ap-line-chart__cross,
.ap-line-chart__chart.is-on .ap-line-chart__dot {
visibility: visible;
}
.ap-line-chart__cross {
stroke: var(--ap-text-3);
stroke-width: 1;
shape-rendering: crispEdges;
}
.ap-line-chart__dot {
fill: var(--ap-accent);
stroke: var(--ap-surface);
stroke-width: 2;
}
.ap-line-chart__dot--avg {
fill: var(--ap-text-3);
}
/* The slider: the plot area itself, laid over the drawing. */
.ap-line-chart__plot {
position: absolute;
top: 0;
right: 0;
bottom: var(--lc-axis);
left: var(--lc-gutter);
border-radius: var(--ap-radius-sm);
cursor: crosshair;
touch-action: pan-y;
}
.ap-line-chart__plot:focus {
outline: none;
}
.ap-line-chart__plot:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 4px;
}
/* Highest and lowest, written on the chart. */
.ap-line-chart__mark {
position: absolute;
top: var(--lc-y, 0px);
left: var(--lc-x, 0px);
padding: 1px 6px;
border-radius: var(--ap-radius-sm);
background: var(--ap-surface);
color: var(--ap-text-3);
font-size: .75rem;
line-height: 1.4;
white-space: nowrap;
transform: translate(-50%, calc(-100% - 9px));
pointer-events: none;
}
.ap-line-chart__mark--low {
transform: translate(-50%, 9px);
}
.ap-line-chart__mark strong {
color: var(--ap-text);
font-weight: 650;
font-variant-numeric: tabular-nums;
}
/* The tooltip sits above the plot, its lower edge just inside it, so moving the
pointer up onto it never leaves the plot. */
.ap-line-chart__tip {
position: absolute;
top: 6px;
left: var(--lc-tip-x, 0px);
z-index: 2;
display: grid;
gap: 3px;
padding: 10px 12px;
border: 1px solid var(--ap-border);
border-radius: var(--ap-radius-sm);
background: var(--ap-surface);
box-shadow: var(--ap-shadow-lg);
color: var(--ap-text);
font-size: .8125rem;
line-height: 1.4;
white-space: nowrap;
cursor: default;
transform: translateY(-100%);
visibility: hidden;
opacity: 0;
transition: opacity 120ms var(--ap-ease), visibility 0s linear 120ms;
}
.ap-line-chart__chart.is-on .ap-line-chart__tip {
visibility: visible;
opacity: 1;
transition: opacity 120ms var(--ap-ease);
}
.ap-line-chart__when {
color: var(--ap-text-3);
font-size: .75rem;
}
.ap-line-chart__row {
display: flex;
align-items: center;
gap: 8px;
color: var(--ap-text-2);
}
.ap-line-chart__row strong {
color: var(--ap-text);
font-size: .9375rem;
font-weight: 650;
font-variant-numeric: tabular-nums;
}
.ap-line-chart__row .ap-line-chart__key {
width: 16px;
}
.ap-line-chart__flag {
margin-top: 2px;
color: var(--ap-accent-text);
font-size: .75rem;
font-weight: 600;
}
.ap-line-chart__x {
position: absolute;
right: 0;
bottom: 0;
left: var(--lc-gutter);
height: var(--lc-axis);
}
.ap-line-chart__x span {
position: absolute;
top: 8px;
left: var(--lc-x, 0px);
color: var(--ap-text-3);
font-size: .75rem;
white-space: nowrap;
transform: translateX(-50%);
}
.ap-line-chart__keys {
margin: 6px 0 0;
color: var(--ap-text-3);
font-size: .8125rem;
line-height: 1.45;
}
.ap-line-chart__sr {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
/* The data table, in a scrolling box with a header that stays put. */
.ap-line-chart__data {
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid var(--ap-border);
}
.ap-line-chart__toggle {
width: fit-content;
margin-left: -8px;
padding: 0 10px;
list-style: none;
}
.ap-line-chart__toggle::-webkit-details-marker {
display: none;
}
.ap-line-chart__scroll {
max-height: 320px;
margin-top: 10px;
overflow: auto;
border: 1px solid var(--ap-border);
border-radius: var(--ap-radius-sm);
}
.ap-line-chart__scroll:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 2px;
}
.ap-line-chart__table {
width: 100%;
border-collapse: collapse;
font-size: .875rem;
font-variant-numeric: tabular-nums;
}
.ap-line-chart__table caption {
padding: 10px 12px 8px;
color: var(--ap-text-3);
font-size: .8125rem;
text-align: start;
}
.ap-line-chart__table th,
.ap-line-chart__table td {
padding: 7px 12px;
border-top: 1px solid var(--ap-border);
text-align: end;
}
.ap-line-chart__table thead th {
position: sticky;
top: 0;
z-index: 1;
background: var(--ap-surface-2);
color: var(--ap-text-2);
font-weight: 600;
}
.ap-line-chart__table th:first-child {
text-align: start;
}
.ap-line-chart__table tbody th {
color: var(--ap-text);
font-weight: 500;
}
.ap-line-chart__table time {
white-space: nowrap;
}
.ap-line-chart__table td {
color: var(--ap-text-2);
}
.ap-line-chart__tag {
margin-left: 6px;
padding: 1px 7px;
border-radius: var(--ap-radius-full);
background: var(--ap-accent-soft);
color: var(--ap-accent-soft-text);
font-size: .75rem;
font-weight: 600;
}
.ap-line-chart__foot {
margin: 8px 0 0;
color: var(--ap-text-3);
font-size: .8125rem;
line-height: 1.45;
}
@container (max-width: 460px) {
.ap-line-chart {
padding: 18px 16px 14px;
}
.ap-line-chart__chart {
--lc-gutter: 40px;
height: 260px;
}
.ap-line-chart__table th,
.ap-line-chart__table td {
padding: 7px 8px;
}
.ap-line-chart__tag {
display: inline-block;
margin: 2px 0 0;
}
}
@media (prefers-reduced-motion: reduce) {
.ap-line-chart__tip { transition: none; }
}
/* Forced colors: both lines in CanvasText, told apart by the dashes and the markers. */
@media (forced-colors: active) {
.ap-line-chart__line,
.ap-line-chart__line--avg,
.ap-line-chart__key,
.ap-line-chart__key--avg { stroke: CanvasText; }
.ap-line-chart__area { fill: none; }
.ap-line-chart__grid-line { stroke: GrayText; }
.ap-line-chart__base-line { stroke: CanvasText; }
.ap-line-chart__tick-label { fill: CanvasText; }
.ap-line-chart__ring { fill: Canvas; stroke: CanvasText; }
.ap-line-chart__cross { stroke: Highlight; }
.ap-line-chart__dot { fill: CanvasText; stroke: Canvas; }
.ap-line-chart__dot--avg { fill: Canvas; stroke: CanvasText; }
}
/**
* Line chart: an SVG line chart drawn from the table beneath it, with a
* crosshair that the pointer or the keyboard moves along the days.
*
* Markup: [data-ap-line-chart] (data-max and data-step set the value axis,
* data-region adds a region to a bare page language for dates) holding a
* chart box [data-ap-chart] with an svg ([data-ap-grid], [data-ap-area],
* [data-ap-daily], [data-ap-avg], [data-ap-notes], [data-ap-cross],
* [data-ap-dot], [data-ap-dot-avg]), a role=slider plot [data-ap-plot] that
* holds the highest and lowest labels and the tooltip, x-axis labels with
* data-day, a polite live region [data-ap-live], a sentence template
* [data-ap-say], and a details holding the table [data-ap-table]: one row per
* day with its date in data-date (YYYY-MM-DD) and the two values in its cells.
* The box's CSS lengths --lc-gutter, --lc-head and --lc-axis place the plot.
*/
const SVG = "http://www.w3.org/2000/svg";
const PAUSE = 450; // ms after the last key before the numbers are announced
const INSET = 10; // keeps the first and last markers inside the plot
function make(tag, className, parent) {
const el = document.createElementNS(SVG, tag);
el.setAttribute("class", className);
parent.append(el);
return el;
}
const round = (n) => Math.round(n * 100) / 100;
export function init(root) {
const chart = root.querySelector("[data-ap-chart]");
const svg = chart.querySelector("svg");
const part = (name) => svg.querySelector(`[data-ap-${name}]`);
const grid = part("grid");
const plot = chart.querySelector("[data-ap-plot]");
const tip = plot.querySelector("[data-ap-tip]");
const high = plot.querySelector("[data-ap-high]");
const low = plot.querySelector("[data-ap-low]");
const live = root.querySelector("[data-ap-live]");
const say = root.querySelector("[data-ap-say]");
const flags = { high: tip.querySelector("[data-ap-flag=high]"), low: tip.querySelector("[data-ap-flag=low]") };
const details = root.querySelector("details");
const detailsLabel = details?.querySelector("[data-ap-label]");
const events = new AbortController();
const on = (target, type, fn) => target.addEventListener(type, fn, { signal: events.signal });
// The table is the data.
const number = (text) => Number(text.replace(/[^\d.]/g, ""));
const rows = [...root.querySelector("[data-ap-table]").tBodies[0].rows].map((tr) => {
const [y, m, d] = tr.dataset.date.split("-").map(Number);
return { date: new Date(y, m - 1, d), daily: number(tr.cells[1].textContent), avg: number(tr.cells[2].textContent) };
});
const dailies = rows.map((r) => r.daily);
const top = dailies.indexOf(Math.max(...dailies));
const bottom = dailies.indexOf(Math.min(...dailies));
// Dates and numbers in the page's language, so a translated page gets its own.
function locale() {
const lang = root.closest("[lang]")?.lang || navigator.language;
const region = root.dataset.region;
return region && !lang.includes("-") ? `${lang}-${region}` : lang;
}
function format(options, date) {
try {
return new Intl.DateTimeFormat(locale(), options).format(date);
} catch {
return new Intl.DateTimeFormat(undefined, options).format(date);
}
}
const count = (n) => {
try {
return new Intl.NumberFormat(locale()).format(n);
} catch {
return String(n);
}
};
let value = Math.max(0, Number(plot.getAttribute("aria-valuenow")) - 1);
let hover = -1;
let focused = false;
let dismissed = false;
let timer = 0;
let x = () => 0;
let y = () => 0;
let gutter = 0;
function draw() {
const width = chart.clientWidth;
const height = chart.clientHeight;
if (!width || !height) return;
const css = getComputedStyle(chart);
gutter = parseFloat(css.getPropertyValue("--lc-gutter")) || 46;
const head = parseFloat(css.getPropertyValue("--lc-head")) || 26;
const axis = parseFloat(css.getPropertyValue("--lc-axis")) || 30;
const max = Number(root.dataset.max) || Math.max(...dailies);
const step = Number(root.dataset.step) || max / 5;
const base = height - axis;
const last = rows.length - 1;
x = (i) => gutter + INSET + ((width - gutter - 2 * INSET) * i) / last;
y = (v) => base - (v / max) * (base - head);
grid.replaceChildren();
for (let v = 0; v <= max + 1e-9; v += step) {
const at = round(y(v)) + 0.5;
const line = make("line", v === 0 ? "ap-line-chart__grid-line ap-line-chart__base-line" : "ap-line-chart__grid-line", grid);
line.setAttribute("x1", gutter);
line.setAttribute("x2", width);
line.setAttribute("y1", at);
line.setAttribute("y2", at);
const label = make("text", "ap-line-chart__tick-label", grid);
label.setAttribute("x", gutter - 10);
label.setAttribute("y", at);
label.setAttribute("dy", "0.35em");
label.textContent = count(v);
}
const path = (key) => rows.map((r, i) => `${i ? "L" : "M"}${round(x(i))} ${round(y(r[key]))}`).join("");
const daily = path("daily");
part("daily").setAttribute("d", daily);
part("avg").setAttribute("d", path("avg"));
part("area").setAttribute("d", `${daily}L${round(x(last))} ${base}L${round(x(0))} ${base}Z`);
// Hollow rings on the highest and lowest days, labelled in HTML beside them.
const notes = part("notes");
notes.replaceChildren();
for (const [i, label] of [[top, high], [bottom, low]]) {
const ring = make("circle", "ap-line-chart__ring", notes);
ring.setAttribute("cx", round(x(i)));
ring.setAttribute("cy", round(y(dailies[i])));
ring.setAttribute("r", 4.5);
label.querySelector("[data-ap-num]").textContent = count(dailies[i]);
const half = label.offsetWidth / 2;
const left = Math.min(Math.max(x(i) - gutter, half), width - gutter - half);
label.style.setProperty("--lc-x", `${round(left)}px`);
label.style.setProperty("--lc-y", `${round(y(dailies[i]))}px`);
}
for (const tick of chart.querySelectorAll("[data-day]")) {
tick.style.setProperty("--lc-x", `${round(x(Number(tick.dataset.day) - 1) - gutter)}px`);
}
paint();
}
/* ── The crosshair: the hovered day, else the slider's day while it has focus ── */
function paint() {
const at = hover >= 0 ? hover : focused ? value : -1;
const shown = at >= 0 && !dismissed;
chart.classList.toggle("is-on", shown);
if (!shown) return;
const r = rows[at];
const cx = round(x(at));
const cross = part("cross");
cross.setAttribute("x1", cx);
cross.setAttribute("x2", cx);
cross.setAttribute("y1", 0);
cross.setAttribute("y2", round(y(0)));
part("dot").setAttribute("cx", cx);
part("dot").setAttribute("cy", round(y(r.daily)));
part("dot-avg").setAttribute("x", round(cx - 4.5));
part("dot-avg").setAttribute("y", round(y(r.avg) - 4.5));
tip.querySelector("[data-ap-when]").textContent = format({ weekday: "short", day: "numeric", month: "short" }, r.date);
tip.querySelector("[data-ap-daily-value]").textContent = count(r.daily);
tip.querySelector("[data-ap-avg-value]").textContent = count(r.avg);
flags.high.hidden = at !== top;
flags.low.hidden = at !== bottom;
// Above the plot, over the crosshair: the pointer reaches it by moving straight
// up, which keeps the same day, and it never covers the lines.
const w = tip.offsetWidth;
const left = Math.min(Math.max(cx - gutter - w / 2, -gutter), plot.clientWidth - w);
tip.style.setProperty("--lc-tip-x", `${round(left)}px`);
}
function sentence(i) {
const r = rows[i];
let text = say.textContent.replace("{visitors}", count(r.daily)).replace("{average}", count(r.avg));
if (i === top) text += `. ${flags.high.textContent}`;
if (i === bottom) text += `. ${flags.low.textContent}`;
return text;
}
// The numbers wait until the keys stop, so holding an arrow down is one announcement.
function announce() {
clearTimeout(timer);
timer = setTimeout(() => {
live.textContent = "";
requestAnimationFrame(() => { live.textContent = sentence(value); });
}, PAUSE);
}
function setValue(i, { speak = true } = {}) {
value = Math.min(Math.max(i, 0), rows.length - 1);
plot.setAttribute("aria-valuenow", String(value + 1));
plot.setAttribute("aria-valuetext", format({ weekday: "long", day: "numeric", month: "long" }, rows[value].date));
hover = -1;
dismissed = false;
paint();
if (speak) announce();
}
const nearest = (clientX) => {
const left = chart.getBoundingClientRect().left;
let best = 0;
for (let i = 1; i < rows.length; i++) {
if (Math.abs(x(i) + left - clientX) < Math.abs(x(best) + left - clientX)) best = i;
}
return best;
};
on(plot, "keydown", (event) => {
const steps = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1, PageUp: 7, PageDown: -7 };
if (event.key in steps) setValue(value + steps[event.key]);
else if (event.key === "Home") setValue(0);
else if (event.key === "End") setValue(rows.length - 1);
else if (event.key === "Escape" && chart.classList.contains("is-on")) {
// Hide the crosshair and tooltip; focus stays on the chart.
event.stopPropagation();
dismissed = true;
paint();
} else return;
event.preventDefault();
});
on(plot, "focus", () => {
focused = true;
dismissed = false;
paint();
announce();
});
on(plot, "blur", () => {
focused = false;
clearTimeout(timer);
paint();
});
on(plot, "pointerdown", (event) => {
if (tip.contains(event.target)) return;
setValue(nearest(event.clientX));
});
on(plot, "pointermove", (event) => {
// Over the tooltip, the crosshair holds still so the tooltip can be read.
if (tip.contains(event.target)) return;
const i = nearest(event.clientX);
// A finger or pen dragging along the plot moves the slider itself.
if (event.pointerType !== "mouse" && event.buttons) {
if (i !== value) setValue(i);
return;
}
if (i !== hover) {
hover = i;
dismissed = false;
paint();
}
});
on(plot, "pointerleave", () => {
hover = -1;
paint();
});
// Escape also hides a tooltip shown by hovering while focus is elsewhere.
on(document, "keydown", (event) => {
if (event.key === "Escape" && document.activeElement !== plot && chart.classList.contains("is-on")) {
dismissed = true;
paint();
}
});
if (details && detailsLabel) {
on(details, "toggle", () => {
detailsLabel.textContent = details.open ? "Hide data table" : "Show data table";
});
}
// A page that switches language mid-visit gets its dates and numbers redone.
const language = new MutationObserver(() => {
setValue(value, { speak: false });
draw();
});
language.observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
const resize = new ResizeObserver(draw);
resize.observe(chart);
setValue(value, { speak: false });
draw();
return () => {
events.abort();
resize.disconnect();
language.disconnect();
clearTimeout(timer);
};
}
for (const root of document.querySelectorAll("[data-ap-line-chart]")) init(root);
/* Design tokens for the pattern components. Light by default, dark when the
system asks for it; set data-theme="dark" on :root to force dark. */
:root {
--ap-radius-sm: 8px;
--ap-radius: 12px;
--ap-radius-lg: 16px;
--ap-radius-full: 999px;
--ap-font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--ap-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
--ap-ease: cubic-bezier(.2, .8, .2, 1);
--ap-duration: 180ms;
--ap-target: 44px;
--ap-bg: #F4F4F5;
--ap-surface: #FFFFFF;
--ap-surface-2: #F4F4F5;
--ap-surface-3: #E4E4E7;
--ap-border: #E4E4E7;
--ap-border-strong: #76767F;
--ap-text: #18181B;
--ap-text-2: #3F3F46;
--ap-text-3: #5E5E66;
--ap-accent: #4F46E5;
--ap-accent-hover: #4338CA;
--ap-on-accent: #FFFFFF;
--ap-accent-text: #4338CA;
--ap-accent-soft: #EEF2FF;
--ap-accent-soft-text: #3730A3;
--ap-focus: #4F46E5;
--ap-danger: #B91C1C;
--ap-danger-soft: #FEF2F2;
--ap-success: #15803D;
--ap-success-soft: #F0FDF4;
--ap-warning: #A15C07;
--ap-warning-soft: #FEFCE8;
--ap-info: #1D4ED8;
--ap-info-soft: #EFF6FF;
--ap-scrim: rgb(9 9 11 / .48);
--ap-shadow-sm: 0 1px 2px rgb(9 9 11 / .06);
--ap-shadow-md: 0 1px 2px rgb(9 9 11 / .05), 0 6px 16px -4px rgb(9 9 11 / .1);
--ap-shadow-lg: 0 2px 6px rgb(9 9 11 / .06), 0 20px 40px -12px rgb(9 9 11 / .22);
--ap-light-bg: #F4F4F5;
--ap-light-surface: #FFFFFF;
--ap-light-surface-2: #F4F4F5;
--ap-light-surface-3: #E4E4E7;
--ap-light-border: #E4E4E7;
--ap-light-border-strong: #76767F;
--ap-light-text: #18181B;
--ap-light-text-2: #3F3F46;
--ap-light-text-3: #5E5E66;
--ap-light-accent: #4F46E5;
--ap-light-accent-hover: #4338CA;
--ap-light-on-accent: #FFFFFF;
--ap-light-accent-text: #4338CA;
--ap-light-accent-soft: #EEF2FF;
--ap-light-accent-soft-text: #3730A3;
--ap-light-focus: #4F46E5;
--ap-light-danger: #B91C1C;
--ap-light-danger-soft: #FEF2F2;
--ap-light-success: #15803D;
--ap-light-success-soft: #F0FDF4;
--ap-light-warning: #A15C07;
--ap-light-warning-soft: #FEFCE8;
--ap-light-info: #1D4ED8;
--ap-light-info-soft: #EFF6FF;
--ap-light-scrim: rgb(9 9 11 / .48);
--ap-light-shadow-sm: 0 1px 2px rgb(9 9 11 / .06);
--ap-light-shadow-md: 0 1px 2px rgb(9 9 11 / .05), 0 6px 16px -4px rgb(9 9 11 / .1);
--ap-light-shadow-lg: 0 2px 6px rgb(9 9 11 / .06), 0 20px 40px -12px rgb(9 9 11 / .22);
--ap-dark-bg: #09090B;
--ap-dark-surface: #18181B;
--ap-dark-surface-2: #27272A;
--ap-dark-surface-3: #3F3F46;
--ap-dark-border: #2E2E33;
--ap-dark-border-strong: #8E8E97;
--ap-dark-text: #FAFAFA;
--ap-dark-text-2: #D4D4D8;
--ap-dark-text-3: #A1A1AA;
--ap-dark-accent: #818CF8;
--ap-dark-accent-hover: #A5B4FC;
--ap-dark-on-accent: #0C0A1F;
--ap-dark-accent-text: #A5B4FC;
--ap-dark-accent-soft: #1E1B4B;
--ap-dark-accent-soft-text: #C7D2FE;
--ap-dark-focus: #A5B4FC;
--ap-dark-danger: #F87171;
--ap-dark-danger-soft: #2A1215;
--ap-dark-success: #4ADE80;
--ap-dark-success-soft: #0F2A1A;
--ap-dark-warning: #FACC15;
--ap-dark-warning-soft: #2A2410;
--ap-dark-info: #60A5FA;
--ap-dark-info-soft: #0F1D33;
--ap-dark-scrim: rgb(0 0 0 / .62);
--ap-dark-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-dark-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-dark-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--ap-bg: #09090B;
--ap-surface: #18181B;
--ap-surface-2: #27272A;
--ap-surface-3: #3F3F46;
--ap-border: #2E2E33;
--ap-border-strong: #8E8E97;
--ap-text: #FAFAFA;
--ap-text-2: #D4D4D8;
--ap-text-3: #A1A1AA;
--ap-accent: #818CF8;
--ap-accent-hover: #A5B4FC;
--ap-on-accent: #0C0A1F;
--ap-accent-text: #A5B4FC;
--ap-accent-soft: #1E1B4B;
--ap-accent-soft-text: #C7D2FE;
--ap-focus: #A5B4FC;
--ap-danger: #F87171;
--ap-danger-soft: #2A1215;
--ap-success: #4ADE80;
--ap-success-soft: #0F2A1A;
--ap-warning: #FACC15;
--ap-warning-soft: #2A2410;
--ap-info: #60A5FA;
--ap-info-soft: #0F1D33;
--ap-scrim: rgb(0 0 0 / .62);
--ap-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
}
:root[data-theme="dark"] {
--ap-bg: #09090B;
--ap-surface: #18181B;
--ap-surface-2: #27272A;
--ap-surface-3: #3F3F46;
--ap-border: #2E2E33;
--ap-border-strong: #8E8E97;
--ap-text: #FAFAFA;
--ap-text-2: #D4D4D8;
--ap-text-3: #A1A1AA;
--ap-accent: #818CF8;
--ap-accent-hover: #A5B4FC;
--ap-on-accent: #0C0A1F;
--ap-accent-text: #A5B4FC;
--ap-accent-soft: #1E1B4B;
--ap-accent-soft-text: #C7D2FE;
--ap-focus: #A5B4FC;
--ap-danger: #F87171;
--ap-danger-soft: #2A1215;
--ap-success: #4ADE80;
--ap-success-soft: #0F2A1A;
--ap-warning: #FACC15;
--ap-warning-soft: #2A2410;
--ap-info: #60A5FA;
--ap-info-soft: #0F1D33;
--ap-scrim: rgb(0 0 0 / .62);
--ap-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
डब्ल्यूसीएजी 2.2
यह किन मानदंडों को पूरा करता है
वे सफलता मानदंड जिनका यह पैटर्न ध्यान रखता है, और कैसे।
-
1.1.1 गैर-टेक्स्ट सामग्री
स्तर A
चार्ट का नाम उसके हेडिंग से आता है और एक दिखने वाला निष्कर्ष उसका सार बताता है; हर दिन की संख्याएँ क्रॉसहेयर से या तालिका में पढ़ी जा सकती हैं।
-
1.3.1 जानकारी और संबंध
स्तर A
डेटा कैप्शन और हेडर वाली असली तालिका है, और चित्र उसी से बनता है, इसलिए दोनों में मतभेद नहीं हो सकता।
-
1.4.1 रंग का उपयोग
स्तर A
7 दिन का औसत अलग रंग के साथ-साथ डैश वाली रेखा भी है, और लेजेंड यह शब्दों में बताता है।
-
1.4.11 गैर-टेक्स्ट कंट्रास्ट
स्तर AA
दोनों रेखाएँ और उनके मार्कर दोनों थीम में सतह पर 3:1 पार करते हैं, और फ़ोर्स्ड कलर्स में वे CanvasText में फिर से बनते हैं।
-
1.4.13 Hover या फ़ोकस पर सामग्री
स्तर AA
टूलटिप पर बिना उसे हिलाए होवर किया जा सकता है, वह तब तक रहता है जब तक पॉइंटर या फ़ोकस प्लॉट से न हटे, और Escape उसे छिपा देता है।
-
2.1.1 कीबोर्ड
स्तर A
हर दिन तक ऐरो कुंजियों, Page Up और Page Down, Home और End से पहुँचा जा सकता है, वही कुंजियाँ जिनकी लोग स्लाइडर से उम्मीद करते हैं।
-
4.1.3 स्टेटस मैसेज
स्तर AA
कुंजियाँ रुकने पर, फ़ोकस हिलाए बिना, हर दिन की संख्याएँ एक विनम्र लाइव रीजन से सुनाई जाती हैं।
उपयोग
इसे कब इस्तेमाल करें
इसे अपनाएँ
- बहुत सारे बिंदुओं वाला समय के साथ बदलाव, जैसे महीने भर के रोज़ाना विज़िटर, तापमान या दाम।
- किसी कच्ची शृंखला की उसके रुझान से तुलना, या ऐसे दो माप जिनकी इकाई और अक्ष एक ही हो।
कुछ और इस्तेमाल करें
- अलग-अलग इकाइयों वाले दो माप: दूसरा अक्ष जोड़ने की जगह दो चार्ट बनाएँ।
- कुछ श्रेणियाँ जिनका समय में कोई क्रम नहीं: बार चार्ट इस्तेमाल करें।
- एक ताज़ा मान जो इतिहास से ज़्यादा मायने रखता हो: संख्या दिखाएँ, और रेखा को छोटी स्पार्कलाइन के रूप में।
आम विफलताएँ
आमतौर पर यह कहाँ गलत होता है
तीस टैब स्टॉप
हर बिंदु को फ़ोकस योग्य बनाने से चार्ट और बाकी पेज के बीच तीस स्टॉप आ जाते हैं। ऐरो कुंजियों वाला एक फ़ोकस योग्य प्लॉट सबके लिए तेज़ है।
बाढ़ लाने वाला लाइव रीजन
कुंजी दबी रहने पर हर बिंदु की घोषणा करने से एक मिनट का बोलना कतार में लग जाता है। तारीख़ स्लाइडर से तुरंत आती है और संख्याएँ सिर्फ़ कुंजियाँ रुकने के बाद।
दूसरा अक्ष
दो y-अक्ष ऐसी तुलनाओं को न्योता देते हैं जिनका डेटा समर्थन नहीं करता, और स्क्रीन रीडर उपयोगकर्ता नहीं देख पाता कि कौन सी रेखा किस अक्ष की है। यहाँ दोनों शृंखलाएँ एक अक्ष और एक इकाई साझा करती हैं।
सिर्फ़ रंगत से अलग की गई शृंखलाएँ
मिलते-जुलते रंगों की दो रेखाएँ बहुत लोगों के लिए आपस में मिल जाती हैं और फ़ोर्स्ड कलर्स में ग़ायब हो जाती हैं। औसत डैश वाला है और लेजेंड में उसका नाम है, और फ़ोर्स्ड कलर्स में रेखाएँ CanvasText बन जाती हैं।
शिखर जो ख़ुद ढूँढने पड़ें
सबसे ज़्यादा और सबसे कम वाले दिन ही असली कहानी हैं; लोगों को होवर करके उन्हें ढूँढने के लिए छोड़ देना उसे छिपा देता है। वे चार्ट पर लिखे हैं, तालिका में चिह्नित हैं और निष्कर्ष में बताए गए हैं।
भाग जाने वाला टूलटिप
चलते क्रॉसहेयर के बगल वाला टूलटिप पॉइंटर के पास पहुँचते ही खिसक जाता है, और बिंदु के ऊपर वाला रेखा को ढक देता है। यह टूलटिप प्लॉट के ऊपर क्रॉसहेयर की सीध में है: सीधे ऊपर जाने पर दिन वही रहता है, और Escape इसे छिपा देता है।
नोट्स
इसे बनाना
- role=slider जान-बूझकर चुना गया है: इससे स्क्रीन रीडर ऐरो कुंजियाँ पेज तक पहुँचने देते हैं, और Home, End, Page Up और Page Down वही कुंजियाँ हैं जिनका वादा स्लाइडर पहले से करता है। मान तारीख़ है, इसलिए सुनने में छोटा है।
- लाइव रीजन आख़िरी कुंजी के 450 मिलीसेकंड बाद लिखा जाता है, इसलिए ऐरो दबाए रखने पर रुकते समय एक ही घोषणा होती है, हर दिन की नहीं।
- स्क्रिप्ट तालिका पढ़ती है, एसवीजी को चार्ट के असली आकार पर बनाती है और आकार बदलने पर फिर से बनाती है, ताकि रेखाएँ दो पिक्सेल चौड़ी और मार्कर गोल रहें।
- तारीख़ें पेज की भाषा में Intl.DateTimeFormat से बनाई जाती हैं, और घोषित वाक्य मार्कअप में एक टेम्पलेट है, ताकि अनुवाद उसके शब्दों का क्रम बदल सके।
- रोज़ाना वाली रेखा के नीचे का हिस्सा शृंखला के रंग की हल्की परत है; फ़ोर्स्ड कलर्स में यह हट जाती है और दोनों रेखाएँ CanvasText बन जाती हैं।
स्रोत: WAI-एआरआईए ऑथरिंग प्रैक्टिसेज़: स्लाइडर · WAI इमेज ट्यूटोरियल: जटिल छवियाँ
आगे पढ़ें: डेटा विज़ुअलाइज़ेशन में रंग
लाइट और डार्क थीम में, डेस्कटॉप और फ़ोन की चौड़ाई पर axe से और कीबोर्ड से जाँचा गया। अभी हर स्क्रीन रीडर और ब्राउज़र जोड़ी के साथ नहीं परखा गया। सुधार बताएँ