Skip to content

Commit a619047

Browse files
(DEPLOY) Add Bar Chart Documentation (WIP)
1 parent 49f6230 commit a619047

File tree

4 files changed

+60
-7
lines changed

4 files changed

+60
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
# Bar Chart
2-
Words go here.
2+
## Introduction
3+
A bar chart represents **categorical** data with rectangular bars. These bars may be horizontal or vertical, but PureChart currently supports only horizontal bar charts.
4+
5+
The length of each bar is proportional to the value it's supposed to represent. The vertical axis of the bar chart lists the discrete categories being represented while the horizontal axis represents the values of said categories in relation to one another.
6+
7+
## Usage
8+
In your view, use the bar chart helper method as so -
9+
10+
```erb
11+
<%= bar_chart @data, @configuration, "custom-style" %>
12+
```
13+
14+
The third optional argument is the name of the theme you wish to use. The data is organized as a hash. Here's an example of some data and an optional configuration -
15+
16+
```rb
17+
@data = [
18+
{
19+
name: "PureChart",
20+
color: "blue",
21+
value: 0
22+
},
23+
{
24+
name: "Highcharts",
25+
color: "purple",
26+
value: 1000
27+
},
28+
{
29+
name: "Chartkick",
30+
color: "orange",
31+
value: 2570
32+
},
33+
]
34+
35+
...
36+
37+
@configuration = {
38+
axes: {
39+
horizontal: "Lines of JavaScript",
40+
},
41+
corner_radius: "100px"
42+
}
43+
```

app/markdown/types-of-charts/index.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
# Types of Charts
2-
This is about types of charts.
2+
In the future, PureChart will support a wide range of charts, including...
3+
4+
- Bar charts
5+
- Column charts
6+
- Pie charts
7+
- Line charts
8+
- Scatter plots
9+
- Box plots
10+
- And more!

app/markdown/types-of-charts/pie-chart/index.md

-2
This file was deleted.

app/views/articles/index.html.erb

+9-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@
3232
<div class='mobile-sidebar'>
3333
<div style="width: 100%">
3434
<div class='links padding-top'>
35-
<%= button_tag "Getting Started", id: "getting-started", class: "nav-button getting-started", data: { action: "click->articles--page#navigate" } %>
36-
<%= button_tag "Types of Charts", id: "types-of-charts", class: "nav-button types-of-charts", data: { action: "click->articles--page#navigate" } %>
37-
<%= button_tag "Chart Styling", id: "chart-styling", class: "nav-button chart-styling", data: { action: "click->articles--page#navigate" } %>
35+
<% @nav_tree.each do |key, value| %>
36+
<%= button_tag key, id: value["Index"], class: "nav-button #{value['Index']}", data: { action: "click->articles--page#navigate" } %>
37+
38+
<% value.each do |skey, svalue| %>
39+
<% if skey != "Index" %>
40+
<%= button_tag skey, id: svalue["Index"], class: "nav-button #{svalue['Index']} nested-page-button", data: { action: "click->articles--page#navigate" } %>
41+
<% end %>
42+
<% end %>
43+
<% end %>
3844
</div>
3945
</div>
4046

0 commit comments

Comments
 (0)