सामग्री पर जाएँ
अनुभाग
Rastrillo कंपोनेंट

तालिकाएँ और चार्ट

आँकड़ों की एक तालिका और तीन चार्ट: बार चार्ट, लाइन चार्ट और स्पार्कलाइन। सर्वर इन्हें बिना JavaScript के बनाता है।

हर उदाहरण असली है, पर उसके लिंक कहीं नहीं ले जाते। HTML कॉपी करने के लिए मार्कअप दिखाता है।

data-table

कार्ड में आँकड़ों की तालिका। सँकरी स्क्रीन पर हर कॉलम देखने के लिए कार्ड को दाएँ-बाएँ स्क्रॉल करें। पंक्ति शीर्षक दिखते रहते हैं।

किसी संख्या से क्रमबद्ध

पूर्वावलोकन
<div rst-box-head>
  <h2 id="sales-h">हफ़्ते के हिसाब से बिक्री</h2>
</div>
<div rst-card rst-table-scroll="" tabindex="0" role="region" aria-labelledby="sales-h">
  <table rst-table="" aria-labelledby="sales-h">
    <thead>
      <tr>
        <th scope="col">हफ़्ता</th>
        <th scope="col" rst-num aria-sort="descending">
          <a href="/sales?sort=sold&amp;dir=asc">बिके<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></a>
        </th>
        <th scope="col" rst-num>
          <a href="/sales?sort=target&amp;dir=desc">लक्ष्य<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></a>
        </th>
        <th scope="col" rst-num>रिफ़ंड</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th scope="row">3</th>
        <td rst-num>260</td>
        <td rst-num>600</td>
        <td rst-num>5</td>
      </tr>
      <tr>
        <th scope="row">4</th>
        <td rst-num>240</td>
        <td rst-num>600</td>
        <td rst-num>1</td>
      </tr>
      <tr>
        <th scope="row">2</th>
        <td rst-num>180</td>
        <td rst-num>600</td>
        <td rst-num>0</td>
      </tr>
      <tr>
        <th scope="row">1</th>
        <td rst-num>120</td>
        <td rst-num>600</td>
        <td rst-num>2</td>
      </tr>
    </tbody>
    <tfoot>
      <tr>
        <th scope="row">कुल</th>
        <td rst-num>800</td>
        <td rst-num>2,400</td>
        <td rst-num>8</td>
      </tr>
    </tfoot>
  </table>
</div>
{{template "data-table" dict
    "Columns" (list
        (dict "Label" "हफ़्ता")
        (dict "Href" "/sales?sort=sold&dir=asc" "Label" "बिके" "Num" true "Sort" "descending")
        (dict "Href" "/sales?sort=target&dir=desc" "Label" "लक्ष्य" "Num" true)
        (dict "Label" "रिफ़ंड" "Num" true))
    "Foot" (list "कुल" 800 2400 8)
    "ID" "sales"
    "Rows" (list (list 3 260 600 5) (list 4 240 600 1) (list 2 180 600 0) (list 1 120 600 2))
    "Title" "हफ़्ते के हिसाब से बिक्री"}}

कॉलम शीर्षक को क्रमबद्ध सूची से लिंक करें, फिर उसी कॉलम पर Sort सेट करें। संख्या वाले कॉलम को Num से चिह्नित करें।

घनी, स्थिर शीर्ष पंक्ति के साथ

पूर्वावलोकन
<div rst-box-head>
  <h2 id="sales-dense-h">हफ़्ते के हिसाब से बिक्री</h2>
