-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new prop types, expose chart instance (#62)
- Loading branch information
Showing
16 changed files
with
621 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, BarController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, BarController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'bar', number[], unknown>; | ||
options?: TChartOptions<'bar'>; | ||
plugins?: TChartPlugin<'bar'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'bar'>, TLabel = unknown> | ||
extends Omit<ChartProps<'bar', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'bar', TData, TLabel> | null; | ||
} | ||
Chart.register(BarController); | ||
ChartJS.register(BarController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="bar" /> | ||
<Base bind:chart type="bar" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, BubbleController } from 'chart.js'; | ||
import type { BubbleDataPoint } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, BubbleController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'bubble', BubbleDataPoint[], unknown>; | ||
options?: TChartOptions<'bubble'>; | ||
plugins?: TChartPlugin<'bubble'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'bubble'>, TLabel = unknown> | ||
extends Omit<ChartProps<'bubble', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'bubble', TData, TLabel> | null; | ||
} | ||
Chart.register(BubbleController); | ||
ChartJS.register(BubbleController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="bubble" /> | ||
<Base bind:chart type="bubble" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, DoughnutController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, DoughnutController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'doughnut', number[], unknown>; | ||
options?: TChartOptions<'doughnut'>; | ||
plugins?: TChartPlugin<'doughnut'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'doughnut'>, TLabel = unknown> | ||
extends Omit<ChartProps<'doughnut', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'doughnut', TData, TLabel> | null; | ||
} | ||
Chart.register(DoughnutController); | ||
ChartJS.register(DoughnutController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="doughnut" /> | ||
<Base bind:chart type="doughnut" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, LineController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, LineController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'line', DefaultDataPoint<'line'>, unknown>; | ||
options?: TChartOptions<'line'>; | ||
plugins?: TChartPlugin<'line'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'line'>, TLabel = unknown> | ||
extends Omit<ChartProps<'line', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'line', TData, TLabel> | null; | ||
} | ||
Chart.register(LineController); | ||
ChartJS.register(LineController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="line" /> | ||
<Base bind:chart type="line" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, PieController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, PieController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'pie', number[], unknown>; | ||
options?: TChartOptions<'pie'>; | ||
plugins?: TChartPlugin<'pie'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'pie'>, TLabel = unknown> | ||
extends Omit<ChartProps<'pie', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'pie', TData, TLabel> | null; | ||
} | ||
Chart.register(PieController); | ||
ChartJS.register(PieController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="pie" /> | ||
<Base bind:chart type="pie" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, PolarAreaController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, PolarAreaController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'polarArea', number[], unknown>; | ||
options?: TChartOptions<'polarArea'>; | ||
plugins?: TChartPlugin<'polarArea'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'polarArea'>, TLabel = unknown> | ||
extends Omit<ChartProps<'polarArea', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'polarArea', TData, TLabel> | null; | ||
} | ||
Chart.register(PolarAreaController); | ||
ChartJS.register(PolarAreaController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="polarArea" /> | ||
<Base bind:chart type="polarArea" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, RadarController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, RadarController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'radar', DefaultDataPoint<'radar'>, unknown>; | ||
options?: TChartOptions<'radar'>; | ||
plugins?: TChartPlugin<'radar'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'radar'>, TLabel = unknown> | ||
extends Omit<ChartProps<'radar', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'radar', TData, TLabel> | null; | ||
} | ||
Chart.register(RadarController); | ||
ChartJS.register(RadarController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="radar" /> | ||
<Base bind:chart type="radar" {...props} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { Chart, ScatterController } from 'chart.js'; | ||
import type { DefaultDataPoint } from 'chart.js'; | ||
import { Chart as ChartJS, ScatterController } from 'chart.js'; | ||
import type { ChartProps } from './types'; | ||
import Base from './Base.svelte'; | ||
import type { TChartData, TChartOptions, TChartPlugin } from './types'; | ||
interface $$Props { | ||
data: TChartData<'scatter', DefaultDataPoint<'scatter'>, unknown>; | ||
options?: TChartOptions<'scatter'>; | ||
plugins?: TChartPlugin<'scatter'>[]; | ||
interface $$Props<TData = DefaultDataPoint<'scatter'>, TLabel = unknown> | ||
extends Omit<ChartProps<'scatter', TData, TLabel>, 'type'> { | ||
chart: ChartJS<'scatter', TData, TLabel> | null; | ||
} | ||
Chart.register(ScatterController); | ||
ChartJS.register(ScatterController); | ||
export let chart: $$Props['chart'] = null; | ||
let props = $$props as $$Props; | ||
</script> | ||
|
||
<Base {...$$props} type="scatter" /> | ||
<Base bind:chart type="scatter" {...props} /> |
Oops, something went wrong.