মূল বিষয়ে যান
বিভাগসমূহ
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">৩</th>
        <td rst-num>২৬০</td>
        <td rst-num>৬০০</td>
        <td rst-num>৫</td>
      </tr>
      <tr>
        <th scope="row">৪</th>
        <td rst-num>২৪০</td>
        <td rst-num>৬০০</td>
        <td rst-num>১</td>
      </tr>
      <tr>
        <th scope="row">২</th>
        <td rst-num>১৮০</td>
        <td rst-num>৬০০</td>
        <td rst-num>০</td>
      </tr>
      <tr>
        <th scope="row">১</th>
        <td rst-num>১২০</td>
        <td rst-num>৬০০</td>
        <td rst-num>২</td>
      </tr>
    </tbody>
    <tfoot>
      <tr>
        <th scope="row">মোট</th>
        <td rst-num>৮০০</td>
        <td rst-num>২,৪০০</td>
        <td rst-num>৮</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">১</th>
        <td rst-num>১২০</td>
        <td rst-num>৬০০</td>
        <td rst-num>২</td>
      </tr>
      <tr>
        <th scope="row">২</th>
        <td rst-num>১৮০</td>
        <td rst-num>৬০০</td>
        <td rst-num>০</td>
      </tr>
      <tr>
        <th scope="row">৩</th>
        <td rst-num>২৬০</td>
        <td rst-num>৬০০</td>
        <td rst-num>৫</td>
      </tr>
      <tr>
        <th scope="row">৪</th>
        <td rst-num>২৪০</td>
        <td rst-num>৬০০</td>
        <td rst-num>১</td>
      </tr>
      <tr>
        <th scope="row">৫</th>
        <td rst-num>৩৯০</td>
        <td rst-num>৬০০</td>
        <td rst-num>৩</td>
      </tr>
      <tr>
        <th scope="row">৬</th>
        <td rst-num>৬১০</td>
        <td rst-num>৬০০</td>
        <td rst-num>৪</td>
      </tr>
      <tr>
        <th scope="row">৭</th>
        <td rst-num>৬৫০</td>
        <td rst-num>৬০০</td>
        <td rst-num>০</td>
      </tr>
      <tr>
        <th scope="row">৮</th>
        <td rst-num>৬৯০</td>
        <td rst-num>৬০০</td>
        <td rst-num>২</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>৪১২</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>২৩৬</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>৯৮</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>০</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>৮০০</span><span>৬০০</span><span>৪০০</span><span>২০০</span><span>০</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: ১২০"></span><span title="2: ১৮০"></span><span title="3: ২৬০"></span><span title="4: ২৪০"></span><span title="5: ৩৯০"></span><span title="6: ৬১০"></span><span title="7: ৬৫০"></span><span title="8: ৬৯০"></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>লক্ষ্য: ৬০০</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>১২০</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td rst-num>১৮০</td>
            </tr>
            <tr>
              <th scope="row">3</th>
              <td rst-num>২৬০</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td rst-num>২৪০</td>
            </tr>
            <tr>
              <th scope="row">5</th>
              <td rst-num>৩৯০</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td rst-num>৬১০</td>
            </tr>
            <tr>
              <th scope="row">7</th>
              <td rst-num>৬৫০</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td rst-num>৬৯০</td>
            </tr>
          </tbody>
          <tfoot>
            <tr>
              <th scope="row">লক্ষ্য</th>
              <td rst-num>৬০০</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>৮০০</span><span>৬০০</span><span>৪০০</span><span>২০০</span><span>০</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>লক্ষ্য: ৬০০</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>১২০</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td rst-num>১৮০</td>
            </tr>
            <tr>
              <th scope="row">3</th>
              <td rst-num>২৬০</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td rst-num>২৪০</td>
            </tr>
            <tr>
              <th scope="row">5</th>
              <td rst-num>কোনো ডেটা নেই</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td rst-num>৬১০</td>
            </tr>
            <tr>
              <th scope="row">7</th>
              <td rst-num>৬৫০</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td rst-num>৬৯০</td>
            </tr>
          </tbody>
          <tfoot>
            <tr>
              <th scope="row">লক্ষ্য</th>
              <td rst-num>৬০০</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))}}

স্ক্রিন রিডার শুধু ক্যাপশনটুকুই পায়। সময়কাল দিন, আর যেকোনো পতন বা উত্থানের কথা বলুন।