Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/VVelox/hugo-dusky-neon-potato.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane C. Bowers-Hadley <vvelox@vvelox.net>2018-09-24 13:11:00 +0300
committerZane C. Bowers-Hadley <vvelox@vvelox.net>2018-09-24 13:11:00 +0300
commitad9f36997de9112dcf454e5128574a8322ab768c (patch)
tree0ee285b9e83caee9b0a6a263353a47ee89b3bf60
parent50cfca0fd0b08ec3fe473177ea4075ce054db6bc (diff)
more documentation and add some defaults
-rw-r--r--README.md42
-rw-r--r--layouts/shortcodes/chart-generate.html4
-rw-r--r--layouts/shortcodes/chart-place.html2
3 files changed, 45 insertions, 3 deletions
diff --git a/README.md b/README.md
index 4da4b2a..9e1c96a 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,48 @@ CSS and JS will not be included in the header.
graphing: true
```
+Currently the possible charts that can be made with out issue are as below.
+
+* line
+* spline
+* bar
+* scatter
+* pie
+* donut
+
+Below is a example of creating a chart.
+
+```
+{{% chart-place chart="example" %}}
+
+{{% chart-generate url="https://foo.bar/c3_test.csv" type="line" chart="example" yLabel="Y1 label" xLabel="X label" %}}
+```
+
+Graphing is handled by [C3](https://c3js.org/) and you can find the documentation at https://c3js.org/reference.html .
+
+#### chart-place
+
+This short code places the HTML that the JS will bind to.
+
+| Variable | Default | Description |
+| --- | --- | --- |
+| chart | chart | The name of the chart. |
+
+#### chart-generate
+
+This generates the chart and binds it to the HTML.
+
+| Variable | Default | Required | Description |
+| --- | --- | --- | --- |
+| chart | chart | no | The name of the chart. |
+| url | null | yes | The URL for the CSV. |
+| [type](https://c3js.org/reference.html#data-type) | line | no | The type of chart it is. |
+| [x](https://c3js.org/reference.html#data-x) | null | no | The column name to use for X axis info. |
+| xLabel | null | no | The label for the X axis. |
+| yLabel | null | no | The label for the Y axis. |
+
+Please note that while C3 supports area and gauge, this currently lacks support for those.
+
## Configuration
### Disable Pagination
diff --git a/layouts/shortcodes/chart-generate.html b/layouts/shortcodes/chart-generate.html
index dcd4f54..e7befbc 100644
--- a/layouts/shortcodes/chart-generate.html
+++ b/layouts/shortcodes/chart-generate.html
@@ -1,12 +1,12 @@
<script>
var chart = c3.generate({
- bindto: '#{{ .Get "chart" }}',
+ bindto: '#{{ .Get "chart" | default "chart" }}',
data: {
{{ with .Get "x" }}
x: '{{.}}',
{{ end }}
url: '{{ .Get "url" }}',
- type: '{{ .Get "type" }}'
+ type: '{{ .Get "type" | default "line" }}'
}
{{ if or (isset .Params "xLabel") (or (isset .Params "yLabel") (isset .Params "y2Label") ) }}
,axis: {
diff --git a/layouts/shortcodes/chart-place.html b/layouts/shortcodes/chart-place.html
index cf3668d..82313af 100644
--- a/layouts/shortcodes/chart-place.html
+++ b/layouts/shortcodes/chart-place.html
@@ -1,2 +1,2 @@
-<div id="{{ .Get "chart" }}"></div>
+<div id="{{ .Get "chart" | default "chart" }}"></div>