From 18c136a3fab57d129c049fc7598acfd97d7c0c05 Mon Sep 17 00:00:00 2001 From: Adrian Setyadi Date: Mon, 5 Feb 2024 22:48:57 +0700 Subject: [PATCH] Update docs structure --- docs/SUMMARY.md | 35 +++++++++++----------- docs/usage/cartesian-charts/README.md | 41 +++++++++++++++++++++++++ docs/usage/cartesian-charts/part1.md | 43 --------------------------- 3 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 docs/usage/cartesian-charts/README.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 433ab62..5777770 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -5,23 +5,24 @@ ## Usage -* [Cartesian Charts: Part 1](usage/cartesian-charts/part1.md) - * [Line Chart](usage/cartesian-charts/part1.md#line-chart) - * [Stepline Chart](usage/cartesian-charts/part1.md#stepline-chart) - * [Area Chart](usage/cartesian-charts/part1.md#area-chart) - * [Column Chart](usage/cartesian-charts/part1.md#column-chart) - * [Bar Chart](usage/cartesian-charts/part1.md#bar-chart) - * [Range Bar Chart](usage/cartesian-charts/part1.md#range-bar-chart) -* [Cartesian Charts: Part 2](usage/cartesian-charts/part2.md) - * [Scatter Chart](usage/cartesian-charts/part2.md#scatter-chart) - * [Candlestick Chart](usage/cartesian-charts/part2.md#candlestick-chart) - * [Box Plot Chart](usage/cartesian-charts/part2.md#box-plot-chart) -* [Cartesian Charts: Part 3](usage/cartesian-charts/part3.md) - * [Mixed Charts](usage/cartesian-charts/part3.md#mixed-charts) - * [Syncing Charts](usage/cartesian-charts/part3.md#syncing-charts) - * [Brush Chart](usage/cartesian-charts/part3.md#brush-chart) - * [Annotations](usage/cartesian-charts/part3.md#annotations) - * [Multiple Y-Axes](usage/cartesian-charts/part3.md#multiple-y-axes) +* [Cartesian Charts](usage/cartesian-charts/README.md) + * [Part 1](usage/cartesian-charts/part1.md) + * [Line Chart](usage/cartesian-charts/part1.md#line-chart) + * [Stepline Chart](usage/cartesian-charts/part1.md#stepline-chart) + * [Area Chart](usage/cartesian-charts/part1.md#area-chart) + * [Column Chart](usage/cartesian-charts/part1.md#column-chart) + * [Bar Chart](usage/cartesian-charts/part1.md#bar-chart) + * [Range Bar Chart](usage/cartesian-charts/part1.md#range-bar-chart) + * [Part 2](usage/cartesian-charts/part2.md) + * [Scatter Chart](usage/cartesian-charts/part2.md#scatter-chart) + * [Candlestick Chart](usage/cartesian-charts/part2.md#candlestick-chart) + * [Box Plot Chart](usage/cartesian-charts/part2.md#box-plot-chart) + * [Part 3](usage/cartesian-charts/part3.md) + * [Mixed Charts](usage/cartesian-charts/part3.md#mixed-charts) + * [Syncing Charts](usage/cartesian-charts/part3.md#syncing-charts) + * [Brush Chart](usage/cartesian-charts/part3.md#brush-chart) + * [Annotations](usage/cartesian-charts/part3.md#annotations) + * [Multiple Y-Axes](usage/cartesian-charts/part3.md#multiple-y-axes) * [Heatmap Chart](usage/heatmap-chart.md) * [Radar Chart](usage/radar-chart.md) * [Bubble Chart](usage/bubble-chart.md) diff --git a/docs/usage/cartesian-charts/README.md b/docs/usage/cartesian-charts/README.md new file mode 100644 index 0000000..8f24764 --- /dev/null +++ b/docs/usage/cartesian-charts/README.md @@ -0,0 +1,41 @@ +### Cartesian Charts + +Example series used for cartesian charts: + +```erb +<% series = [ + {name: "Inactive", data: @inactive_properties}, + {name: "Active", data: @active_properties} +] %> +``` +To build the data, you can use gem [groupdate](https://github.com/ankane/groupdate). +In my case, it was: + +```ruby +@inactive_properties = Property.inactive.group_by_week(:created_at).count +@active_properties = Property.active.group_by_week(:created_at).count +``` + +and I'll get the data in this format: +```ruby +{ + Sun, 29 Jul 2018=>1, + Sun, 05 Aug 2018=>6, + .. +} +``` +PS: `Property` can be any model you have and `inactive` and `active` +are just some normal ActiveRecord scopes. Keep scrolling down to see +accepted data formats. + +Example options used for cartesian charts: + +```erb +<% options = { + title: 'Properties Growth', + subtitle: 'Grouped Per Week', + xtitle: 'Week', + ytitle: 'Properties', + stacked: true +} %> +``` diff --git a/docs/usage/cartesian-charts/part1.md b/docs/usage/cartesian-charts/part1.md index c8c01f7..ad32a63 100644 --- a/docs/usage/cartesian-charts/part1.md +++ b/docs/usage/cartesian-charts/part1.md @@ -1,46 +1,3 @@ -### Cartesian Charts: Part 1 - -Example series used for cartesian charts: - -```erb -<% series = [ - {name: "Inactive", data: @inactive_properties}, - {name: "Active", data: @active_properties} -] %> -``` -To build the data, you can use gem [groupdate](https://github.com/ankane/groupdate). -In my case, it was: - -```ruby -@inactive_properties = Property.inactive.group_by_week(:created_at).count -@active_properties = Property.active.group_by_week(:created_at).count -``` - -and I'll get the data in this format: -```ruby -{ - Sun, 29 Jul 2018=>1, - Sun, 05 Aug 2018=>6, - .. -} -``` -PS: `Property` can be any model you have and `inactive` and `active` -are just some normal ActiveRecord scopes. Keep scrolling down to see -accepted data formats. - -Example options used for cartesian charts: - -```erb -<% options = { - title: 'Properties Growth', - subtitle: 'Grouped Per Week', - xtitle: 'Week', - ytitle: 'Properties', - stacked: true -} %> -``` - - #### Line Chart ```erb