techniq / techniq/layerchart

[Simplified charts] Streamline defining colors / gradients

Open
#468 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
41
Avg merge
2d 19h
Merged PRs (30d)
16

Description

Instead of always requiring overriding the marks snippet/slot and using LineageGradient explicitly...

<div class="h-[300px] p-4 border rounded-sm">
  <AreaChart data={dateSeriesData} x="date" y="value">
    {#snippet marks()}
      <LinearGradient class="from-primary/50 to-primary/1" vertical>
        {#snippet children({ gradient })}
          <Area line={{ class: "stroke-primary" }} fill={gradient} />
        {/snippet}
      </LinearGradient>
    {/snippet}
  </AreaChart>
</div>

it would be nice to come up with an API to do this within the simplified charts (AreaChart, BarChart, etc) by passing an array of colors

<AreaChart
  series={[
    { key: 'default', value: 'value', color: ['var(--color-primary)', 'var(--color-secondary)']
  ]}
/>

or even adding a color prop (not to be confused with the c color accessor/scale) for single series setting

<AreaChart
  color={['var(--color-primary)', 'var(--color-secondary)']}
/>

(note: should this be fill to allow the same with stroke)

Doing this with CSS variables and transparency with Tailwind 4 is a little more challenging and typically requires the use of color-mix()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the simplified chart components, including AreaChart and BarChart, and the existing marks/LinearGradient usage shown in the issue. Define the supported color input and determine what completion means for gradient colors without overriding marks, including the single-series case and Tailwind 4 CSS-variable transparency considerations.

Written by the indexing model from the issue text.

Assessment

Tech stack
tailwindcss, typescript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.