</div>
<div rst-card rst-table-scroll="bounded" tabindex="0" role="region" aria-labelledby="sales-dense-h">
  <table rst-table="dense" aria-labelledby="sales-dense-h">
    <thead>
      <tr>
        <th scope="col">हफ़्ता</th>
        <th scope="col" rst-num>बिके</th>
        <th scope="col" rst-num>लक्ष्य</th>
        <th scope="col" rst-num>रिफ़ंड</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th scope="row">1</th>
        <td rst-num>120</td>
        <td rst-num>600</td>
        <td rst-num>2</td>
      </tr>
      <tr>
        <th scope="row">2</th>
        <td rst-num>180</td>
        <td rst-num>600</td>
        <td rst-num>0</td>
      </tr>
      <tr>
        <th scope="row">3</th>
        <td rst-num>260</td>
        <td rst-num>600</td>
        <td rst-num>5</td>
      </tr>
      <tr>
        <th scope="row">4</th>
        <td rst-num>240</td>
        <td rst-num>600</td>
        <td rst-num>1</td>
      </tr>
      <tr>
        <th scope="row">5</th>
        <td rst-num>390</td>
        <td rst-num>600</td>
        <td rst-num>3</td>
      </tr>
      <tr>
        <th scope="row">6</th>
        <td rst-num>610</td>
        <td rst-num>600</td>
        <td rst-num>4</td>
      </tr>
      <tr>
        <th scope="row">7</th>
        <td rst-num>650</td>
        <td rst-num>600</td>
        <td rst-num>0</td>
      </tr>
      <tr>
        <th scope="row">8</th>
        <td rst-num>690</td>
        <td rst-num>600</td>
        <td rst-num>2</td>
      </tr>
    </tbody>
  </table>
</div>
{{template "data-table" dict
    "Bounded" true
    "Columns" (list
        (dict "Label" "हफ़्ता")
        (dict "Label" "बिके" "Num" true)
        (dict "Label" "लक्ष्य" "Num" true)
        (dict "Label" "रिफ़ंड" "Num" true))
    "Dense" true
    "ID" "sales-dense"
    "Rows" (list (list 1 120 600 2) (list 2 180 600 0) (list 3 260 600 5) (list 4 240 600 1) (list 5 390 600 3) (list 6 610 600 4) (list 7 650 600 0) (list 8 690 600 2))
    "Title" "हफ़्ते के हिसाब से बिक्री"}}

Dense पंक्तियों को सघन करता है। Bounded ऊँचाई सीमित करता है और पंक्तियाँ स्क्रॉल होते समय शीर्षक दिखाता रहता है।

कोई पंक्ति मेल नहीं खाती

पूर्वावलोकन
<div rst-box-head>
  <h2 id="sales-none-h">हफ़्ते के हिसाब से बिक्री</h2>
</div>
<div rst-card rst-table-scroll="" tabindex="0" role="region" aria-labelledby="sales-none-h">
  <table rst-table="" aria-labelledby="sales-none-h">
    <thead>
      <tr>
        <th scope="col">हफ़्ता</th>
        <th scope="col" rst-num>बिके</th>
        <th scope="col" rst-num>लक्ष्य</th>
        <th scope="col" rst-num>रिफ़ंड</th>
      </tr>
    </thead>
    <tbody>
      <tr rst-table-empty>
        <td colspan="4">कोई हफ़्ता मेल नहीं खाता।</td>
      </tr>
    </tbody>
  </table>
</div>
{{template "data-table" dict
    "Columns" (list
        (dict "Label" "हफ़्ता")
        (dict "Label" "बिके" "Num" true)
        (dict "Label" "लक्ष्य" "Num" true)
        (dict "Label" "रिफ़ंड" "Num" true))
    "Empty" "कोई हफ़्ता मेल नहीं खाता।"
    "ID" "sales-none"
    "Title" "हफ़्ते के हिसाब से बिक्री"}}

कोई पंक्ति न हो तो शीर्षक बना रहता है और Empty कारण बताता है।

chart-bar

तालिका के रूप में बना बार चार्ट: हर पंक्ति में एक नाम, एक बार और एक मान। मान शून्य या उससे अधिक होने चाहिए।

एक ही पैमाने पर चार स्रोत

