hugo-chartHugo 站点 Chart 图表组件
这是一个为 Hugo 而写的 Chart.js 图表组件,用 chart
短代码就可以方便的把优雅的动态图表插入到你的 Hugo 站点中。
用法
-
用
git submodule add https://github.com/Shen-Yu/hugo-chart.git themes/hugo-chart
命令把 hugo-chart 添加为项目的子模块。 -
找到 Hugo 站点根目录下的配置文件(
config.yaml
或config.toml
),把hugo-chart
添加到theme
选项的最左侧,以下是config.yaml
theme: ["hugo-chart", "my-theme"]
以下是
config.toml
theme = ["hugo-chart", "my-theme"]
-
在你的站点文章或页面中,插入以下格式的短代码
{{< chart [宽度] [高度] >}} // 这里是 Chartjs 的配置 {{< /chart >}}
名称 类型 默认 描述 width decimal 100% 图表宽度,默认是响应式的 height number 300 图表高度(px) -
注意 Chartjs 默认是响应式的, 为了使自定义宽高生效, 你需要先把
maintainAspectRatio
选项设置成false
。
例子
{{< chart 100 300 >}} { type: 'bar', data: { labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'], datasets: [{ label: 'Bar Chart', 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 >}}
评论
Plottable.jsJavaScript 图表组件
Plottable.js 是一个用来创建灵活可定制图表的 JavaScript 组件,基于 D3.j
Plottable.jsJavaScript 图表组件
0
dhtmlxChartJavaScript图表组件
dhtmlxChart是一个纯JavaScript的Web图表库,支持的图表类型包括:line,spline,area,bar,andpiecharts.可创建更复杂的图表类型。
dhtmlxChartJavaScript图表组件
0
EastwoodJava图表组件
Eastwood模仿GoogleChartAPI的功能,使用JFreeChart来渲染图表。它针对那些想将图表加入到web页和功能中的开发者。使用匹配GoogleChartAPI的编码格式来生成饼图,
EastwoodJava图表组件
0
FusionChartsFlash图表组件
FusionCharts是一个能帮你创建其引人注目的动态图像效果的MacromediaFlash控件。充分利用MacromediaFlash所具有的流畅功能来创建简洁的、交互式的和引人注目的动态图像。
FusionChartsFlash图表组件
0
openhandx chart图表生成工具
OpenHandx-chart核心采用了jfreechart,并集成了jfreechart的主要功能。虽然jfreechart的功能很强大,但使用起来也非常复杂。OpenHandx-chart通过xm
openhandx chart图表生成工具
0