Skip to content

Commit

Permalink
fix(readme): Update examples to use updated scales option (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
Co-authored-by: hashrock <hashrock@users.noreply.github.com>
  • Loading branch information
timharek and hashrock committed Aug 23, 2023
1 parent 59cd1db commit 899cdeb
Showing 1 changed file with 50 additions and 41 deletions.
91 changes: 50 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,26 @@ export default function Home() {
type="line"
options={{
devicePixelRatio: 1,
scales: { yAxes: [{ ticks: { beginAtZero: true } }] },
scales: { y: { 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,
}],
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,
},
],
}}
/>
</div>
Expand Down Expand Up @@ -101,23 +104,26 @@ export const handler: Handlers = {
type: "line",
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,
}],
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,
},
],
},
options: {
devicePixelRatio: 1,
scales: { yAxes: [{ ticks: { beginAtZero: true } }] },
scales: { y: { beginAtZero: true } },
},
});
},
Expand All @@ -140,7 +146,7 @@ import { Chart as default } from "$fresh_charts/island.tsx";
```tsx
import { Head } from "$fresh/runtime.ts";
import { ChartColors } from "$fresh_charts/utils.ts";
import { Chart } from "../islands/chart.tsx";
import Chart from "../islands/chart.tsx";

export default function Home() {
return (
Expand All @@ -152,21 +158,24 @@ export default function Home() {
<Chart
type="line"
options={{
scales: { yAxes: [{ ticks: { beginAtZero: true } }] },
scales: { y: { beginAtZero: true } },
}}
data={{
labels: ["1", "2", "3"],
datasets: [{
label: "Sessions",
data: [123, 234, 234],
borderColor: ChartColors.Red,
borderWidth: 1,
}, {
label: "Users",
data: [346, 233, 123],
borderColor: ChartColors.Blue,
borderWidth: 1,
}],
datasets: [
{
label: "Sessions",
data: [123, 234, 234],
borderColor: ChartColors.Red,
borderWidth: 1,
},
{
label: "Users",
data: [346, 233, 123],
borderColor: ChartColors.Blue,
borderWidth: 1,
},
],
}}
/>
</div>
Expand Down

0 comments on commit 899cdeb

Please sign in to comment.