From 3c122867ee9252f2d68a0a186483f0b89e27f7ad Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Fri, 29 Oct 2021 17:04:57 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20chart=20samples=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exampleSite/content/docs/shortcodes.md | 4 + exampleSite/content/samples/charts.md | 84 +++++++++++++++++++ .../content/samples/diagrams-flowcharts.md | 2 + 3 files changed, 90 insertions(+) create mode 100755 exampleSite/content/samples/charts.md diff --git a/exampleSite/content/docs/shortcodes.md b/exampleSite/content/docs/shortcodes.md index 55d94f1d..63801d01 100644 --- a/exampleSite/content/docs/shortcodes.md +++ b/exampleSite/content/docs/shortcodes.md @@ -93,6 +93,8 @@ data: { {{< /chart >}} +You can see some additional Chart.js examples on the [charts samples]({{< ref "charts" >}}) page. + ## Icon `icon` outputs an SVG icon and takes the icon name as its only parameter. The icon is scaled to match the current text size. @@ -148,3 +150,5 @@ graph LR; A[Lemons]-->B[Lemonade]; B-->C[Profit] {{< /mermaid >}} + +You can see some additional Mermaid examples on the [diagrams and flowcharts samples]({{< ref "diagrams-flowcharts" >}}) page. diff --git a/exampleSite/content/samples/charts.md b/exampleSite/content/samples/charts.md new file mode 100755 index 00000000..0732736e --- /dev/null +++ b/exampleSite/content/samples/charts.md @@ -0,0 +1,84 @@ +--- +title: "Charts" +date: 2019-03-06 +description: "Guide to Chart.js usage in Congo" +summary: "Congo includes Chart.js for powerful charts and data visualisations." +tags: ["chart", "sample", "graph"] +--- + +Congo includes support for Chart.js using the `chart` shortcode. Simply wrap the chart markup within the shortcode. Congo automatically themes charts to match the configured `colorScheme` parameter, however the colours can be customised using normal Chart.js syntax. + +Refer to the [chart shortcode]({{< ref "docs/shortcodes#chart" >}}) docs for more details. + +The examples below are a small selection taken from the [official Chart.js docs](https://www.chartjs.org/docs/latest/samples). You can also [view the page source](https://raw.githubusercontent.com/jpanther/congo/dev/exampleSite/content/samples/charts.md) on GitHub to see the markup. + +## Bar chart + + +{{< chart >}} +type: 'bar', +data: { + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], + datasets: [{ + label: 'My First Dataset', + data: [65, 59, 80, 81, 56, 55, 40], + backgroundColor: [ + 'rgba(255, 99, 132, 0.2)', + 'rgba(255, 159, 64, 0.2)', + 'rgba(255, 205, 86, 0.2)', + 'rgba(75, 192, 192, 0.2)', + 'rgba(54, 162, 235, 0.2)', + 'rgba(153, 102, 255, 0.2)', + 'rgba(201, 203, 207, 0.2)' + ], + borderColor: [ + 'rgb(255, 99, 132)', + 'rgb(255, 159, 64)', + 'rgb(255, 205, 86)', + 'rgb(75, 192, 192)', + 'rgb(54, 162, 235)', + 'rgb(153, 102, 255)', + 'rgb(201, 203, 207)' + ], + borderWidth: 1 + }] +} +{{< /chart >}} + + +## Line chart + + +{{< chart >}} +type: 'line', +data: { + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], + datasets: [{ + label: 'My First Dataset', + data: [65, 59, 80, 81, 56, 55, 40], + tension: 0.2 + }] +} +{{< /chart >}} + + +## Doughnut chart + + +{{< chart >}} +type: 'doughnut', +data: { + labels: ['Red', 'Blue', 'Yellow'], + datasets: [{ + label: 'My First Dataset', + data: [300, 50, 100], + backgroundColor: [ + 'rgba(255, 99, 132, 0.7)', + 'rgba(54, 162, 235, 0.7)', + 'rgba(255, 205, 86, 0.7)' + ], + hoverOffset: 4 + }] +} +{{< /chart >}} + diff --git a/exampleSite/content/samples/diagrams-flowcharts.md b/exampleSite/content/samples/diagrams-flowcharts.md index d815552d..447a45f2 100755 --- a/exampleSite/content/samples/diagrams-flowcharts.md +++ b/exampleSite/content/samples/diagrams-flowcharts.md @@ -8,6 +8,8 @@ tags: ["mermaid", "sample", "diagram"] Mermaid diagrams are supported in Congo using the `mermaid` shortcode. Simply wrap the diagram markup within the shortcode. Congo automatically themes Mermaid diagrams to match the configured `colorScheme` parameter. +Refer to the [mermaid shortcode]({{< ref "docs/shortcodes#mermaid" >}}) docs for more details. + The examples below are a small selection taken from the [official Mermaid docs](https://mermaid-js.github.io/mermaid/). You can also [view the page source](https://raw.githubusercontent.com/jpanther/congo/dev/exampleSite/content/samples/diagrams-flowcharts.md) on GitHub to see the markup. ## Flowchart