- Notifications
You must be signed in to change notification settings - Fork18
a Chart.js component for Hugo. 📈
License
shen-yu/hugo-chart
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
English |中文说明
This is not a standalone theme. It is aHugo theme component providing a shortcode:chart to displayChart.js in your Hugo site.
Add the
hugo-chartas a submodule to be able to get upstream changes latergit submodule add https://github.com/Shen-Yu/hugo-chart.git themes/hugo-chartAdd
hugo-chartas the left-most element of thethemelist variable in your site's or theme's configuration fileconfig.yamlorconfig.toml. Example, withconfig.yaml:theme:["hugo-chart", "my-theme"]
or, with
config.toml,theme = ["hugo-chart","my-theme"]
In your site, use the shortcode, this way:
{{<chart [width] [height]>}}// Chartjs options goes here{{</chart>}}Name Type Default Description width number 100 The width of chart, responsive in window (%). height number 300 The height of chart (px). Note that Chartjs is responsive as default, in order for the above code to correctly resize the chart height, the
maintainAspectRatiooption must be set tofalse.
{{<chart90200>}}{type: 'bar',data: {labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],datasets: [{label: 'BarChart',data: [12,19,18,16,13,14],backgroundColor: [ 'rgba(255,99,132,0.2)', 'rgba(54,162,235,0.2)', 'rgba(255,206,86,0.2)', 'rgba(75,192,192,0.2)', 'rgba(153,102,255,0.2)', 'rgba(255,159,64,0.2)' ],borderColor: [ 'rgba(255,99,132,1)', 'rgba(54,162,235,1)', 'rgba(255,206,86,1)', 'rgba(75,192,192,1)', 'rgba(153,102,255,1)', 'rgba(255,159,64,1)' ],borderWidth:1 }] },options: {maintainAspectRatio:false,scales: {yAxes: [{ticks: {beginAtZero:true } }] } }}{{</chart>}}hugo-chart byEric Shen is underGPL v3 license.
About
a Chart.js component for Hugo. 📈
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors5
Uh oh!
There was an error while loading.Please reload this page.

