-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmod.ts
59 lines (57 loc) · 1.63 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
/**
* A server side rendered charting library for Fresh based on
* [Chart.js](https://www.chartjs.org/).
*
* There are two ways of rendering charts. {@linkcode Chart} is a JSX/TSX
* components which can be used when inlining charts within a page.
* {@linkcode renderChart} is a function which renders a chart and returns it as
* a {@linkcode Response} where the body is an SVG image of the chart.
*
* ### Example of an inline chart
*
* ```tsx
* import { Chart } from "https://deno.land/x/fresh_charts/mod.ts";
* import {
* ChartColors,
* transparentize
* } from "https://deno.land/x/fresh_charts/utils.ts";
*
* export default App() {
* return <>
* <h1>Chart Example</h1>
* <Chart
* type="line"
* options={{
* scales: { yAxes: [{ ticks: { beginAtZero: true } }] },
* }}
* data={{
* labels: ["1", "2", "3"],
* datasets: [{
* label: "Sessions",
* data: [123, 234, 234],
* borderColor: ChartColors.Red,
* backgroundColor: transparentize(ChartColors.Red, 0.5),
* borderWidth: 1,
* }, {
* label: "Users",
* data: [346, 233, 123],
* borderColor: ChartColors.Blue,
* backgroundColor: transparentize(ChartColors.Blue, 0.5),
* borderWidth: 1,
* }],
* }}
* />
* <>;
* }
* ```
*
* @module
*/
export { Chart } from "./Chart.tsx";
export {
type ChartConfiguration,
type ChartOptions,
defaults,
} from "./core.ts";
export { renderChart } from "./render.ts";