ai-research-survey

Systematic scan of agentic development research. What's signal, what's noise.
git clone https://git.shiptheloop.com/ai-research-survey.git
Log | Files | Refs

bar-chart.ts (677B)


      1 export function renderBarChart(data: { label: string; value: number }[]): string {
      2   const sorted = [...data].sort((a, b) => b.value - a.value);
      3   return sorted.map(d => {
      4     const color = d.value < 30 ? '#f06565' : d.value < 50 ? '#f0c050' : d.value < 70 ? '#6c8cff' : '#3dd68c';
      5     return `<div class="hbar">
      6       <div class="hbar-label"><span>${formatCatName(d.label)}</span><span>${d.value}%</span></div>
      7       <div class="hbar-track"><div class="hbar-fill" style="width:${d.value}%;background:${color}"></div></div>
      8     </div>`;
      9   }).join('');
     10 }
     11 
     12 function formatCatName(name: string): string {
     13   return name.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
     14 }

Impressum · Datenschutz