पूर्वावलोकन
<div rst-box-head>
  <h2 id="sources-h">स्रोत के हिसाब से टिकट</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-h" aria-describedby="sources-d">
    <p rst-chart-desc id="sources-d">ज़्यादातर टिकट ऑनलाइन बिके, और न्यूज़लेटर से अभी तक एक भी नहीं।</p>
    <div rst-table-scroll tabindex="0" role="region" aria-labelledby="sources-h">
      <table rst-table="bars" aria-labelledby="sources-h" aria-describedby="sources-d">
        <thead>
          <tr>
            <th scope="col">स्रोत</th>
            <th scope="col">
              <span class="rst-sr-only">बार</span>
            </th>
            <th scope="col" rst-num>टिकट</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">ऑनलाइन</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="1000" height="1"/></svg>
            </td>
            <td rst-num>412</td>
          </tr>
          <tr>
            <th scope="row">बॉक्स ऑफ़िस</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="572.8" height="1"/></svg>
            </td>
            <td rst-num>236</td>
          </tr>
          <tr>
            <th scope="row">साझेदार</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="237.9" height="1"/></svg>
            </td>
            <td rst-num>98</td>
          </tr>
          <tr>
            <th scope="row">न्यूज़लेटर</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="0" height="1"/></svg>
            </td>
            <td rst-num>0</td>
          </tr>
        </tbody>
      </table>
    </div>
  </figure>
</div>
{{template "chart-bar" dict
    "Category" "स्रोत"
    "Desc" "ज़्यादातर टिकट ऑनलाइन बिके, और न्यूज़लेटर से अभी तक एक भी नहीं।"
    "ID" "sources"
    "Measure" "टिकट"
    "Points" (list
        (dict "Label" "ऑनलाइन" "Value" 412)
        (dict "Label" "बॉक्स ऑफ़िस" "Value" 236)
        (dict "Label" "साझेदार" "Value" 98)
        (dict "Label" "न्यूज़लेटर" "Value" 0))
    "Title" "स्रोत के हिसाब से टिकट"}}

हर बार एक ही पैमाना साझा करता है। दो चार्ट की तुलना के लिए दोनों को एक ही Max दें।

अभी कुछ नहीं बिका

पूर्वावलोकन
<div rst-box-head>
  <h2 id="sources-none-h">स्रोत के हिसाब से टिकट</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-none-h">
    <p rst-chart-empty>अभी तक कोई टिकट नहीं बिका।</p>
  </figure>
</div>
{{template "chart-bar" dict
    "Category" "स्रोत"
    "Empty" "अभी तक कोई टिकट नहीं बिका।"
    "ID" "sources-none"
    "Measure" "टिकट"
    "Title" "स्रोत के हिसाब से टिकट"}}

कोई बिंदु न हो तो Empty चार्ट की जगह ले लेता है।

chart-line

समान दूरी वाले बिंदुओं पर एक रेखा के रूप में एक श्रृंखला, नीचे तालिका में हर मान के साथ।

लक्ष्य के मुक़ाबले साप्ताहिक बिक्री

