diff options
author | Zane C. Bowers-Hadley <vvelox@vvelox.net> | 2018-09-25 11:08:58 +0300 |
---|---|---|
committer | Zane C. Bowers-Hadley <vvelox@vvelox.net> | 2018-09-25 11:08:58 +0300 |
commit | 3bd08484ebea9990162601dc58180e96c2acc084 (patch) | |
tree | 849924870fba942dfd185bf00389bd921bf7068d | |
parent | 5d9bcc8e6585b114237894bdee98ce32940616bb (diff) |
add size options, subchart, and zoom options
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | layouts/shortcodes/chart-generate.html | 17 |
2 files changed, 30 insertions, 0 deletions
@@ -55,6 +55,7 @@ Currently the possible charts that can be made with out issue are as below. * scatter * pie * donut +* gauge Below is a example of creating a chart. @@ -92,6 +93,13 @@ This generates the chart and binds it to the HTML. | [grid-x-show](https://c3js.org/samples/options_gridline.html) | null | no | If the X grid should be shown. Set to 'true' to enable. | | [grid-y-show](https://c3js.org/samples/options_gridline.html) | null | no | If the X grid should be shown. Set to 'true' to enable. | | [legend-hide](https://c3js.org/samples/options_legend.html) | null | no | If defined, this hides the legend. | +| [zoom-enable](https://c3js.org/samples/interaction_zoom.html) | null | no | If defined, this enables zooming. | +| [zoom-rescale](https://c3js.org/reference.html#zoom-rescale) | null | no | If defined, this enables rescaling when zooming. | +| [subchart-enable](https://c3js.org/samples/options_subchart.html) | null | no | If defined, this enables shows a sub chart, which can be useful when zooming. | +| [subchart-size](https://c3js.org/reference.html#subchart-size-height) | null | no | Used for setting a custom subchart size. | +| [size-height](https://c3js.org/samples/options_size.html) | null | no | Set a specific height for the chart. | +| [size-width](https://c3js.org/samples/options_size.html) | null | no | Set a specific height for the chart. | + Please note that while C3 supports area and gauge, this currently lacks support for those. @@ -223,3 +231,8 @@ defaults are shown below. # text on the graphs graph-text="#FF00FF" ``` + +## TODO + +* Implement more settings for gauge graph type. +* Add more axis options. diff --git a/layouts/shortcodes/chart-generate.html b/layouts/shortcodes/chart-generate.html index 7f9921c..4bb0fa4 100644 --- a/layouts/shortcodes/chart-generate.html +++ b/layouts/shortcodes/chart-generate.html @@ -51,5 +51,22 @@ var chart = c3.generate({ ,legend: { {{ with .Get "legend-hide" }}show: false{{ end }} } + ,zoom: { + {{ if isset .Params "zoom-enable" }} + enabled: true + {{ with .Get "zoom-rescale" }},rescale: true{{ end }} + {{ end }} + } + ,subchart: { + {{ if isset .Params "subchart-enable" }} + show: true + {{ with .Get "subchart-size" }},size: { height: '{{.}}' }{{ end }} + {{ end }} + } + ,size: { + {{ with .Get "size-height" }}height: '{{.}}'{{ end }} + {{ if and ( isset .Params "size-width" ) ( isset .Params "size-height" ) }},{{ end }} + {{ with .Get "size-width" }}width: '{{.}}'{{ end }} + } }); </script> |