-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f75b119
commit 796aa10
Showing
6 changed files
with
78 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { onMount, onCleanup } from 'solid-js' | ||
import * as echarts from 'echarts' | ||
|
||
const BarChart = () => { | ||
let chartDiv: HTMLElement | null | undefined | ||
|
||
onMount(() => { | ||
// Initialize the chart | ||
const myChart = echarts.init(chartDiv, 'dark') | ||
|
||
// Specify the chart options | ||
const options = { | ||
title: { | ||
text: 'Deep Work Hours' | ||
}, | ||
animationDuration: 3000, | ||
tooltip: {}, | ||
xAxis: { | ||
type: 'category', | ||
data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | ||
}, | ||
yAxis: { | ||
type: 'value' | ||
}, | ||
series: [ | ||
{ | ||
name: 'Hours', | ||
type: 'bar', | ||
data: [5, 6, 7, 8, 4, 3, 6] // Example data | ||
} | ||
] | ||
} | ||
|
||
// Set the options to the chart | ||
myChart.setOption(options) | ||
|
||
// Add resize listener to make the chart responsive | ||
window.addEventListener('resize', () => { | ||
myChart.resize() | ||
}) | ||
|
||
// Clean up the chart on unmount | ||
onCleanup(() => { | ||
myChart.dispose() | ||
}) | ||
}) | ||
|
||
return <div ref={chartDiv} style={{ width: '100%', height: '400px' }}></div> | ||
} | ||
|
||
export default BarChart |