पूर्वावलोकन
<div rst-box-head>
  <h2 id="weekly-h">साप्ताहिक बिक्री</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="weekly-h" aria-describedby="weekly-d">
    <p rst-chart-desc id="weekly-d">बिक्री लगभग हर हफ़्ते बढ़ी और हफ़्ते 6 में 600 का लक्ष्य पार कर गई।</p>
    <div rst-chart-plot aria-hidden="true">
      <div rst-chart-y>
        <span>800</span><span>600</span><span>400</span><span>200</span><span>0</span>
      </div>
      <svg viewBox="0 0 1000 1000" preserveAspectRatio="none" focusable="false"><path rst-chart-grid d="M0 0H1000M0 250H1000M0 500H1000M0 750H1000"/><path rst-chart-base d="M0 1000H1000"/><path rst-chart-goal d="M0 250H1000"/><polyline rst-chart-line points="0,850 142.9,775 285.7,675 428.6,700 571.4,512.5 714.3,237.5 857.1,187.5 1000,137.5"/><path rst-chart-ring d="M1000 137.5h0"/><path rst-chart-dot d="M1000 137.5h0"/></svg>
      <div rst-chart-hits>
        <span title="1: 120"></span><span title="2: 180"></span><span title="3: 260"></span><span title="4: 240"></span><span title="5: 390"></span><span title="6: 610"></span><span title="7: 650"></span><span title="8: 690"></span>
      </div>
      <div rst-chart-x>
        <span rst-chart-keep>1</span><span>2</span><span rst-chart-keep>3</span><span>4</span><span rst-chart-keep>5</span><span>6</span><span>7</span><span rst-chart-keep>8</span>
      </div>
    </div>
    <p rst-chart-key>लक्ष्य: 600</p>
    <details rst-chart-data>
      <summary>आँकड़े दिखाएँ</summary>
      <div rst-table-scroll tabindex="0" role="region" aria-labelledby="weekly-h">
        <table rst-table="dense" aria-labelledby="weekly-h">
          <thead>
            <tr>
              <th scope="col">हफ़्ता</th>
              <th scope="col" rst-num>बिके</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <th scope="row">1</th>
              <td rst-num>120</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td rst-num>180</td>
            </tr>
            <tr>
              <th scope="row">3</th>
              <td rst-num>260</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td rst-num>240</td>
            </tr>
            <tr>
              <th scope="row">5</th>
              <td rst-num>390</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td rst-num>610</td>
            </tr>
            <tr>
              <th scope="row">7</th>
              <td rst-num>650</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td rst-num>690</td>
            </tr>
          </tbody>
          <tfoot>
            <tr>
              <th scope="row">लक्ष्य</th>
              <td rst-num>600</td>
            </tr>
          </tfoot>
        </table>
      </div>
    </details>
  </figure>
</div>
{{template "chart-line" dict
    "Category" "हफ़्ता"
    "Desc" "बिक्री लगभग हर हफ़्ते बढ़ी और हफ़्ते 6 में 600 का लक्ष्य पार कर गई।"
    "Goal" 600
    "GoalLabel" "लक्ष्य"
    "Hover" true
    "ID" "weekly"
    "Measure" "बिके"
    "Points" (list
        (dict "Label" 1 "Value" 120)
        (dict "Label" 2 "Value" 180)
        (dict "Label" 3 "Value" 260)
        (dict "Label" 4 "Value" 240)
        (dict "Label" 5 "Value" 390)
        (dict "Label" 6 "Value" 610)
        (dict "Label" 7 "Value" 650)
        (dict "Label" 8 "Value" 690))
    "Title" "साप्ताहिक बिक्री"}}

Desc खुद लिखें। बताएँ कि रेखा क्या करती है, सिर्फ़ यह नहीं कि वह कहाँ खत्म होती है। हर बिंदु पर टूलटिप जोड़ने के लिए Hover सेट करें।

बिना डेटा वाला एक हफ़्ता

पूर्वावलोकन
<div rst-box-head>
  <h2 id="weekly-gap-h">साप्ताहिक बिक्री</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="weekly-gap-h" aria-describedby="weekly-gap-d">
    <p rst-chart-desc id="weekly-gap-d">हफ़्ते 5 में कोई बिक्री दर्ज नहीं हुई; वहाँ रेखा टूट जाती है।</p>
    <div rst-chart-plot aria-hidden="true">
      <div rst-chart-y>
        <span>800</span><span>600</span><span>400</span><span>200</span><span>0</span>
      </div>
      <svg viewBox="0 0 1000 1000" preserveAspectRatio="none" focusable="false"><path rst-chart-grid d="M0 0H1000M0 250H1000M0 500H1000M0 750H1000"/><path rst-chart-base d="M0 1000H1000"/><path rst-chart-goal d="M0 250H1000"/><polyline rst-chart-line points="0,850 142.9,775 285.7,675 428.6,700"/><polyline rst-chart-line points="714.3,237.5 857.1,187.5 1000,137.5"/><path rst-chart-ring d="M1000 137.5h0"/><path rst-chart-dot d="M1000 137.5h0"/></svg>
      <div rst-chart-x>
        <span rst-chart-keep>1</span><span>2</span><span rst-chart-keep>3</span><span>4</span><span rst-chart-keep>5</span><span>6</span><span>7</span><span rst-chart-keep>8</span>
      </div>
    </div>
    <p rst-chart-key>लक्ष्य: 600</p>
    <details rst-chart-data>
      <summary>आँकड़े दिखाएँ</summary>
      <div rst-table-scroll tabindex="0" role="region" aria-labelledby="weekly-gap-h">
        <table rst-table="dense" aria-labelledby="weekly-gap-h">
          <thead>
            <tr>
              <th scope="col">हफ़्ता</th>
              <th scope="col" rst-num>बिके</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <th scope="row">1</th>
              <td rst-num>120</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td rst-num>180</td>
            </tr>
            <tr>
              <th scope="row">3</th>
              <td rst-num>260</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td rst-num>240</td>
            </tr>
            <tr>
              <th scope="row">5</th>
              <td rst-num>कोई डेटा नहीं</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td rst-num>610</td>
            </tr>
            <tr>
              <th scope="row">7</th>
              <td rst-num>650</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td rst-num>690</td>
            </tr>
          </tbody>
          <tfoot>
            <tr>
              <th scope="row">लक्ष्य</th>
              <td rst-num>600</td>
            </tr>
          </tfoot>
        </table>
      </div>
    </details>
  </figure>
</div>
{{template "chart-line" dict
    "Category" "हफ़्ता"
    "Desc" "हफ़्ते 5 में कोई बिक्री दर्ज नहीं हुई; वहाँ रेखा टूट जाती है।"
    "Goal" 600
    "GoalLabel" "लक्ष्य"
    "Hover" false
    "ID" "weekly-gap"
    "Measure" "बिके"
    "Points" (list
        (dict "Label" 1 "Value" 120)
        (dict "Label" 2 "Value" 180)
        (dict "Label" 3 "Value" 260)
        (dict "Label" 4 "Value" 240)
        (dict "Label" 5 "Missing" true "Value" 390)
        (dict "Label" 6 "Value" 610)
        (dict "Label" 7 "Value" 650)
        (dict "Label" 8 "Value" 690))
    "Title" "साप्ताहिक बिक्री"}}

कोई मान न हो तो रेखा टूट जाती है और तालिका में “कोई डेटा नहीं” लिखा आता है। उसे कभी 0 के रूप में नहीं बनाया जाता।

sparkline

अपने कैप्शन के पास एक छोटी रेखा, किसी संख्या के साथ रुझान दिखाने के लिए।

बढ़त, बीच में एक गिरावट के साथ

पूर्वावलोकन
<figure rst-spark>
  <svg viewBox="0 0 100 24" preserveAspectRatio="none" aria-hidden="true" focusable="false"><polyline rst-chart-line points="0,24 14.3,21.5 28.6,18.1 42.9,18.9 57.1,12.6 71.4,3.4 85.7,1.7 100,0"/><path rst-chart-ring d="M100 0h0"/><path rst-chart-dot d="M100 0h0"/></svg>
  <figcaption>
    <strong>पिछले 8 हफ़्ते</strong> बिक्री 120 से बढ़कर 690 हो गई, हफ़्ते 4 में थोड़ी गिरावट के साथ।</figcaption>
</figure>
{{template "sparkline" dict
    "Desc" "बिक्री 120 से बढ़कर 690 हो गई, हफ़्ते 4 में थोड़ी गिरावट के साथ।"
    "Period" "पिछले 8 हफ़्ते"
    "Points" (list
        (dict "Label" 1 "Value" 120)
        (dict "Label" 2 "Value" 180)
        (dict "Label" 3 "Value" 260)
        (dict "Label" 4 "Value" 240)
        (dict "Label" 5 "Value" 390)
        (dict "Label" 6 "Value" 610)
        (dict "Label" 7 "Value" 650)
        (dict "Label" 8 "Value" 690))}}

स्क्रीन रीडर को बस कैप्शन मिलता है। अवधि बताएँ, और किसी भी गिरावट या उछाल का वर्णन करें।